How Does an Adder/Subtractor Unit Handle Negative Inputs?

  • Thread starter Thread starter ECE
  • Start date Start date
  • Tags Tags
    Adder Unit
Click For Summary
SUMMARY

The Adder/Subtractor unit processes negative inputs by utilizing a combination of XOR operations and carry-in adjustments. When adding two 4-bit numbers, such as -5 and -3, the unit requires the bit pattern for -5 (1011) and the bit pattern for 3 (0011) to be complemented to 1100. The carry-in for the least significant bit (LSB) must also be set to 1 to account for the addition of the inverted bits. This results in the calculation 1011 + 1100 + 0001, yielding a final result of -8.

PREREQUISITES
  • Understanding of 4-bit binary representation
  • Familiarity with XOR logic operations
  • Knowledge of binary addition and subtraction techniques
  • Experience with digital circuit design concepts
NEXT STEPS
  • Study the design and operation of full adders in digital circuits
  • Learn about two's complement representation for negative numbers
  • Explore the implementation of arithmetic logic units (ALUs)
  • Investigate the role of carry-in and carry-out in binary addition
USEFUL FOR

Digital circuit designers, computer engineers, and students studying computer architecture will benefit from this discussion on the functionality of Adder/Subtractor units in handling negative inputs.

ECE
Messages
7
Reaction score
0
If two 4 bit numbers are being added in the Adder/Subtractor unit e.g. X and Y. Then according to my textbook 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
 
Engineering news on Phys.org
ECE said:
If two 4 bit numbers are being added in the Adder/Subtractor unit e.g. X and Y. Then according to my textbook 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 got to 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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
19K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K