Skip to content
Snippets Groups Projects
Commit 5545f12e authored by BRONES Romain's avatar BRONES Romain
Browse files

Change CRC state machine

* Do not allow to start CRC computation right after a result
* CRC word counter up to 12 then roll over to 0
parent 8a55c84b
No related branches found
No related tags found
No related merge requests found
......@@ -178,23 +178,25 @@ begin
crc_reg <= C_CRCINIT;
crc_cnt <= (others => '0');
elsif rising_edge(clk) then
if crc_cnt = 0 then
if flag_sop_inc = '1' then
case crc_cnt is
when "0000" =>
if flag_sop_inc = '1' then
crc_cnt <= crc_cnt+1;
crc_reg <= C_CRCINIT;
else
crc_cnt <= (others => '0');
end if;
when "1011" =>
crc_reg <= crc_reg;
crc_cnt <= crc_cnt+1;
crc_reg <= C_CRCINIT;
else
crc_cnt <= (others => '0');
end if;
else
if crc_cnt = 10 then
when "1100" =>
crc_reg <= crc_reg;
crc_cnt <= (others => '0');
else
crc_cnt <= crc_cnt +1;
end if;
crc_reg <= lfsr_c;
when others =>
crc_reg <= lfsr_c;
crc_cnt <= crc_cnt+1;
end case;
end if;
end if;
end process p_crc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment