Bcd:binary Coded Decimal is a 4-bit binary encoding that represents a 1-bit decimal number.
Definition: BCD code This encoding form uses four bits to store a decimal digit, making the conversion between binary and decimal fast. This coding technique is most commonly used in the design of accounting systems, because the accounting system often requires accurate calculations of long numbers of strings. Relative to the general floating-point notation, the use of BCD code, both to preserve the accuracy of the numerical value, but also to avoid the computer as a floating-point operation of the time spent. In addition, BCD coding is also common for other calculations that require high accuracy. Refer to the Baidu Encyclopedia of the BCD Code explanation: http://baike.baidu.com/view/45179.htm here to introduce the binary to the BCD Code hardware implementation, the use of the left to add 3 algorithm, described as follows: (here to 8-bit binary code as an example) 1, Move left to convert the binary code 1 bit 2, after the left shift, the BCD code is placed in the hundred, 10 bits, digit 3, if the shift is located after the BCD Code column is greater than or equal to 5, then add 34 to the value, continue to the left shift process until the completion of the example: hexadecimal code 0xFF converted to BCD code Verilog implementation plus 3 operation: Truth table
"FPGA" "Verilog Code" binary to BCD [go]