1 / 9

CSE 140 L: Arithmetic Operators

CSE 140 L: Arithmetic Operators. CK Cheng. Outlines. Subtraction 1’s Complement 2’s Complement. Subtraction. Examples:. 7-5 = 2. 6-3 = 3. 00 111 101 010. 11 110 011 011. Borrow Bit. Goal: Try to utilize existing addition operator. Arithmetic: x-y-b in =d-2b out.

rea
Download Presentation

CSE 140 L: Arithmetic Operators

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 140 L: Arithmetic Operators CK Cheng

  2. Outlines Subtraction 1’s Complement 2’s Complement

  3. Subtraction Examples: 7-5 = 2 6-3 = 3 • 00 • 111 • 101 • 010 • 11 • 110 • 011 • 011 Borrow Bit

  4. Goal: Try to utilize existing addition operator

  5. Arithmetic: x-y-bin =d-2bout From kmap: d= x  y  bin bout = x’y + ybin + x’bin = x’y + (x’+y)bin

  6. Subtraction using Full Adder sum = a  b  cin cout = ab + (a+b)cin

  7. One’s comp.: 2n -1 - x Two’s comp.: 2n-x, where x is a positive integer

  8. Two’s Complement Implementation x3x2x1x0 y3y2y1y0 w3w2w1w0 z4z3 z2z1z0 0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0110 1100 10011 x-y = x + (2n - y) - 2n = x + (2n-1-y) +1 - 2n = x + w + 1 - 2n

  9. One’s Complement Where 5 -2 =3 x3x2x1x0 y3y2y1y0 w3w2w1w0 0 1 0 1 0 0 1 0 1 1 0 1 x-y = x + (2n-1-y) - 2n +1 = x+w -2n+1 c4 cin Feed c4 to cin

More Related