Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Adder and Subtractor Unit

  1. Dec 8, 2007 #1

    ECE

    User Avatar

    If two 4 bit numbers are being added in the Adder/Subtractor unit e.g. X and Y. Then according to my text book it is written that the Add/Sub Unit is built in a way that the add/sub signal (which chooses whether to add/subtract) is XOR with Y (the position where the number that is to be complemented is entered). But what if the user wants to enters { -5-3 }.How will the add/sub unit work then? Should the X input be also XOR with another signal similar to add/sub?

    -Thanks
     
  2. jcsd
  3. Dec 8, 2007 #2

    rbj

    User Avatar

    but you must also add 1 to the inverted bits. you do that with this adder/subtractor by coupling in the same 1 that goes to the XORs (the add/subtract signal where add=0 and subtract=1) to the carry-in of the LSB (which is tied to 0 if you're adding).

    no, just put in for A the bit pattern for -5, which is the same bit pattern for an unsigned 4-bit number that is 16-5 or 11. so -5 is 1011 and you subtact 3 (0011) which gets complimented to 1100 and goes into your full-adder, but then you gotta remember to couple in the 1 into the carry-in of the LSB (which effectively adds 1).

    1011 + 1100 + 0001 = [1]1000

    or -8 since the 1 that carries out falls off the edge.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Adder and Subtractor Unit
  1. Voltage subtractor (Replies: 26)

Loading...