Skip to content
Snippets Groups Projects

Resolve L2SDP-557

Merged Reinier van der Walle requested to merge L2SDP-557 into master
Files
3
@@ -133,7 +133,6 @@ BEGIN
@@ -133,7 +133,6 @@ BEGIN
);
);
-- discarded counter
-- discarded counter
cnt_discarded_en <= '1' WHEN in_sosi.sync = '1' AND bsn_ok = '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 => c_word_w,
g_width => c_word_w,
@@ -187,16 +186,55 @@ BEGIN
@@ -187,16 +186,55 @@ BEGIN
-- MM registers in st_clk domain
-- MM registers in st_clk domain
reg_wr_arr => OPEN,
reg_wr_arr => OPEN,
reg_rd_arr => OPEN,
reg_rd_arr => OPEN,
in_reg => count_reg, -- read only
in_reg => count_reg, -- read only
out_reg => OPEN -- no write
out_reg => OPEN -- no write
);
);
bsn_at_sync <= bs_sosi.bsn WHEN bs_sosi.sync = '1' ELSE bsn_at_sync_reg;
-- Process to check the bsn at sync. It captures the bsn at the sync of bs_sosi. Then compares that bsn to
bsn_ok <= bsn_ok_reg WHEN in_sosi.sync = '0' ELSE '1' WHEN in_sosi.bsn = bsn_at_sync ELSE '0';
-- the bsn at sync of in_sosi. If they are unequal all packets during that sync period with in_sosi.channel
out_valid <= '1' WHEN in_sosi.sop = '1' AND TO_UINT(in_sosi.channel) /= g_check_channel ELSE
-- equal to g_check_channel are discarded.
bsn_ok WHEN in_sosi.sop = '1' AND TO_UINT(in_sosi.channel) = g_check_channel ELSE
p_bsn_check : PROCESS(bs_sosi, in_sosi, bsn_at_sync_reg, bsn_ok_reg, out_valid_reg)
out_valid_reg;
-- v_bsn_ok used for the first in_sosi packet of a sync period as sync and sop are both '1'.
 
VARIABLE v_bsn_ok : STD_LOGIC;
 
-- Using v_bsn_at_sync to ensure correct behavior when in_sosi has no latency compared to bs_sosi.
 
VARIABLE v_bsn_at_sync : STD_LOGIC_VECTOR(g_bsn_w-1 DOWNTO 0);
 
BEGIN
 
v_bsn_at_sync := bsn_at_sync_reg;
 
v_bsn_ok := bsn_ok_reg;
 
out_valid <= out_valid_reg;
 
cnt_discarded_en <= '0';
 
 
IF bs_sosi.sync = '1' THEN
 
v_bsn_at_sync := bs_sosi.bsn(g_bsn_w-1 DOWNTO 0);
 
END IF;
 
 
IF TO_UINT(in_sosi.channel) = g_check_channel THEN
 
IF in_sosi.sync = '1' THEN
 
-- Compare bsn at sync of in_sosi to bsn at sync of bs_sosi.
 
IF UNSIGNED(in_sosi.bsn(g_bsn_w-1 DOWNTO 0)) = UNSIGNED(v_bsn_at_sync) THEN
 
v_bsn_ok := '1';
 
ELSE
 
v_bsn_ok := '0';
 
END IF;
 
 
-- set cnt_discarded_en to control u_discarded_counter.
 
cnt_discarded_en <= NOT v_bsn_ok;
 
END IF;
 
-- Setting out_valid to control the discarding at packet level.
 
IF in_sosi.sop = '1' THEN
 
out_valid <= v_bsn_ok;
 
END IF;
 
ELSE
 
IF in_sosi.sop = '1' THEN
 
out_valid <= '1'; -- Packets with channel unequal to g_check_channel are always valid
 
END IF;
 
 
END IF;
 
bsn_ok <= v_bsn_ok; -- bsn_ok is used to indicate if the bsn is correct for the entire sync period of g_check_channel.
 
bsn_at_sync <= v_bsn_at_sync; -- register to store the bsn at sync of bs_sosi.
 
END PROCESS;
 
p_dp_clk : PROCESS(dp_rst, dp_clk)
p_dp_clk : PROCESS(dp_rst, dp_clk)
BEGIN
BEGIN
IF dp_rst='1' THEN
IF dp_rst='1' THEN
Loading