|
|
@@ -291,6 +291,19 @@ module motor_engine_tb;
|
|
|
event_before=ev_count;
|
|
|
ctl(1,16'b111,0,0);repeat(100) @(posedge clk);
|
|
|
check(ev_count==event_before+3,"all simultaneous abort events retained");
|
|
|
+ // Physical edge while idle, then repeated HOME at an already-held
|
|
|
+ // lower switch: one real edge event; HOME completion is separate.
|
|
|
+ event_before=ev_count;limit_lower_raw[2]=1;repeat(60)@(posedge clk);
|
|
|
+ check(ev_count==event_before+1 && dut.ax_lhits[2]==1,"idle physical limit recorded once");
|
|
|
+ event_before=ev_count;ctl(6,16'b100,0,0);repeat(60)@(posedge clk);
|
|
|
+ check(ev_count==event_before+1 && dut.ax_lhits[2]==1,"held HOME adds completion not physical hit");
|
|
|
+ event_before=ev_count;ctl(6,16'b100,0,0);repeat(60)@(posedge clk);
|
|
|
+ check(ev_count==event_before+1 && dut.ax_lhits[2]==1,"repeated held HOME does not forge edge");
|
|
|
+ ctl(5,16'b100,0,0);repeat(20)@(posedge clk);
|
|
|
+ check(!dut.ax_llat[2] && !dut.ax_active[2],"clear latch does not restart held limit");
|
|
|
+ // Zero HOLD completes once through the normal queue, without STEP.
|
|
|
+ send_seg(0,4,0,0,0,16'hA5,0);submit(1);repeat(60)@(posedge clk);
|
|
|
+ check(!dut.ax_active[0] && dut.ax_last_reason[0]==9,"zero HOLD completes");
|
|
|
$display("motor_engine_tb PASS");
|
|
|
$finish;
|
|
|
end
|