- 2081 Baisakh · 2+2+3 marks
39 to Gray/Excess-3 and 2's complement addition
Short answer
39 in Gray: binary 100111, Gray = 1 then XOR adjacent: 1,0,1,0,0 → 110100. Excess-3: 3→0110, 9→1100 → 0110 1100. (-28+17) in 8-bit 2's complement: -28 = 11100100, +17 = 00010001, sum = 11110101, which is -11.
Convert decimal 39 into Gray code and Excess-3 code. Use 2's complement method to perform the following addition (-28+17)₁₀.
Decimal 39 to Gray code
First convert to binary by repeated division by 2:
| Division | Quotient | Remainder |
|---|---|---|
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading upwards: .
Binary to Gray (keep MSB, then XOR adjacent bits):
Binary : 1 0 0 1 1 1
| / \ / \ / \ / \ /
Gray : 1 1 0 1 0 0
Answer:
Decimal 39 to Excess-3
Add 3 to each digit: 3 + 3 = 6 → 0110; 9 + 3 = 12 → 1100.
Answer:
(−28) + (17) using 2's complement (8-bit)
- 1's complement: ; add 1 →
1110 0100 (-28)
+ 0001 0001 (+17)
-----------
1111 0101 no end carry
No end carry, so the result is negative and in 2's complement form. Take the 2's complement to find its magnitude: .
Answer:
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Gray→BCD, decimal→Excess-3 and 2's complement addition · Digital Logic, chapter 1
- 39 to binary/hex and 2's complement addition · Digital Logic, chapter 1
- Convert (17)₁₀ to Gray · Digital Logic, chapter 1
- Convert (17)excess-3 to BCD · Digital Logic, chapter 1
- Convert (10101)gray to decimal · Digital Logic, chapter 1
- Gray vs binary code, convert (10110)₂ to Gray · Digital Logic, chapter 1