Thread Closed

Adder and Subtractor Unit

 
Share Thread Thread Tools
Dec8-07, 03:15 PM   #1
ECE
 

Adder and Subtractor Unit


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
 
PhysOrg.com
PhysOrg
engineering news on PhysOrg.com

>> Researchers use light projector and single-pixel detectors to create 3-D images
>> GPS solution provides 3-minute tsunami alerts
>> Single-pixel power: Scientists make 3-D images without a camera
Dec8-07, 09:55 PM   #2
rbj
 
Quote by ECE View Post
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 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).

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?
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.
 
Thread Closed
Thread Tools


Similar Threads for: Adder and Subtractor Unit
Thread Forum Replies
How to use 4-bit parallel adders to perform 2Cs' subtraction? Electrical Engineering 2
Adder Computing & Technology 5
4-bit binary subtractor Electrical Engineering 7
boolean help. adder and subtractor Electrical Engineering 30
full adder using decoder? Electrical Engineering 1