| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // Runtime limit hard-stop BMC on the PRODUCTION gate module used by top.
- // stop_semantics: truncate_current_high_pulse_immediately_after_synchronized_limit
- // Bounded BMC — not an unbounded proof. Supplemental combo shells do not replace this.
- module runtime_limit_hard_stop_formal (
- input wire clk,
- input wire rst_n,
- input wire startup_complete,
- input wire [2:0] engine_step,
- input wire [2:0] engine_dir,
- input wire [2:0] close_limit,
- input wire [2:0] open_limit
- );
- wire [2:0] selected_limit;
- wire [2:0] gated_step;
- reg [2:0] prev_gated_step;
- reg [1:0] reset_cycles;
- reg past_valid;
- prod2u_runtime_step_limit_gate #(.AXIS_COUNT(3)) dut (
- .clk(clk),
- .rst_n(rst_n),
- .engine_step(engine_step),
- .engine_dir(engine_dir),
- .close_limit(close_limit),
- .open_limit(open_limit),
- .selected_limit(selected_limit),
- .gated_step(gated_step)
- );
- initial begin
- reset_cycles = 2'd0;
- prev_gated_step = 3'b000;
- past_valid = 1'b0;
- end
- always @(posedge clk) begin
- assume (rst_n == 1'b0 || rst_n == 1'b1);
- assume (startup_complete == 1'b0 || startup_complete == 1'b1);
- if (!rst_n) begin
- reset_cycles <= 2'd0;
- past_valid <= 1'b0;
- prev_gated_step <= 3'b000;
- end else if (reset_cycles < 2'd3) begin
- reset_cycles <= reset_cycles + 1'b1;
- end else begin
- past_valid <= 1'b1;
- // Selected limit high ⇒ gated STEP cannot stay high
- assert ((gated_step & selected_limit) == 3'b000);
- if (past_valid) begin
- // Rising edge cannot occur while selected limit is high
- assert (((gated_step & ~prev_gated_step) & selected_limit) == 3'b000);
- end
- cover (startup_complete && (|selected_limit) && (|engine_step) && (gated_step == 3'b000));
- cover (|gated_step);
- prev_gated_step <= gated_step;
- end
- end
- endmodule
|