|
|
@@ -71,7 +71,8 @@ module motor_history_shared_tb #(parameter integer AXIS_COUNT=3);
|
|
|
independent=g[1].dut.u_axes.limit_history[0];
|
|
|
if(actual!==saved_history || actual!==independent)$fatal(1,"retained engine history differs from independent axis history or initial event");
|
|
|
end endtask
|
|
|
- integer i;
|
|
|
+ integer i,axis_index,drain_cycles;
|
|
|
+ reg [31:0] random_state=32'h713C9A25;
|
|
|
initial begin
|
|
|
repeat(5)@(negedge clk);rst_n=1;repeat(80)@(negedge clk);
|
|
|
control(4,32'h81234567);
|
|
|
@@ -92,6 +93,31 @@ module motor_history_shared_tb #(parameter integer AXIS_COUNT=3);
|
|
|
if(event_count[0]!=64 || overflow[0]<6 || overflow[0]!==overflow[1])$fatal(1,"ring overwrite scenario not reached");
|
|
|
if(expected_time[63:32]!=1 || g[0].dut.time_us[63:32]!=2)$fatal(1,"64-bit timestamp crossing not exercised");
|
|
|
if(complete_sweeps<2)$fatal(1,"full axis/word matrix not exercised");
|
|
|
+ // Repeated simultaneous edges at every scanner phase. The independent
|
|
|
+ // parallel record comparison above remains active throughout event backlog.
|
|
|
+ for(i=0;i<180;i=i+1)begin
|
|
|
+ @(negedge clk);
|
|
|
+ for(axis_index=0;axis_index<AXIS_COUNT;axis_index=axis_index+1)begin
|
|
|
+ random_state=random_state ^ (random_state<<13);
|
|
|
+ random_state=random_state ^ (random_state>>17);
|
|
|
+ random_state=random_state ^ (random_state<<5);
|
|
|
+ lower[axis_index]=random_state[0];upper[axis_index]=random_state[1];
|
|
|
+ end
|
|
|
+ repeat(2)@(negedge clk);
|
|
|
+ end
|
|
|
+ lower=0;upper=0;repeat(3*AXIS_COUNT+8)@(negedge clk);
|
|
|
+ if(!(&g[0].dut.limit_history_valid))$fatal(1,"all-axis history traffic was vacuous");
|
|
|
+ drain_cycles=0;
|
|
|
+ while((|g[0].dut.limit_pending) || (|g[0].dut.done_pending) || g[0].dut.ev_wr_req)begin
|
|
|
+ @(negedge clk);drain_cycles=drain_cycles+1;
|
|
|
+ if(drain_cycles>32*AXIS_COUNT+64)$fatal(1,"pending events did not drain after all-axis traffic stopped");
|
|
|
+ end
|
|
|
+ $display("HISTORY_BURST_SEED=713c9a25 AXES=%0d UPDATES=180 DRAIN_CLOCKS=%0d",AXIS_COUNT,drain_cycles);
|
|
|
+ // Old words physically remain in the unreset history storage. Reset must
|
|
|
+ // invalidate every record before it can reach either status or event output.
|
|
|
+ rst_n=0;repeat(3)@(negedge clk);rst_n=1;
|
|
|
+ repeat(40*AXIS_COUNT)@(negedge clk);
|
|
|
+ if(g[0].dut.limit_history_valid!=0)$fatal(1,"reset exposed stale history");
|
|
|
if(AXIS_COUNT==12)$display("motor_history_shared_12_tb PASS");
|
|
|
else $display("motor_history_shared_tb PASS");
|
|
|
$finish;
|