|
|
@@ -1,9 +1,195 @@
|
|
|
-// BLOCKED Round-12 stub: requires door_axis_controller source-limit snap RTL.
|
|
|
-// Do not treat as acceptance evidence until RTL agent lands and this shell binds DUT.
|
|
|
+// DUT-connected: consumed source-limit must not overwrite gated_step_rise ±1.
|
|
|
+// Instantiates door_axis_controller. Bounded BMC — not an unbounded proof.
|
|
|
`timescale 1ns/1ps
|
|
|
|
|
|
-module door_axis_source_limit_lingering_formal;
|
|
|
+module door_axis_source_limit_lingering_formal (
|
|
|
+ input wire clk,
|
|
|
+ input wire rst_n,
|
|
|
+ input wire tick_500us,
|
|
|
+ input wire request_valid,
|
|
|
+ input wire [7:0] requested_percent_in,
|
|
|
+ input wire open_limit,
|
|
|
+ input wire close_limit,
|
|
|
+ input wire force_rise
|
|
|
+);
|
|
|
+ localparam integer MAX_CAL = 8;
|
|
|
+ localparam [2:0] ST_MOVE_OPEN = 3'd3;
|
|
|
+ localparam [2:0] ST_MOVE_CLOSE = 3'd4;
|
|
|
+
|
|
|
+ wire dut_rst_n = rst_n;
|
|
|
+ wire planner_req;
|
|
|
+ wire [7:0] planner_percent;
|
|
|
+ wire [12:0] planner_travel;
|
|
|
+ reg planner_done;
|
|
|
+ reg [1:0] planner_done_axis;
|
|
|
+ reg [7:0] planner_done_percent;
|
|
|
+ reg [12:0] planner_result;
|
|
|
+
|
|
|
+ wire step;
|
|
|
+ wire dir_close;
|
|
|
+ wire [2:0] status_state;
|
|
|
+ wire [7:0] status_flags;
|
|
|
+ wire [7:0] status_requested_percent;
|
|
|
+ wire [12:0] status_current;
|
|
|
+ wire [12:0] status_target;
|
|
|
+ wire [12:0] status_travel;
|
|
|
+ wire [7:0] status_fault_code;
|
|
|
+ wire calibrated;
|
|
|
+ wire faulted;
|
|
|
+ wire terminal;
|
|
|
+
|
|
|
+ wire selected_limit = dir_close ? close_limit : open_limit;
|
|
|
+ wire gated_step = step & ~selected_limit;
|
|
|
+ reg prev_gated;
|
|
|
+ wire gated_step_rise = force_rise & gated_step & ~prev_gated;
|
|
|
+
|
|
|
+ reg [1:0] reset_cycles;
|
|
|
+ reg past_valid;
|
|
|
+ reg [2:0] linger_rises;
|
|
|
+ // Next-cycle checkers avoid same-edge combo/NBA sampling races on status_current.
|
|
|
+ reg pending_dec;
|
|
|
+ reg pending_inc;
|
|
|
+ reg [12:0] pos_before;
|
|
|
+
|
|
|
+ door_axis_controller #(
|
|
|
+ .AXIS_ID(0),
|
|
|
+ .MAX_CAL_STEPS(MAX_CAL),
|
|
|
+ .MIN_TRAVEL(2),
|
|
|
+ .ENDPOINT_GUARD_EXTRA(4),
|
|
|
+ .DIR_SETUP_TICKS(1),
|
|
|
+ .PERCENT_MAX(100)
|
|
|
+ ) dut (
|
|
|
+ .clk(clk), .rst_n(dut_rst_n),
|
|
|
+ .open_limit(open_limit), .close_limit(close_limit),
|
|
|
+ .limit_sync_valid(1'b1),
|
|
|
+ .gated_step(gated_step), .gated_step_rise(gated_step_rise),
|
|
|
+ .tick_500us(tick_500us),
|
|
|
+ .request_valid(request_valid),
|
|
|
+ .requested_percent_in(requested_percent_in),
|
|
|
+ .watchdog_stop(1'b0),
|
|
|
+ .planner_req(planner_req),
|
|
|
+ .planner_percent(planner_percent),
|
|
|
+ .planner_travel(planner_travel),
|
|
|
+ .planner_done(planner_done),
|
|
|
+ .planner_done_axis(planner_done_axis),
|
|
|
+ .planner_done_percent(planner_done_percent),
|
|
|
+ .planner_result(planner_result),
|
|
|
+ .step(step), .dir_close(dir_close),
|
|
|
+ .status_state(status_state), .status_flags(status_flags),
|
|
|
+ .status_requested_percent(status_requested_percent),
|
|
|
+ .status_current(status_current), .status_target(status_target),
|
|
|
+ .status_travel(status_travel), .status_fault_code(status_fault_code),
|
|
|
+ .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
|
|
|
+ );
|
|
|
+
|
|
|
initial begin
|
|
|
- $fatal(1, "door_axis_source_limit_lingering_formal blocked until RTL");
|
|
|
+ reset_cycles = 2'd0;
|
|
|
+ prev_gated = 1'b0;
|
|
|
+ past_valid = 1'b0;
|
|
|
+ linger_rises = 3'd0;
|
|
|
+ pending_dec = 1'b0;
|
|
|
+ pending_inc = 1'b0;
|
|
|
+ pos_before = 13'd0;
|
|
|
+ planner_done = 1'b0;
|
|
|
+ planner_done_axis = 2'd0;
|
|
|
+ planner_done_percent = 8'd0;
|
|
|
+ planner_result = 13'd0;
|
|
|
+ end
|
|
|
+
|
|
|
+ always @(posedge clk) begin
|
|
|
+ assume (rst_n == 1'b0 || rst_n == 1'b1);
|
|
|
+ assume (tick_500us == 1'b0 || tick_500us == 1'b1);
|
|
|
+ assume (request_valid == 1'b0 || request_valid == 1'b1);
|
|
|
+ assume (open_limit == 1'b0 || open_limit == 1'b1);
|
|
|
+ assume (close_limit == 1'b0 || close_limit == 1'b1);
|
|
|
+ assume (force_rise == 1'b0 || force_rise == 1'b1);
|
|
|
+ assume (requested_percent_in <= 8'd100);
|
|
|
+ assume (!(tick_500us && $past(tick_500us)));
|
|
|
+ assume (!(open_limit && close_limit));
|
|
|
+
|
|
|
+ if ($initstate || reset_cycles < 2) begin
|
|
|
+ assume (!dut_rst_n);
|
|
|
+ reset_cycles <= reset_cycles + 1'b1;
|
|
|
+ end else begin
|
|
|
+ assume (dut_rst_n);
|
|
|
+ end
|
|
|
+
|
|
|
+ planner_done <= 1'b0;
|
|
|
+ if (planner_req) begin
|
|
|
+ planner_done <= 1'b1;
|
|
|
+ planner_done_axis <= 2'd0;
|
|
|
+ planner_done_percent <= planner_percent;
|
|
|
+ planner_result <= (planner_travel > 13'd2) ? (planner_travel >> 1) : 13'd1;
|
|
|
+ end
|
|
|
+
|
|
|
+ if (!dut_rst_n) begin
|
|
|
+ prev_gated <= 1'b0;
|
|
|
+ past_valid <= 1'b0;
|
|
|
+ linger_rises <= 3'd0;
|
|
|
+ pending_dec <= 1'b0;
|
|
|
+ pending_inc <= 1'b0;
|
|
|
+ pos_before <= 13'd0;
|
|
|
+ end else begin
|
|
|
+ prev_gated <= gated_step;
|
|
|
+ past_valid <= 1'b1;
|
|
|
+ pending_dec <= 1'b0;
|
|
|
+ pending_inc <= 1'b0;
|
|
|
+
|
|
|
+ // Arm next-cycle check when a consumed source-limit linger rise occurs.
|
|
|
+ if (past_valid && gated_step_rise && calibrated && !faulted &&
|
|
|
+ (status_state == ST_MOVE_OPEN) &&
|
|
|
+ ($past(status_state) == ST_MOVE_OPEN) &&
|
|
|
+ close_limit && $past(close_limit) &&
|
|
|
+ !open_limit && !$past(open_limit) &&
|
|
|
+ !dir_close && !$past(dir_close) &&
|
|
|
+ ($past(status_current) > 13'd0) &&
|
|
|
+ (status_travel >= 13'd2) &&
|
|
|
+ !request_valid && !$past(request_valid)) begin
|
|
|
+ pending_dec <= 1'b1;
|
|
|
+ pos_before <= $past(status_current);
|
|
|
+ end
|
|
|
+
|
|
|
+ if (past_valid && gated_step_rise && calibrated && !faulted &&
|
|
|
+ (status_state == ST_MOVE_CLOSE) &&
|
|
|
+ ($past(status_state) == ST_MOVE_CLOSE) &&
|
|
|
+ open_limit && $past(open_limit) &&
|
|
|
+ !close_limit && !$past(close_limit) &&
|
|
|
+ dir_close && $past(dir_close) &&
|
|
|
+ ($past(status_current) < status_travel) &&
|
|
|
+ (status_travel >= 13'd2) &&
|
|
|
+ !request_valid && !$past(request_valid)) begin
|
|
|
+ pending_inc <= 1'b1;
|
|
|
+ pos_before <= $past(status_current);
|
|
|
+ end
|
|
|
+
|
|
|
+ // After the rise edge settles, coordinate must have moved by exactly 1.
|
|
|
+ // Keep the linger context on the check cycle (source still high, no target).
|
|
|
+ if ($past(pending_dec) && !faulted &&
|
|
|
+ (status_state == ST_MOVE_OPEN) && close_limit && !open_limit)
|
|
|
+ assert (status_current == ($past(pos_before) - 13'd1));
|
|
|
+ if ($past(pending_inc) && !faulted &&
|
|
|
+ (status_state == ST_MOVE_CLOSE) && open_limit && !close_limit)
|
|
|
+ assert (status_current == ($past(pos_before) + 13'd1));
|
|
|
+
|
|
|
+ if ($past(pending_dec) && (status_state == ST_MOVE_OPEN) &&
|
|
|
+ close_limit && !open_limit &&
|
|
|
+ (status_current == ($past(pos_before) - 13'd1)) &&
|
|
|
+ (linger_rises < 3'd7))
|
|
|
+ linger_rises <= linger_rises + 1'b1;
|
|
|
+ if ($past(pending_inc) && (status_state == ST_MOVE_CLOSE) &&
|
|
|
+ open_limit && !close_limit &&
|
|
|
+ (status_current == ($past(pos_before) + 13'd1)) &&
|
|
|
+ (linger_rises < 3'd7))
|
|
|
+ linger_rises <= linger_rises + 1'b1;
|
|
|
+
|
|
|
+ cover ($past(pending_dec) && (status_state == ST_MOVE_OPEN) &&
|
|
|
+ close_limit && !open_limit &&
|
|
|
+ (status_current == ($past(pos_before) - 13'd1)));
|
|
|
+ cover ($past(pending_inc) && (status_state == ST_MOVE_CLOSE) &&
|
|
|
+ open_limit && !close_limit &&
|
|
|
+ (status_current == ($past(pos_before) + 13'd1)));
|
|
|
+ cover (calibrated && (linger_rises >= 3'd2) && !close_limit && !open_limit &&
|
|
|
+ (status_current != 13'd0) && (status_current != status_travel));
|
|
|
+ end
|
|
|
end
|
|
|
endmodule
|