Professional Documents
Culture Documents
use ieee.numeric_bit_unsigned.all;
entity gray2bcd is
port (gin : in bit_vector(3 downto 0) := "0000";
clk : in bit;
bcdout : out bit_vector(4 downto 0) := "00000");
end gray2bcd;
architecture gray2bcdarch of gray2bcd is
begin
process(clk)
variable gt9,temp_carry : bit:= '0';
variable temp : bit_vector(3 downto 0) := "0110";
variable bin : bit_vector(3 downto 0);
variable bcdout_temp : bit_vector(4 downto 0) := "00000";
begin
if clk'event and clk = '1' then
bin(3) := gin(3);
for i in 2 downto 0 loop
bin(i) := bin(i+1) xor gin(i);
end loop;