- 2081 Bhadra · 5+4 marks
Half adder/subtractor; 1's and 2's complement subtraction
Short answer
One XOR gate gives sum and difference S=D=A⊕B; carry C=AB, borrow Bo=A'B using two AND and one NOT. (a) 47-26: 47=00101111, 2's comp of 26=11100110; sum=1 00010101, discard end carry, result = 21. (b) 10010-10011: 1's comp of 10011=01100; sum=11110, no end-around carry, result = -00001 = -1.
Design half adder and half subtractor in a single circuit. Perform following operation: a) (47)₁₀ - (26)₁₀ subtraction using 2's complement method. b) (10010)₂ - (10011)₂ using 1's complement method.
Half adder and half subtractor in one circuit
Inputs , . Outputs: sum , carry , difference , borrow ().
| A | B | S | C | D | |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 | 0 | 0 |
The sum and difference are the same function, so one XOR gate serves both. Add one AND gate for and one NOT plus one AND gate for .
A --+---------------[XOR]------> S (= D)
B --|--+------------[ ]
| |
+--|------------[AND]------> C
| +------------[ ]
| |
+--|--[NOT]--A'-[AND]------> Bo
+------------[ ]
Total: 1 XOR, 2 AND, 1 NOT.
(If one output pair with a mode input is preferred: , , giving carry when and borrow when .)
a) (47)₁₀ − (26)₁₀ by 2's complement (8-bit)
0010 1111 (+47)
+ 1110 0110 (-26)
-----------
1 0001 0101
An end carry occurs: discard it. The result is positive.
Answer: . Check: .
b) (10010)₂ − (10011)₂ by 1's complement
10010
+ 01100
-------
11110 (no end-around carry)
No end carry, so the result is negative; take its 1's complement:
Answer: . Check: .
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 2-bit fast adder; full subtractor from half subtractors · Digital Logic, chapter 5
- De Morgan's theorem and (-47+27) by 2's complement · Digital Logic, chapter 2
- FFH AND C0H; (16)₁₀ − (26)₁₀ by 2's complement · Digital Logic, chapter 5
- Full adder using decoder; (57−43) by 2's complement · Digital Logic, chapter 4
- Half subtractor using HDL · Digital Logic, chapter 2
- Full subtractor from half subtractors · Digital Logic, chapter 5
- 2's complement subtraction; AND using NOR · Basic Electronics Engineering, chapter 6
- VHDL PROCESS; full adder with half adders · Embedded System, chapter 9
- Single-phase half-wave thyristor rectifier, R load · Power Electronics, chapter 2
- Chopper definition; single-phase half bridge inverter · Advanced Electronics, chapter 7