Skip to content
Snippets Groups Projects
Commit c153649f authored by Reinier van der Walle's avatar Reinier van der Walle
Browse files

processed review comments

parent 217e96fd
No related branches found
No related tags found
1 merge request!183Resolve L2SDP-557
Pipeline #22650 passed
...@@ -190,9 +190,14 @@ BEGIN ...@@ -190,9 +190,14 @@ BEGIN
out_reg => OPEN -- no write out_reg => OPEN -- no write
); );
p_bsn_check : PROCESS(bs_sosi, in_sosi, bsn_at_sync_reg, bsn_ok_reg) -- Process to check the bsn at sync. It captures the bsn at the sync of bs_sosi. Then compares that bsn to
-- the bsn at sync of in_sosi. If they are unequal all packets during that sync period with in_sosi.channel
-- equal to g_check_channel are discarded.
p_bsn_check : PROCESS(bs_sosi, in_sosi, bsn_at_sync_reg, bsn_ok_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; VARIABLE v_bsn_ok : STD_LOGIC;
VARIABLE v_bsn_at_sync : STD_LOGIC_VECTOR(g_bsn_w-1 DOWNTO 0); -- 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 BEGIN
v_bsn_at_sync := bsn_at_sync_reg; v_bsn_at_sync := bsn_at_sync_reg;
v_bsn_ok := bsn_ok_reg; v_bsn_ok := bsn_ok_reg;
...@@ -202,30 +207,32 @@ BEGIN ...@@ -202,30 +207,32 @@ BEGIN
v_bsn_at_sync := bs_sosi.bsn; v_bsn_at_sync := bs_sosi.bsn;
END IF; END IF;
IF in_sosi.sync = '1' AND TO_UINT(in_sosi.channel) = g_check_channel THEN IF TO_UINT(in_sosi.channel) = g_check_channel THEN
IF in_sosi.bsn = v_bsn_at_sync THEN -- Compare bsn at sync of in_sosi to bsn at sync of bs_sosi.
v_bsn_ok := '1'; IF in_sosi.sync = '1' THEN
ELSE IF in_sosi.bsn = v_bsn_at_sync THEN
v_bsn_ok := '0'; v_bsn_ok := '1';
ELSE
v_bsn_ok := '0';
END IF;
END IF; END IF;
END IF;
IF in_sosi.sop = '1' THEN -- Setting out_valid to control the discarding at packet level.
IF TO_UINT(in_sosi.channel) = g_check_channel THEN IF in_sosi.sop = '1' THEN
out_valid <= v_bsn_ok; out_valid <= v_bsn_ok;
ELSE
out_valid <= '1';
END IF; END IF;
END IF;
-- set cnt_discarded_en to control u_discarded_counter.
IF TO_UINT(in_sosi.channel) = g_check_channel THEN
cnt_discarded_en <= in_sosi.sync AND NOT v_bsn_ok; cnt_discarded_en <= in_sosi.sync AND NOT v_bsn_ok;
ELSE ELSE
cnt_discarded_en <= '0'; IF in_sosi.sop = '1' THEN
END IF; out_valid <= '1'; -- Packets with channel unequal to g_check_channel are always valid
END IF;
bsn_ok <= v_bsn_ok; cnt_discarded_en <= '0'; -- Packets with channel unequal to g_check_channel cannot be discarded.
bsn_at_sync <= v_bsn_at_sync; 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; END PROCESS;
p_dp_clk : PROCESS(dp_rst, dp_clk) p_dp_clk : PROCESS(dp_rst, dp_clk)
......
...@@ -63,7 +63,8 @@ ARCHITECTURE tb OF tb_dp_block_validate_bsn_at_sync IS ...@@ -63,7 +63,8 @@ ARCHITECTURE tb OF tb_dp_block_validate_bsn_at_sync IS
CONSTANT c_gap_size : NATURAL := 4; CONSTANT c_gap_size : NATURAL := 4;
CONSTANT c_nof_sync : NATURAL := 5; CONSTANT c_nof_sync : NATURAL := 5;
CONSTANT c_nof_blk : NATURAL := g_nof_blocks_per_sync * c_nof_sync; CONSTANT c_nof_blk : NATURAL := g_nof_blocks_per_sync * c_nof_sync;
CONSTANT c_check_channel : NATURAL := g_nof_blocks_per_sync; -- choosing c_check_channel such that it corresponds with a channel from stimuli on a sync because the channel field is generated by a counter.
CONSTANT c_check_channel : NATURAL := g_nof_blocks_per_sync; -- can be c_check_channel MOD g_nof_blocks_per_sync = 0 but not larger than c_nof_blk.
SIGNAL dp_clk : STD_LOGIC := '1'; SIGNAL dp_clk : STD_LOGIC := '1';
SIGNAL mm_clk : STD_LOGIC := '1'; SIGNAL mm_clk : STD_LOGIC := '1';
...@@ -191,7 +192,8 @@ BEGIN ...@@ -191,7 +192,8 @@ BEGIN
VARIABLE v_valid_blk : BOOLEAN := TRUE; VARIABLE v_valid_blk : BOOLEAN := TRUE;
BEGIN BEGIN
IF rising_edge(dp_clk) THEN IF rising_edge(dp_clk) THEN
IF reference_sosi.sop = '1' THEN IF reference_sosi.sop = '1' THEN --Decide for each block if it should be valid.
-- A block can only be discarded if its channel field corresponds with the check_channel.
IF g_bsn_init >= g_nof_blocks_per_sync AND TO_UINT(reference_sosi.channel) = c_check_channel THEN IF g_bsn_init >= g_nof_blocks_per_sync AND TO_UINT(reference_sosi.channel) = c_check_channel THEN
v_valid_blk := FALSE; v_valid_blk := FALSE;
ELSE ELSE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment