The binary code is the underlying of all computation in logic design. However, decimal numbers are 1
more convenient for human and can easily be shown by 7-segments. To cope with decimal arithmetic, 2
designers usually use special coding mechanism such as Binary Coded Decimal (BCD). 3
This lecture explains this coding approach and how to convert a binary number into the equivalent 4
BCD to be shown on 7-segment displays. 5
In the BCD coding technique, each decimal digit is shown by a four-bit code. 6
This code contains the binary representation of the digit. 7
For example, the binary representation of 24 is 00011000; 8
however, its BCD code is the concatenation of the BCD codes for digits 2 and 4, which are 9
their 4-bit binary code. Converting a binary number into the equivalent BCD and then to the 10
7-segment code is the goal of this lecture. 11
A 4-bit BCD can represent a decimal digit. However, there are two ways to save the code: using 4 12
bits (or a nibble) which is called packed BCD or using 8 bits (or a byte) which is called unpacked 13
BCD. In the 8 bits, the upper 4 bits are zero. 14
The two different BCD representations of 12 are shown in this figure. Whereas the unpacked 15
BCD requires two bytes, 16
the packed BCD needs only one byte of memory. 17
This table shows the 1-digit packed BCD codes for numbers from 0 to 9. and this one shows 18
the 2-digit packed 19
BCD codes for numbers from 10 to 99. 20
Designing a digital circuit to convert a binary code into its equivalent BCD would be our next topic. 21
In the following lectures, I will explain two different methods to address this problem in HLS. 22
These are the takeaway messages. 23
BCD coding represents the decimal numbers. 24
There are two types of BCD representation: packed and unpacked. 25
Now the quiz for this lecture Find the BCD code for the binary number.