diff --git a/libraries/io/eth/tb/vhdl/tb_eth_tester.vhd b/libraries/io/eth/tb/vhdl/tb_eth_tester.vhd index 0468da2e97b1c7044b6b589d621036255d4ce9c3..1ad750a5058bbd5e75e62cfbb4cde79ee958dc41 100644 --- a/libraries/io/eth/tb/vhdl/tb_eth_tester.vhd +++ b/libraries/io/eth/tb/vhdl/tb_eth_tester.vhd @@ -92,9 +92,11 @@ ARCHITECTURE tb OF tb_eth_tester IS CONSTANT c_bg_block_len_first : NATURAL := g_bg_ctrl_first.samples_per_packet; CONSTANT c_bg_block_len_others : NATURAL := g_bg_ctrl_others.samples_per_packet; + CONSTANT c_bg_block_len_max : NATURAL := largest(c_bg_block_len_first, c_bg_block_len_others); CONSTANT c_bg_slot_len_first : NATURAL := c_bg_block_len_first + g_bg_ctrl_first.gapsize; CONSTANT c_bg_slot_len_others : NATURAL := c_bg_block_len_others + g_bg_ctrl_others.gapsize; + CONSTANT c_bg_slot_len_max : NATURAL := largest(c_bg_slot_len_first, c_bg_slot_len_others); CONSTANT c_eth_packet_len_first : NATURAL := func_eth_tester_eth_packet_length(c_bg_block_len_first); CONSTANT c_eth_packet_len_others : NATURAL := func_eth_tester_eth_packet_length(c_bg_block_len_others); @@ -114,6 +116,7 @@ ARCHITECTURE tb OF tb_eth_tester IS -- Expected Tx --> Rx latency values obtained from a tb run CONSTANT c_tx_exp_latency : NATURAL := 0; + CONSTANT c_rx_exp_latency_en : BOOLEAN := c_bg_block_len_max >= 50; CONSTANT c_rx_exp_latency_st : NATURAL := 27; CONSTANT c_rx_exp_latency_sim_tse : NATURAL := 165; CONSTANT c_rx_exp_latency_tech_tse : NATURAL := 375; @@ -482,24 +485,31 @@ BEGIN ASSERT rx_mon_nof_valid_arr(I) = c_mon_nof_valid_others_rx REPORT c_tb_str & "Wrong rx nof_valid for stream (" & NATURAL'IMAGE(I) & ")" SEVERITY ERROR; END IF; ASSERT tx_mon_latency_arr(I) = c_tx_exp_latency REPORT c_tb_str & "Wrong tx latency for stream (" & NATURAL'IMAGE(I) & ")" SEVERITY ERROR; - -- The rx_exp_latency is fixed when: - -- . g_loopback_eth = FALSE: the streams operate in parallel. - -- . g_loopback_eth = TRUE and g_nof_streams = 1, because for - -- g_nof_streams > 1 the streams are mulitplexed, so then the Rx - -- latency will vary. - IF g_loopback_eth = TRUE THEN - IF g_nof_streams = 1 THEN - IF g_eth_sim_level = 0 THEN - ASSERT almost_equal(rx_mon_latency_arr(I), c_rx_exp_latency_tech_tse, 1) REPORT - c_tb_str & "Wrong rx latency using tech_tse interface" SEVERITY ERROR; - ELSIF g_eth_sim_level = 1 THEN - ASSERT almost_equal(rx_mon_latency_arr(I), c_rx_exp_latency_sim_tse, 1) REPORT - c_tb_str & "Wrong rx latency using sim_tse interface" SEVERITY ERROR; + + -- For short block lengths the Rx latency appears to become less, the + -- exact Rx latency is therefore hard to predetermine. The actual + -- latency is not critical, therefore it is sufficient to only very + -- the latency when it is more or less fixed. + IF c_rx_exp_latency_en THEN + -- The rx_exp_latency is fixed when: + -- . g_loopback_eth = FALSE: the streams operate in parallel. + -- . g_loopback_eth = TRUE and g_nof_streams = 1, because for + -- g_nof_streams > 1 the streams are multiplexed, so then the Rx + -- latency will vary. + IF g_loopback_eth = TRUE THEN + IF g_nof_streams = 1 THEN + IF g_eth_sim_level = 0 THEN + ASSERT almost_equal(rx_mon_latency_arr(I), c_rx_exp_latency_tech_tse, 1) REPORT + c_tb_str & "Wrong rx latency using tech_tse interface" SEVERITY ERROR; + ELSIF g_eth_sim_level = 1 THEN + ASSERT almost_equal(rx_mon_latency_arr(I), c_rx_exp_latency_sim_tse, 1) REPORT + c_tb_str & "Wrong rx latency using sim_tse interface" SEVERITY ERROR; + END IF; END IF; + ELSE + ASSERT rx_mon_latency_arr(I) = c_rx_exp_latency_st REPORT + c_tb_str & "Wrong rx latency using st interface (" & NATURAL'IMAGE(I) & ")" SEVERITY ERROR; END IF; - ELSE - ASSERT rx_mon_latency_arr(I) = c_rx_exp_latency_st REPORT - c_tb_str & "Wrong rx latency using st interface (" & NATURAL'IMAGE(I) & ")" SEVERITY ERROR; END IF; END IF; END LOOP;