runtime_limit_hard_stop_formal.v 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Runtime limit hard-stop BMC on the PRODUCTION gate module used by top.
  2. // stop_semantics: truncate_current_high_pulse_immediately_after_synchronized_limit
  3. // Bounded BMC — not an unbounded proof. Supplemental combo shells do not replace this.
  4. module runtime_limit_hard_stop_formal (
  5. input wire clk,
  6. input wire rst_n,
  7. input wire startup_complete,
  8. input wire [2:0] engine_step,
  9. input wire [2:0] engine_dir,
  10. input wire [2:0] close_limit,
  11. input wire [2:0] open_limit
  12. );
  13. wire [2:0] selected_limit;
  14. wire [2:0] gated_step;
  15. reg [2:0] prev_gated_step;
  16. reg [1:0] reset_cycles;
  17. reg past_valid;
  18. prod2u_runtime_step_limit_gate #(.AXIS_COUNT(3)) dut (
  19. .clk(clk),
  20. .rst_n(rst_n),
  21. .engine_step(engine_step),
  22. .engine_dir(engine_dir),
  23. .close_limit(close_limit),
  24. .open_limit(open_limit),
  25. .selected_limit(selected_limit),
  26. .gated_step(gated_step)
  27. );
  28. initial begin
  29. reset_cycles = 2'd0;
  30. prev_gated_step = 3'b000;
  31. past_valid = 1'b0;
  32. end
  33. always @(posedge clk) begin
  34. assume (rst_n == 1'b0 || rst_n == 1'b1);
  35. assume (startup_complete == 1'b0 || startup_complete == 1'b1);
  36. if (!rst_n) begin
  37. reset_cycles <= 2'd0;
  38. past_valid <= 1'b0;
  39. prev_gated_step <= 3'b000;
  40. end else if (reset_cycles < 2'd3) begin
  41. reset_cycles <= reset_cycles + 1'b1;
  42. end else begin
  43. past_valid <= 1'b1;
  44. // Selected limit high ⇒ gated STEP cannot stay high
  45. assert ((gated_step & selected_limit) == 3'b000);
  46. if (past_valid) begin
  47. // Rising edge cannot occur while selected limit is high
  48. assert (((gated_step & ~prev_gated_step) & selected_limit) == 3'b000);
  49. end
  50. cover (startup_complete && (|selected_limit) && (|engine_step) && (gated_step == 3'b000));
  51. cover (|gated_step);
  52. prev_gated_step <= gated_step;
  53. end
  54. end
  55. endmodule