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

fix clear fifo on erroneous frame

parent 408018f1
Branches
Tags
No related merge requests found
......@@ -109,13 +109,16 @@ architecture rtl of ccn_pack is
-- Output FIFO
signal fifo_tvalid : std_logic;
signal fifo_tvalid_c : std_logic;
signal fifo_tready : std_logic;
signal fifo_tready_c : std_logic;
signal fifo_tdata : std_logic_vector(63 downto 0);
signal fifo_tkeep : std_logic_vector(7 downto 0);
signal fifo_tlast : std_logic;
signal fifo_tuser : std_logic_vector(0 downto 0);
signal fifo_tuser_slv : std_logic_vector(7 downto 0);
signal fifo_err_rst : std_logic;
signal fifo_clr : std_logic;
-- Some constant for mapping
constant C_TKEEP_S00 : std_logic_vector(23 downto 0) := (others => '1');
......@@ -235,6 +238,23 @@ begin
end if;
end process p_frame_cnt;
----------------
-- FIFO CLEAR --
----------------
p_fifo_clr:process(aclk, aresetn)
begin
if aresetn = '0' then
fifo_clr <= '0';
elsif rising_edge(aclk) then
if fifo_tuser(0) = '1' then
fifo_clr <= '1';
else
if fifo_tlast = '1' then
fifo_clr <= '0';
end if;
end if;
end if;
end process p_fifo_clr;
----------------------
-- HEADER INSERTION --
......@@ -290,7 +310,7 @@ begin
s01_axis_tlast => pkt_ix_tlast,
s01_axis_tuser => pkt_ix_tuser,
m00_axis_tvalid => fifo_tvalid,
m00_axis_tready => fifo_tready,
m00_axis_tready => fifo_tready_c,
m00_axis_tdata => fifo_tdata,
m00_axis_tkeep => fifo_tkeep,
m00_axis_tlast => fifo_tlast,
......@@ -303,14 +323,16 @@ begin
-- FIFO --
----------
fifo_tuser(0) <= or_reduce(fifo_tuser_slv);
fifo_err_rst <= (not fifo_tuser(0)) and aresetn;
fifo_err_rst <= (not fifo_clr) and aresetn;
fifo_tready_c <= fifo_tready or fifo_clr;
fifo_tvalid_c <= fifo_tvalid and not fifo_clr;
inst_fifo: entity work.ccn_axis_fifo_pframe
port map(
s_axis_aresetn => fifo_err_rst,
s_axis_aclk => aclk,
m_axis_aclk => m_axis_clk,
s_axis_tvalid => fifo_tvalid,
s_axis_tvalid => fifo_tvalid_c,
s_axis_tready => fifo_tready,
s_axis_tdata => fifo_tdata,
s_axis_tkeep => fifo_tkeep,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment