|
|
@@ -12,7 +12,7 @@ module motor_axis_contract_tb;
|
|
|
reg ll=0,ul=0,load=0,start=0,abort_req=0,preempt=0,armed_in=0,upper=0;
|
|
|
reg [2:0] mode=0;
|
|
|
reg [31:0] count=0,half_us=2;
|
|
|
- reg position_load=0;
|
|
|
+ reg position_load=0,clear_counters=0;
|
|
|
reg [31:0] position_value=0;
|
|
|
reg [63:0] simulation_time=64'h00000005FFFFFFF0,expected_limit_time;
|
|
|
always @(posedge clk)if(tick_us)simulation_time<=simulation_time+1'b1;
|
|
|
@@ -33,7 +33,7 @@ module motor_axis_contract_tb;
|
|
|
.last_executed(last_exec),.position_reference_seen(ref_seen),.lower_hit_count(lh),
|
|
|
.upper_hit_count(uh),.lower_latched(llatch),.upper_latched(ulatch),.both_latched(both),
|
|
|
.last_stop_reason(last_reason),.clear_limit_latch(1'b0),.position_load(position_load),
|
|
|
- .position_value(position_value),.counters_clear(1'b0),.pos_zero_with_counters(1'b0),
|
|
|
+ .position_value(position_value),.counters_clear(clear_counters),.pos_zero_with_counters(1'b0),
|
|
|
.event_clock_us(simulation_time[31:0]),.event_clock_high(simulation_time[63:32]),.telemetry_record(telemetry));
|
|
|
integer rises=0,cycles=0,high_at=0;
|
|
|
reg prev_step=0,check_full=0,prev_tick;
|
|
|
@@ -54,7 +54,7 @@ module motor_axis_contract_tb;
|
|
|
end
|
|
|
task reset;
|
|
|
begin
|
|
|
- @(negedge clk);rst_n=0;load=0;start=0;abort_req=0;preempt=0;ll=0;ul=0;check_full=0;position_load=0;
|
|
|
+ @(negedge clk);rst_n=0;load=0;start=0;abort_req=0;preempt=0;ll=0;ul=0;check_full=0;position_load=0;clear_counters=0;
|
|
|
repeat(4) @(negedge clk);rst_n=1;repeat(3) @(negedge clk);
|
|
|
if(telemetry[36*8+:160]!==160'd0)$fatal(1,"reset exposed stale limit history storage");
|
|
|
end
|
|
|
@@ -131,6 +131,14 @@ module motor_axis_contract_tb;
|
|
|
if(total!==0 || pos!==32'h80000000 || (telemetry[56*8 +:32]&32'h11)!==32'h11)
|
|
|
$fatal(1,"counter and signed coordinate wrap telemetry");
|
|
|
$display("CASE counter_wrap_telemetry PASS");
|
|
|
+ reset();@(negedge clk);dut.hit_memory[0]=64'hFFFFFFFFFFFFFFFF;dut.hit_valid=1;
|
|
|
+ ll=1;ul=1;repeat(5)@(negedge clk);
|
|
|
+ if(lh!=0 || uh!=0 || telemetry[56*8+2+:2]!=2'b11)$fatal(1,"32-bit hit counter wrap flags");
|
|
|
+ clear_counters=1;@(negedge clk);clear_counters=0;repeat(4)@(negedge clk);
|
|
|
+ if(lh!=0 || uh!=0 || telemetry[56*8+:32]!=0 || telemetry[47*8+:8]!=7)
|
|
|
+ $fatal(1,"counter clear changed retained limit history or left wrap flags");
|
|
|
+ reset();
|
|
|
+ $display("CASE hit_counter_memory_wrap_clear_reset PASS");
|
|
|
$display("motor_axis_contract_tb PASS");$finish;
|
|
|
end
|
|
|
initial begin #1000000;$fatal(1,"bounded test deadline");end
|