Skip to content
Snippets Groups Projects

Use block counts at sync for MM read..

Merged Eric Kooistra requested to merge L2SDP-819 into master
2 files
+ 76
17
Compare changes
  • Side-by-side
  • Inline

Files

@@ -120,13 +120,22 @@ ARCHITECTURE rtl OF dp_block_validate_err IS
@@ -120,13 +120,22 @@ ARCHITECTURE rtl OF dp_block_validate_err IS
-- Registers in st_clk domain
-- Registers in st_clk domain
SIGNAL count_reg : STD_LOGIC_VECTOR(c_mm_reg.nof_dat*c_mm_reg.dat_w-1 DOWNTO 0) := (OTHERS=>'0');
SIGNAL count_reg : STD_LOGIC_VECTOR(c_mm_reg.nof_dat*c_mm_reg.dat_w-1 DOWNTO 0) := (OTHERS=>'0');
 
SIGNAL nxt_cnt_en : STD_LOGIC;
 
SIGNAL cnt_en : STD_LOGIC := '0';
 
SIGNAL cnt_this_eop : STD_LOGIC;
 
SIGNAL mm_cnt_clr : STD_LOGIC;
SIGNAL mm_cnt_clr : STD_LOGIC;
SIGNAL cnt_clr : STD_LOGIC;
SIGNAL cnt_clr : STD_LOGIC;
SIGNAL cnt_blk : STD_LOGIC_VECTOR(g_cnt_w-1 DOWNTO 0);
SIGNAL cnt_blk : STD_LOGIC_VECTOR(g_cnt_w-1 DOWNTO 0);
 
SIGNAL cnt_blk_en : STD_LOGIC;
SIGNAL cnt_discarded : STD_LOGIC_VECTOR(g_cnt_w-1 DOWNTO 0);
SIGNAL cnt_discarded : STD_LOGIC_VECTOR(g_cnt_w-1 DOWNTO 0);
SIGNAL cnt_discarded_en : STD_LOGIC;
SIGNAL cnt_discarded_en : STD_LOGIC;
SIGNAL cnt_err : t_cnt_err_arr(g_nof_err_counts-1 DOWNTO 0);
SIGNAL cnt_err_arr : t_cnt_err_arr(g_nof_err_counts-1 DOWNTO 0);
SIGNAL cnt_err_en : STD_LOGIC_VECTOR(g_nof_err_counts-1 DOWNTO 0);
SIGNAL cnt_err_en_arr : STD_LOGIC_VECTOR(g_nof_err_counts-1 DOWNTO 0);
 
 
SIGNAL hold_cnt_blk : STD_LOGIC_VECTOR(g_cnt_w-1 DOWNTO 0);
 
SIGNAL hold_cnt_discarded : STD_LOGIC_VECTOR(g_cnt_w-1 DOWNTO 0);
 
SIGNAL hold_cnt_err_arr : t_cnt_err_arr(g_nof_err_counts-1 DOWNTO 0);
SIGNAL err_ok : STD_LOGIC;
SIGNAL err_ok : STD_LOGIC;
SIGNAL err_ok_reg : STD_LOGIC;
SIGNAL err_ok_reg : STD_LOGIC;
@@ -152,7 +161,15 @@ BEGIN
@@ -152,7 +161,15 @@ BEGIN
out_pulse => cnt_clr
out_pulse => cnt_clr
);
);
 
-- . clear block counters immediately at cnt_clr
 
-- . start block counters after sync, e.g. to align block counters in different nodes in
 
-- case the snk_in was (already) active during the cnt_clr
 
nxt_cnt_en <= '0' WHEN cnt_clr = '1' ELSE '1' WHEN snk_in.sync = '1' ELSE cnt_en;
 
cnt_en <= nxt_cnt_en WHEN rising_edge(dp_clk);
 
cnt_this_eop <= cnt_en AND snk_in.eop;
 
-- block counter
-- block counter
 
