diff --git a/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_channel.sv b/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_channel.sv index 4a65349e9..6d3579d7f 100644 --- a/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_channel.sv +++ b/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_channel.sv @@ -227,9 +227,10 @@ module rfnoc_block_duc_ms_channel axi_rate_change_ms #( - .WIDTH (SAMP_W*SPC ), - .SPC (SPC ), - .SPC_MTU_LOG2(SPC_MTU_LOG2) + .WIDTH (SAMP_W*SPC ), + .SPC (SPC ), + .SPC_MTU_LOG2 (SPC_MTU_LOG2), + .EN_TIME_ALL_PKTS(1'b0) ) axi_rate_change_ms_i ( .clk (ce_clk ), .rst (ce_rst ), diff --git a/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_tb.sv b/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_tb.sv index b45c7a682..e1a4770de 100644 --- a/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_tb.sv +++ b/fpga/usrp3/lib/rfnoc/blocks/rfnoc_block_duc/rfnoc_block_duc_ms/rfnoc_block_duc_ms_tb.sv @@ -619,7 +619,7 @@ module rfnoc_block_duc_ms_tb #( `ASSERT_ERROR(recv_payload.size() == PKT_SIZE_WORDS, s); // Check the timestamp - if (has_time) begin + if (has_time && pkt == 0) begin chdr_timestamp_t expected_time; // Calculate what the timestamp should be expected_time = start_time + pkt * SPP; @@ -802,7 +802,7 @@ module rfnoc_block_duc_ms_tb #( `ASSERT_ERROR(recv_payload.size() == pkt_length, s); // Check the timestamp - if (has_time) begin + if (has_time && pkt == 0) begin chdr_timestamp_t expected_time; // Calculate what the timestamp should be expected_time = start_time + pkt * local_spp; diff --git a/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_all_tb.sv b/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_all_tb.sv index a23b5871c..1946b87c5 100644 --- a/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_all_tb.sv +++ b/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_all_tb.sv @@ -46,8 +46,8 @@ module axi_rate_change_ms_all_tb; // First-packet-only timestamp mode axi_rate_change_ms_tb #( .WIDTH(32), - .MAX_N(1), - .MAX_M(1), + .MAX_N(16), + .MAX_M(16), .EN_TIME_ALL_PKTS(1'b0) ) tb_5 (); diff --git a/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_tb.sv b/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_tb.sv index 08a0af717..9d093aaa4 100644 --- a/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_tb.sv +++ b/fpga/usrp3/lib/sim/rfnoc/axi_rate_change/ms/axi_rate_change_ms_tb.sv @@ -37,7 +37,8 @@ module axi_rate_change_ms_tb #( localparam int WORD_BYTES = WIDTH / 8; localparam int DEFAULT_SPP = 16; localparam int STALL_PROB = 38; - localparam int BUBBLE_TEST_WORDS = 100000; + localparam int BUBBLE_TEST_WORDS = 10000; + localparam int NUM_RANDOM_TESTS = 50; localparam int VERBOSE = 0; localparam int SAMP_W = 32; localparam int SPC = WIDTH / SAMP_W; @@ -60,6 +61,8 @@ module axi_rate_change_ms_tb #( typedef AxiStreamPacket #(.DATA_WIDTH(WIDTH), .USER_WIDTH(USER_W)) axis_pkt_t; typedef axis_pkt_t axis_pkt_queue_t[$]; + `define MIN(X,Y) ((X)<(Y)?(X):(Y)) + //--------------------------------------------------------------------------- // Clocks and Resets //--------------------------------------------------------------------------- @@ -1034,41 +1037,65 @@ module axi_rate_change_ms_tb #( test_register_readback(); test.end_test(); - // Sweep all decimation rates N=1..MAX_N with M=1 and random stalls. + // Run a bounded set of random decimation rates with random stalls. // Each iteration sends 3*N*SPP words (enough for 3 full output packets). test.start_test("Check Various Rates", 50ms); - for (int n = 1; n <= MAX_N; n++) begin - test_rate(n, 1, n * DEFAULT_SPP * 3, DEFAULT_SPP, 1'b1, 1'b1); + begin + int num_tests; + int random_n; + num_tests = `MIN(NUM_RANDOM_TESTS, MAX_N); + repeat (num_tests) begin + random_n = $urandom_range(1, MAX_N); + test_rate(random_n, 1, random_n * DEFAULT_SPP * 3, DEFAULT_SPP, 1'b1, 1'b1); + end end - for (int m = 1; m <= MAX_M; m++) begin - test_rate(1, m, DEFAULT_SPP * 3, DEFAULT_SPP, 1'b1, 1'b1); + begin + int num_tests; + int random_m; + num_tests = `MIN(NUM_RANDOM_TESTS, MAX_M); + repeat (num_tests) begin + random_m = $urandom_range(1, MAX_M); + test_rate(1, random_m, DEFAULT_SPP * 3, DEFAULT_SPP, 1'b1, 1'b1); + end end test.end_test(); - // Test partial input groups (not a multiple of N). The extra - // (DEFAULT_SPP - 1) words form an incomplete group, and the output emits - // one additional terminal word carrying tlast. + // Test a bounded set of random partial input groups (not a multiple of N). + // The extra (DEFAULT_SPP - 1) words form an incomplete group, and the + // output emits one additional terminal word carrying tlast. test.start_test("Test Partial Packets", 50ms); - for (int n = 1; n <= MAX_N; n++) begin - test_rate( - .n(n), - .m(1), - .num_words(n * DEFAULT_SPP + DEFAULT_SPP - 1), - .spp(DEFAULT_SPP), - .rand_delay_in(1'b1), - .rand_delay_out(1'b1), - .expect_extra_last_word(1'b1) - ); + begin + int num_tests; + int random_n; + num_tests = `MIN(NUM_RANDOM_TESTS, MAX_N); + repeat (num_tests) begin + random_n = $urandom_range(1, MAX_N); + test_rate( + .n(random_n), + .m(1), + .num_words(random_n * DEFAULT_SPP + DEFAULT_SPP - 1), + .spp(DEFAULT_SPP), + .rand_delay_in(1'b1), + .rand_delay_out(1'b1), + .expect_extra_last_word(1'b1) + ); + end end test.end_test(); // Randomize SPP to verify the DUT correctly handles non-uniform packet // chunking on the input. test.start_test("Test Randomized SPP", 100ms); - for (int n = 1; n <= MAX_N; n++) begin - test_rate( - n, 1, n * DEFAULT_SPP * 10, DEFAULT_SPP, 1'b1, 1'b1, - 4, 1'b1); + begin + int num_tests; + int random_n; + num_tests = `MIN(NUM_RANDOM_TESTS, MAX_N); + repeat (num_tests) begin + random_n = $urandom_range(1, MAX_N); + test_rate( + random_n, 1, random_n * DEFAULT_SPP * 10, DEFAULT_SPP, 1'b1, 1'b1, + 4, 1'b1); + end end test.end_test();