Binary to BCD Converter
Convert an 8-bit binary value to three BCD digits using the double-dabble shift-and-add-3 algorithm, so a value can be shown on a seven-segment display.
Constraints
- 8-bit input, three 4-bit BCD outputs.
- Use the shift-and-add-3 algorithm.
- Purely combinational.
- No division or modulo operators.
- Must handle the full range 0 to 255.
- Written in VHDL with numeric_std.
1library ieee;2use ieee.std_logic_1164.all;3use ieee.numeric_std.all;4 5entity bin2bcd is6 port (7 binary : in std_logic_vector(7 downto 0);8 hundreds : out std_logic_vector(3 downto 0);9 tens : out std_logic_vector(3 downto 0);10 ones : out std_logic_vector(3 downto 0)11 );12end bin2bcd;