From b1ee83cd1ea325a5d353365ac35790a7c1d47845 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 10 Aug 2025 20:16:09 +0300 Subject: decrease max path length + Not fully functional, but good enough for now --- tb/sched_tb.sv | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'tb/sched_tb.sv') diff --git a/tb/sched_tb.sv b/tb/sched_tb.sv index 036464e..13c032e 100644 --- a/tb/sched_tb.sv +++ b/tb/sched_tb.sv @@ -2,6 +2,8 @@ module sched_tb; +logic clk, rst_n; + typedef struct packed { mov_t[1:0] in; mov_t[0:0] out; @@ -13,17 +15,20 @@ slot_t[1:0] prev_slots; slot_t[1:0] next_slots; insn_t[2:0] prev_que; insn_t[2:0] next_que; +bit[2-1:0] shift; sched #( .QUE_DEPTH(3), .SLOT_COUNT(2), - .SLOT_DEPTH(1), .slot_t(slot_t) ) sched ( + .clk_i(clk), + .rst_ni(rst_n), .que_i(prev_que), .que_o(next_que), .slots_i(prev_slots), - .slots_o(next_slots) + .slots_o(next_slots), + .shift_o(shift) ); slot_t[1:0] first_check = {76'b0, @@ -39,6 +44,13 @@ initial begin $dumpfile("sched_tb.vcd"); $dumpvars(); + clk = 0; + rst_n = 0; + + #1 + + rst_n = 1; + /* pretend we've queued something like * add r1, r2, r3 * add r4, r2, r1 @@ -59,20 +71,34 @@ initial begin prev_slots = '0; - #10 + #1 + clk = 1; + + #1 + clk = 0; assert (next_slots == first_check) else $error("\nwanted:\t%h", first_check, "\ngot:\t%h", next_slots); + assert (shift == 1) + else $error("expected shift == 1, got %d", shift); + /* pretend all operations finished */ prev_slots = '0; prev_que = next_que; - #10 + #1 + clk = 1; + + #1 + clk = 0; assert (next_slots == second_check) else $error("\nwanted:\t%h", second_check, "\ngot:\t%h", next_slots); + assert (shift == 2) + else $error("expected shift == 2, got %d", shift); + #10 $finish; end endmodule -- cgit v1.2.3