cnt_blk_en <= cnt_this_eop;
u_blk_counter : ENTITY common_lib.common_counter
u_blk_counter : ENTITY common_lib.common_counter
GENERIC MAP (
GENERIC MAP (
g_width => g_cnt_w,
g_width => g_cnt_w,
@@ -163,12 +180,12 @@ BEGIN
@@ -163,12 +180,12 @@ BEGIN
clk => dp_clk,
clk => dp_clk,
cnt_clr => cnt_clr,
cnt_clr => cnt_clr,
cnt_en => snk_in.eop,
cnt_en => cnt_blk_en,
count => cnt_blk
count => cnt_blk
);
);
-- discarded block counter
-- discarded block counter
cnt_discarded_en <= snk_in.eop WHEN TO_UINT(snk_in.err(g_nof_err_counts-1 DOWNTO 0)) > 0 ELSE '0';
cnt_discarded_en <= cnt_this_eop WHEN TO_UINT(snk_in.err(g_nof_err_counts-1 DOWNTO 0)) > 0 ELSE '0';
u_discarded_counter : ENTITY common_lib.common_counter
u_discarded_counter : ENTITY common_lib.common_counter
GENERIC MAP (
GENERIC MAP (
g_width => g_cnt_w,
g_width => g_cnt_w,
@@ -185,7 +202,7 @@ BEGIN
@@ -185,7 +202,7 @@ BEGIN
-- error counters
-- error counters
gen_err_counters : FOR I IN 0 TO g_nof_err_counts-1 GENERATE
gen_err_counters : FOR I IN 0 TO g_nof_err_counts-1 GENERATE
cnt_err_en(I) <= snk_in.eop AND snk_in.err(I);
cnt_err_en_arr(I) <= cnt_this_eop AND snk_in.err(I);
u_blk_counter : ENTITY common_lib.common_counter
u_blk_counter : ENTITY common_lib.common_counter
GENERIC MAP (
GENERIC MAP (
g_width => g_cnt_w,
g_width => g_cnt_w,
@@ -196,17 +213,33 @@ BEGIN
@@ -196,17 +213,33 @@ BEGIN
clk => dp_clk,
clk => dp_clk,
cnt_clr => cnt_clr,
cnt_clr => cnt_clr,
cnt_en => cnt_err_en(I),
cnt_en => cnt_err_en_arr(I),
count => cnt_err(I)
count => cnt_err_arr(I)
);
);
END GENERATE;
END GENERATE;
 
-- Hold counter values at snk_in.sync to have stable values for MM read for comparision between nodes
 
p_hold_counters : PROCESS(dp_clk)
 
BEGIN
 
IF rising_edge(dp_clk) THEN
 
IF cnt_clr = '1' THEN
 
hold_cnt_blk <= (OTHERS=>'0');
 
hold_cnt_discarded <= (OTHERS=>'0');
 
hold_cnt_err_arr <= (OTHERS=>(OTHERS=>'0'));
 
ELSIF snk_in.sync = '1' THEN
 
hold_cnt_blk <= cnt_blk;
 
hold_cnt_discarded <= cnt_discarded;
 
hold_cnt_err_arr <= cnt_err_arr;
 
END IF;
 
END IF;
 
END PROCESS;
 
-- Register mapping
-- Register mapping
gen_reg : FOR I IN 0 TO g_nof_err_counts-1 GENERATE
gen_reg : FOR I IN 0 TO g_nof_err_counts-1 GENERATE
count_reg((I + 1) * c_word_w - 1 DOWNTO I * c_word_w) <= RESIZE_UVEC(cnt_err(I), c_word_w);
count_reg((I + 1) * c_word_w - 1 DOWNTO I * c_word_w) <= RESIZE_UVEC(hold_cnt_err_arr(I), c_word_w);
END GENERATE;
END GENERATE;
count_reg((g_nof_err_counts+1) * c_word_w - 1 DOWNTO g_nof_err_counts * c_word_w ) <= RESIZE_UVEC(cnt_discarded, c_word_w);
count_reg((g_nof_err_counts+1) * c_word_w - 1 DOWNTO g_nof_err_counts * c_word_w ) <= RESIZE_UVEC(hold_cnt_discarded, c_word_w);
count_reg((g_nof_err_counts+2) * c_word_w - 1 DOWNTO (g_nof_err_counts+1) * c_word_w ) <= RESIZE_UVEC(cnt_blk, c_word_w);
count_reg((g_nof_err_counts+2) * c_word_w - 1 DOWNTO (g_nof_err_counts+1) * c_word_w ) <= RESIZE_UVEC(hold_cnt_blk, c_word_w);
u_reg : ENTITY common_lib.common_reg_r_w_dc
u_reg : ENTITY common_lib.common_reg_r_w_dc
GENERIC MAP (
GENERIC MAP (
Loading