Skip to content
Snippets Groups Projects
Commit 3cb44a58 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Fixed verification of g_bsn_increment. Prepared support for g_pkt_len_unmerge /= g_pkt_len_merge.

parent 8407f100
No related branches found
No related tags found
1 merge request!357Move func_sdp_bdo_cep_hdr_field_sel_dest() from sdp_bdo_pkg to...
......@@ -21,11 +21,24 @@
-- Purpose:
-- . Test bench for dp_packet_merge and dp_packet_unmerge
-- Description:
-- . The p_stimuli_st uses proc_dp_gen_block_data to generate g_nof_repeat packets for the DUT. The output of the DUT needs
-- to be similar e.g. by means of an inverse DUT component so that the proc_dp_verify_* procedures can be used to verify
-- that the counter data in the sosi data fields is passed on correctly. Furthermore the proc_dp_verify_* procedures
-- verify that the test bench has yielded output results at all and that the output valid, sop, eop, and ready fits the
-- streaming interface specification.
-- . The p_stimuli_st uses proc_dp_gen_block_data to generate g_nof_repeat
-- stimuli_src_out packets of length g_pkt_len_merge.
-- The u_dp_packet_merge merges g_nof_pkt packets from stimuli_src_out into
-- dp_packet_merge_src_out.
-- The p_stimuli_unmerge provides stimuli for the .err and .empty fields of
-- dp_packet_merge_src_out to get dp_packet_merge_sosi
-- The u_dp_packet_unmerge unmerges the dp_packet_merge_sosi into packets
-- of length g_pkt_len_unmerge into verify_snk_in.
-- If g_pkt_len_unmerge /= g_pkt_len_merge, then the last unmerged packet
-- may be shorter then g_pkt_len_unmerge, to contain the remaining data.
--
-- p_stimuli_st --> u_dp_packet_merge --+--> u_dp_packet_unmerge --> p_verify
-- ^
-- |
-- p_stimuli_unmerge --/
--
-- . Flow control is verified via g_flow_control_*.
--
-- Usage:
-- > as 10
-- > run -all
......@@ -49,11 +62,12 @@ entity tb_dp_packet_merge_unmerge is
-- specific
g_pipeline_ready : boolean := true;
g_data_w : natural := 16;
g_nof_repeat : natural := 24;
g_nof_repeat : natural := 14;
g_nof_pkt : natural := 3;
g_pkt_len : natural := 29;
g_pkt_len_merge : natural := 9;
g_pkt_len_unmerge : natural := 9;
g_pkt_gap : natural := 0;
g_bsn_increment : natural := 0
g_bsn_increment : natural := 2
);
end tb_dp_packet_merge_unmerge;
......@@ -70,6 +84,8 @@ architecture tb of tb_dp_packet_merge_unmerge is
constant c_data_max : unsigned(g_data_w - 1 downto 0) := (others => '1');
constant c_data_init : integer := -1;
constant c_bsn_init : std_logic_vector(c_dp_stream_bsn_w - 1 downto 0) := X"0000000000000000"; -- X"0877665544332211"
constant c_bsn_increment_w : natural := ceil_log2(g_bsn_increment + 1);
constant c_unsigned_bsn_increment : unsigned(c_bsn_increment_w - 1 downto 0) := to_unsigned(g_bsn_increment, c_bsn_increment_w);
constant c_nof_pkt_not_zero : natural := sel_a_b(g_nof_pkt = 0, 1, g_nof_pkt);
constant c_nof_merged_sop : natural := sel_a_b(g_nof_pkt = 0, 0, ceil_div(g_nof_repeat, c_nof_pkt_not_zero));
......@@ -165,11 +181,11 @@ begin
v_sosi.bsn := INCR_UVEC(v_sosi.bsn, g_bsn_increment);
-- insert sync starting at BSN = c_sync_offset and with period c_sync_period
v_sosi.sync := sel_a_b((unsigned(v_sosi.bsn) mod c_sync_period) = c_sync_offset, '1', '0');
v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len);
v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len_merge);
v_sosi.data := RESIZE_DP_DATA(v_sosi.data(g_data_w - 1 downto 0)); -- wrap when >= 2**g_data_w
-- Send packet
proc_dp_gen_block_data(g_data_w, TO_UINT(v_sosi.data), g_pkt_len,
proc_dp_gen_block_data(g_data_w, TO_UINT(v_sosi.data), g_pkt_len_merge,
c_channel, c_err, v_sosi.sync, v_sosi.bsn,
clk, stimuli_en, stimuli_src_in, stimuli_src_out);
......@@ -182,8 +198,8 @@ begin
-- . e_at_least
v_sosi.bsn := std_logic_vector(unsigned(c_bsn_init) + c_verify_at_least * g_nof_pkt);
-- . account for g_pkt_len
v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len - 1);
-- . account for g_pkt_len_merge
v_sosi.data := INCR_UVEC(v_sosi.data, g_pkt_len_merge - 1);
v_sosi.data := RESIZE_DP_DATA(v_sosi.data(g_data_w - 1 downto 0)); -- wrap when >= 2**g_data_w
expected_verify_snk_in <= v_sosi;
......@@ -201,6 +217,7 @@ begin
------------------------------------------------------------------------------
-- DATA VERIFICATION
-- . p_verify
------------------------------------------------------------------------------
-- Start verify after first valid, sop or eop
......@@ -221,7 +238,7 @@ begin
verify_snk_in.valid, verify_snk_in.data, prev_verify_snk_in.data);
-- Verify that the output is incrementing BSN, like the input stimuli
proc_dp_verify_data("verify_snk_in.bsn", c_rl, c_unsigned_0, c_unsigned_0,
proc_dp_verify_data("verify_snk_in.bsn", c_rl, c_unsigned_0, c_unsigned_bsn_increment,
clk, verify_en_sop, verify_snk_out.ready,
verify_snk_in.sop, verify_snk_in.bsn, prev_verify_snk_in.bsn);
......@@ -287,7 +304,7 @@ begin
------------------------------------------------------------------------------
p_stimuli_unmerge : process(dp_packet_merge_src_out)
begin
dp_packet_merge_sosi <= dp_packet_merge_src_out;
dp_packet_merge_sosi <= dp_packet_merge_src_out;
-- Use counter as err field stimulus, per merged packet. Use
-- offset to distinguish err and empty values
dp_packet_merge_sosi.err <= TO_DP_ERROR(merged_pkt_cnt);
......@@ -312,8 +329,8 @@ begin
generic map (
g_use_ready => c_use_ready,
g_pipeline_ready => g_pipeline_ready,
g_nof_pkt_max => g_nof_pkt,
g_pkt_len => g_pkt_len,
g_nof_pkt => g_nof_pkt,
g_pkt_len => g_pkt_len_unmerge,
g_bsn_increment => g_bsn_increment
)
port map (
......
......@@ -43,28 +43,29 @@ begin
-- g_data_w : natural := 4;
-- g_nof_repeat : natural := 20;
-- g_nof_pkt : natural := 3;
-- g_pkt_len : natural := 29;
-- g_pkt_len_merge : natural := 29;
-- g_pkt_len_unmerge : natural := 29;
-- g_pkt_gap : natural := 0;
-- g_bsn_increment : natural := 0;
u_act_act_8_nof_0 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 0, 29, 0, 1);
u_act_act_8_nof_1 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 1, 29, 0, 1);
u_act_act_8_nof_2 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 2, 29, 0, 1);
u_act_act_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 3, 29, 0, 1);
u_act_act_8_nof_4 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 4, 29, 0, 1);
u_act_act_8_nof_4_bsn_0 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 4, 29, 0, 0);
--u_act_act_8_nof_4_bsn_2 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 4, 29, 0, 2);
u_act_act_8_nof_5 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 5, 29, 0, 1);
u_act_act_8_nof_6 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 6, 29, 0, 1);
u_act_act_8_nof_7 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 7, 29, 0, 1);
u_act_act_8_nof_0 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 0, 29, 29, 0, 1);
u_act_act_8_nof_1 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 1, 29, 29, 0, 1);
u_act_act_8_nof_2 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 2, 29, 29, 0, 1);
u_act_act_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_act_act_8_nof_4 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 4, 29, 29, 0, 1);
u_act_act_8_nof_4_bsn_0 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 4, 29, 29, 0, 0);
u_act_act_8_nof_4_bsn_2 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 4, 29, 29, 0, 2);
u_act_act_8_nof_5 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 5, 29, 29, 0, 1);
u_act_act_8_nof_6 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 6, 29, 29, 0, 1);
u_act_act_8_nof_7 : entity work.tb_dp_packet_merge_unmerge generic map ( e_active, e_active, true, 8, c_nof_repeat, 7, 29, 29, 0, 1);
u_rnd_act_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_active, true, 8, c_nof_repeat, 3, 29, 0, 1);
u_rnd_rnd_8_nof_3_comb : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_random, false, 8, c_nof_repeat, 3, 29, 0, 1);
u_rnd_rnd_8_nof_3_reg : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_random, true, 8, c_nof_repeat, 3, 29, 0, 1);
u_pls_act_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_pulse, e_active, true, 8, c_nof_repeat, 3, 29, 0, 1);
u_pls_rnd_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_pulse, e_random, true, 8, c_nof_repeat, 3, 29, 0, 1);
u_pls_pls_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_pulse, e_pulse, true, 8, c_nof_repeat, 3, 29, 0, 1);
u_rnd_act_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_active, true, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_rnd_rnd_8_nof_3_comb : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_random, false, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_rnd_rnd_8_nof_3_reg : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_random, true, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_pls_act_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_pulse, e_active, true, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_pls_rnd_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_pulse, e_random, true, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_pls_pls_8_nof_3 : entity work.tb_dp_packet_merge_unmerge generic map ( e_pulse, e_pulse, true, 8, c_nof_repeat, 3, 29, 29, 0, 1);
u_rnd_act_8_nof_1 : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_active, true, 8, c_nof_repeat, 1, 29, 0, 1);
u_rnd_act_8_nof_3_gap : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_active, true, 8, c_nof_repeat, 3, 29, 17, 1);
u_rnd_act_8_nof_1 : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_active, true, 8, c_nof_repeat, 1, 29, 29, 0, 1);
u_rnd_act_8_nof_3_gap : entity work.tb_dp_packet_merge_unmerge generic map ( e_random, e_active, true, 8, c_nof_repeat, 3, 29, 29, 17, 1);
end tb;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment