--**************************************************
architecture a of crc_5 is
signal shift_reg : std_logic_vector(4 downto 0);
begin
process(rst,clk)
begin
if(rst='1') then
shift_reg<=(others=>'0');
elsif clk'event and clk='1' then
if crc_en='1' then
shift_reg(0)<=shift_reg(4) xor din;
shift_reg(1)<=shift_reg(0);
shift_reg(2)<=shift_reg(4) xor din xor shift_reg(1);
shift_reg(3)<=shift_reg(2);
shift_reg(4)<=shift_reg(4) xor din xor shift_reg(3);
else
shift_reg<=shift_reg(3 downto 0)&'0';
dout<=shift_reg(4);
end if;
end if;
end process;
end a;
--**************************************************