"FPGA" "Verilog Code" binary to BCD [go]

Source: Internet
Author: User

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]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.