09 DLD Lec 09 Binary Codes Dated 13 Apr 2022 Lecture Slides
09 DLD Lec 09 Binary Codes Dated 13 Apr 2022 Lecture Slides
By Nasir Mahmood
[email protected]
[email protected]
2
Binary Codes
● All symbols in a computer must be represented by a
binary code (binary representation).
BCD Code (8 4 2 1)
Multi-Digit BCD
5
BCD Addition
● BCD only represents each of the decimal digitals 0 through
9 as a single 4-bit binary value.
● When adding two BCD values, if the sum is equal to or less
than 1001 (9), the corresponding BCD value is correct.
● However, when the binary sum is greater or equal to 1010
(10), the result is an invalid BCD value.
● To overcome the invalid BCD value add 0110 (6) to the result to obtain the
BCD representation and also produces a carry as required.
● The use of 0110 (6) works because the difference between a carry in the
most significant bit position of the binary sum and a decimal carry differ
by 16-10 = 6.
7
The End