How Does an Adder/Subtractor Unit Handle Negative Inputs?

  • Thread starter Thread starter ECE
  • Start date Start date
  • Tags Tags
    Adder Unit
AI Thread Summary
In an Adder/Subtractor unit, when adding two 4-bit numbers, the add/subtract signal is XORed with the second input (Y) to determine whether to add or subtract. To handle negative inputs, such as -5 and -3, the bit pattern for -5 (1011) is used, and the number to be subtracted (3) is complemented (1100) before being added. Additionally, a carry-in of 1 is included to account for the two's complement operation. The final calculation results in -8, as the carry-out falls off the edge. This method effectively allows the unit to process negative inputs correctly.
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.
 
Hi all I have some confusion about piezoelectrical sensors combination. If i have three acoustic piezoelectrical sensors (with same receive sensitivity in dB ref V/1uPa) placed at specific distance, these sensors receive acoustic signal from a sound source placed at far field distance (Plane Wave) and from broadside. I receive output of these sensors through individual preamplifiers, add them through hardware like summer circuit adder or in software after digitization and in this way got an...
While I was rolling out a shielded cable, a though came to my mind - what happens to the current flow in the cable if there came a short between the wire and the shield in both ends of the cable? For simplicity, lets assume a 1-wire copper wire wrapped in an aluminum shield. The wire and the shield has the same cross section area. There are insulating material between them, and in both ends there is a short between them. My first thought, the total resistance of the cable would be reduced...
I am not an electrical engineering student, but a lowly apprentice electrician. I learn both on the job and also take classes for my apprenticeship. I recently wired my first transformer and I understand that the neutral and ground are bonded together in the transformer or in the service. What I don't understand is, if the neutral is a current carrying conductor, which is then bonded to the ground conductor, why does current only flow back to its source and not on the ground path...

Similar threads

Back
Top