

John Loomis's site has a guide to the logic structure required to implement in hardware. For a parallel (asynchronous) conversionįor narrow values like yours Dr. There is a carry path right through every digit, and the carry logic is not suited to FPGA (binary) carry chain logic, so the space implementation generally gives unacceptable timing results for large inputs. Implementations repeat this process, either synchronously in time using a shift register and 'n' cycles for an n-bit input, or in space by placing the logic circuits for the correction feeding each other and doing the shift with wiring. b 1000 (0x8) which during the shift doubles to 16 decimal (0x10), representing a carry out of 1 to the next digit and the expected zero. Examining 5 b 0101, that will shift to b 1010 (0xA), which is not a BCD digit. Why three? BCD digits in the range zero to four (0,1,2,4) will double naturally to 0,2,4,8 after the shift. This correction looks for digits that will 'BCD overflow' decimal 9 -> 10 on the next shift and patches the result by adding three. After each shift a correction is applied to each 4-bit BCD column (or those having more than 3 bits shifted in by that point). Each repetition halves the remaining binary number and doubles the BCD number, after the complete binary value is shifted the result is obtained.

The Double-dabble technique converts binary to BCD by repeated shifting.
