// DUT-connected: startup_complete vs ST_COMMIT motor-request boundary. // Bounded BMC. Not an unbounded proof. module command_startup_commit_formal ( input wire clk, input wire rst_n, input wire frame_valid, input wire [7:0] frame_type, input wire [7:0] frame_length, input wire [7:0] payload_read_data, input wire startup_complete, input wire temperature_done, input wire tx_done ); wire dut_rst_n = rst_n; wire frame_ready; wire frame_accept_enable; wire [7:0] payload_read_addr; wire target_wr_en; wire [3:0] target_wr_addr; wire [7:0] target_wr_data; wire valid_set_all_commit; wire [7:0] door_percent_z; wire [7:0] door_percent_x; wire [7:0] door_percent_y; wire motor_request_valid; wire temperature_start; wire status_capture; wire tx_start; wire [7:0] tx_frame_type; wire [7:0] tx_payload_length; wire tx_payload_is_status; wire busy; reg [1:0] reset_cycles; reg prev_startup; command_controller dut ( .clk(clk), .rst_n(dut_rst_n), .frame_valid(frame_valid), .frame_ready(frame_ready), .frame_accept_enable(frame_accept_enable), .frame_type(frame_type), .frame_length(frame_length), .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data), .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr), .target_wr_data(target_wr_data), .valid_set_all_commit(valid_set_all_commit), .door_percent_z(door_percent_z), .door_percent_x(door_percent_x), .door_percent_y(door_percent_y), .motor_request_valid(motor_request_valid), .startup_complete(startup_complete), .temperature_start(temperature_start), .temperature_done(temperature_done), .status_capture(status_capture), .tx_start(tx_start), .tx_frame_type(tx_frame_type), .tx_payload_length(tx_payload_length), .tx_payload_is_status(tx_payload_is_status), .tx_done(tx_done), .busy(busy) ); initial begin reset_cycles = 2'd0; prev_startup = 1'b0; end always @(posedge clk) begin assume (rst_n == 1'b0 || rst_n == 1'b1); assume (frame_valid == 1'b0 || frame_valid == 1'b1); assume (startup_complete == 1'b0 || startup_complete == 1'b1); assume (temperature_done == 1'b0 || temperature_done == 1'b1); assume (tx_done == 1'b0 || tx_done == 1'b1); // Restrict to SET_ALL 11-byte frames with in-range payload bytes. assume (frame_type == 8'h01); assume (frame_length == 8'd11); assume (payload_read_data <= 8'd100); if ($initstate || reset_cycles < 2) begin assume (!dut_rst_n); reset_cycles <= reset_cycles + 1'b1; end else begin assume (dut_rst_n); end if (!dut_rst_n) begin prev_startup <= 1'b0; end else begin // Env: startup_complete is sticky until power-on/reset (contract). assume (!(prev_startup && !startup_complete)); // Host only presents a frame when controller is ready. assume (!(frame_valid && !frame_ready)); if (valid_set_all_commit) begin // Pre-edge sample: same-edge rise of startup → no motor request. if (!prev_startup && startup_complete) assert (motor_request_valid == 1'b0); // Already complete before this edge → motor request with commit. if (prev_startup && startup_complete) assert (motor_request_valid == 1'b1); // Still incomplete → thermal ok, no motor. if (!startup_complete) assert (motor_request_valid == 1'b0); end // motor_request_valid only with commit. if (motor_request_valid) assert (valid_set_all_commit); cover (valid_set_all_commit && prev_startup && motor_request_valid); cover (valid_set_all_commit && !prev_startup && startup_complete && !motor_request_valid); cover (valid_set_all_commit && !startup_complete && !motor_request_valid); prev_startup <= startup_complete; end end endmodule