runtime_limit_hard_stop_formal.v 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. .engine_step(engine_step),
  20. .engine_dir(engine_dir),
  21. .close_limit(close_limit),
  22. .open_limit(open_limit),
  23. .selected_limit(selected_limit),
  24. .gated_step(gated_step)
  25. );
  26. initial begin
  27. reset_cycles = 2'd0;
  28. prev_gated_step = 3'b000;
  29. past_valid = 1'b0;
  30. end
  31. always @(posedge clk) begin
  32. assume (rst_n == 1'b0 || rst_n == 1'b1);
  33. assume (startup_complete == 1'b0 || startup_complete == 1'b1);
  34. if (!rst_n) begin
  35. reset_cycles <= 2'd0;
  36. past_valid <= 1'b0;
  37. prev_gated_step <= 3'b000;
  38. end else if (reset_cycles < 2'd3) begin
  39. reset_cycles <= reset_cycles + 1'b1;
  40. end else begin
  41. past_valid <= 1'b1;
  42. // Selected limit high ⇒ gated STEP cannot stay high
  43. assert ((gated_step & selected_limit) == 3'b000);
  44. if (past_valid) begin
  45. // Rising edge cannot occur while selected limit is high
  46. assert (((gated_step & ~prev_gated_step) & selected_limit) == 3'b000);
  47. end
  48. cover (startup_complete && (|selected_limit) && (|engine_step) && (gated_step == 3'b000));
  49. cover (|gated_step);
  50. prev_gated_step <= gated_step;
  51. end
  52. end
  53. endmodule