chap2
chap2
George Gregoriou
LSB
Answer:
4910 = 1100012
0 0 1 1 0 1 0 1
0 0 1 1 0 1 0 1
Input bits
Carry
Adder
in (add 1)
Output bits (sum)
0 0 1 1 0 1 1 0
Assuming that the sign bit = 128, show that 11000110 = 58
as a 2’s complement signed number:
Column weights: 128 64 32 16 8 4 2 1.
1 1 0 0 0 1 1 0
128 +64 +4 +2 = 58
Examples:
00011110 = +30 00001110 = +14 11111111 = 1
00001111 = +15 11101111 = 17 11111000 = 8
00101101 = +45 11111101 = 3 1 11110111 = 9
Discard carry
5 D 3 A 2
LSD
MSD
Stop when whole number
quotient reaches 0.
Hexadecimal addition
64 36 83 77 79
+ 25 + 55 + 62 + 86 + 8B
89 8B E5 FD 104
86 BA 70 D2
- 25 - 38 - 26 - 73
61 82 4A 5F
HexNumberA - HexNumberB
HexNumberA + 2’s complement of HexNumberB
Remember to drop any carry produced!
BCD addition
1000 8
+ 0101 +5
1101 13
Invalid BCD + 0110
number (>9) Add 6 in order to skip the 6 invalid codes 10-15
0001 0011 = 13 in BCD
1001 9
+ 1000 +8
10001 17
Invalid because + 0110
of carry Add 6
0001 0111 = 17 in BCD
Binary sequence
Gray code sequence
1 + 0 + 1 + 1 + 0 + 1
1 1 1 0 1 1
Floyd, Digital Fundamentals, 10th ed
Summary
Gray code
Gray to Binary Code Conversion
The MSB (left-most) in the binary code is the same as the
corresponding MSB in the Gray code.
Add each binary code bit generated to the Gray code bit in
the next adjacent position. Discard carries.
1 1 1 0 1 1
+ + + + +
1 0 1 1 0 1
Floyd, Digital Fundamentals, 10th ed
Summary
ASCII (American Standard Code of Information Interchange)