|
|
@@ -0,0 +1,102 @@
|
|
|
+`include "generated/6400/prod2u_6400_v1_params.vh"
|
|
|
+
|
|
|
+module thermal_6400_host_command_properties_formal(input wire clk);
|
|
|
+ reg rst_n = 0;
|
|
|
+ reg [1:0] reset_count = 0;
|
|
|
+ (* anyseq *) reg frame_valid;
|
|
|
+ (* anyconst *) reg [7:0] request_type;
|
|
|
+ (* anyconst *) reg [7:0] request_length;
|
|
|
+ (* anyconst *) reg [7:0] payload_value;
|
|
|
+ (* anyseq *) reg safety_locked;
|
|
|
+ (* anyseq *) reg manual_commit_done;
|
|
|
+ (* anyseq *) reg manual_commit_ok;
|
|
|
+ (* anyseq *) reg snapshot_ready;
|
|
|
+ (* anyseq *) reg tx_done;
|
|
|
+
|
|
|
+ wire frame_ready, frame_accept_enable;
|
|
|
+ wire [7:0] payload_read_addr;
|
|
|
+ wire manual_wr_en, manual_commit, pid_target_commit, snapshot_capture;
|
|
|
+ wire [4:0] manual_wr_addr;
|
|
|
+ wire [7:0] manual_wr_data, pid_target_celsius;
|
|
|
+ wire tx_start;
|
|
|
+ wire [7:0] tx_frame_type, tx_payload_length, ack_status;
|
|
|
+ wire transaction_done, busy;
|
|
|
+
|
|
|
+ thermal_host_command dut (
|
|
|
+ .clk(clk), .rst_n(rst_n), .frame_valid(frame_valid),
|
|
|
+ .frame_ready(frame_ready), .frame_accept_enable(frame_accept_enable),
|
|
|
+ .frame_type(request_type), .frame_length(request_length),
|
|
|
+ .payload_read_addr(payload_read_addr), .payload_read_data(payload_value),
|
|
|
+ .manual_wr_en(manual_wr_en), .manual_wr_addr(manual_wr_addr),
|
|
|
+ .manual_wr_data(manual_wr_data), .manual_commit(manual_commit),
|
|
|
+ .manual_commit_done(manual_commit_done), .manual_commit_ok(manual_commit_ok),
|
|
|
+ .safety_locked(safety_locked), .pid_target_commit(pid_target_commit),
|
|
|
+ .pid_target_celsius(pid_target_celsius), .snapshot_capture(snapshot_capture),
|
|
|
+ .snapshot_ready(snapshot_ready), .tx_start(tx_start),
|
|
|
+ .tx_frame_type(tx_frame_type), .tx_payload_length(tx_payload_length),
|
|
|
+ .tx_payload_addr(8'd2), .ack_payload_data(ack_status), .tx_done(tx_done),
|
|
|
+ .transaction_done(transaction_done), .busy(busy)
|
|
|
+ );
|
|
|
+
|
|
|
+ reg sent = 0;
|
|
|
+ reg saw_manual_commit = 0;
|
|
|
+ reg saw_ack = 0;
|
|
|
+ reg saw_get_ack = 0;
|
|
|
+ reg saw_data = 0;
|
|
|
+
|
|
|
+ wire known = request_type == `FB_CMD_SET_ALL ||
|
|
|
+ request_type == `FB_CMD_GET_SNAPSHOT ||
|
|
|
+ request_type == `FB_CMD_SET_STIMULUS ||
|
|
|
+ request_type == `FB_CMD_SET_PID_TARGET;
|
|
|
+ wire bad_length =
|
|
|
+ (request_type == `FB_CMD_SET_ALL && request_length != 32) ||
|
|
|
+ (request_type == `FB_CMD_GET_SNAPSHOT && request_length != 0) ||
|
|
|
+ (request_type == `FB_CMD_SET_STIMULUS && request_length != 33) ||
|
|
|
+ (request_type == `FB_CMD_SET_PID_TARGET && request_length != 1);
|
|
|
+
|
|
|
+ always @(posedge clk) begin
|
|
|
+ if (reset_count < 2) begin
|
|
|
+ rst_n <= 0;
|
|
|
+ reset_count <= reset_count + 1'b1;
|
|
|
+ end else rst_n <= 1;
|
|
|
+
|
|
|
+ if (!rst_n) begin
|
|
|
+ assume(!frame_valid);
|
|
|
+ assume(!manual_commit_done);
|
|
|
+ assume(!tx_done);
|
|
|
+ end else begin
|
|
|
+ assume(!known || bad_length || request_type == `FB_CMD_SET_STIMULUS ||
|
|
|
+ request_type == `FB_CMD_GET_SNAPSHOT);
|
|
|
+ if (sent) assume(!frame_valid);
|
|
|
+ if (frame_valid && frame_ready) sent <= 1;
|
|
|
+ if (!saw_manual_commit) assume(!manual_commit_done);
|
|
|
+ if (!manual_commit_done) assume(!manual_commit_ok);
|
|
|
+ if (manual_commit) saw_manual_commit <= 1;
|
|
|
+
|
|
|
+ if (tx_start) begin
|
|
|
+ assert(tx_frame_type == `FB_RSP_ACK_NACK ||
|
|
|
+ tx_frame_type == `FB_RSP_SNAPSHOT_DATA);
|
|
|
+ if (tx_frame_type == `FB_RSP_ACK_NACK) begin
|
|
|
+ assert(tx_payload_length == 4);
|
|
|
+ saw_ack <= 1;
|
|
|
+ if (!known) assert(ack_status == `FB_STATUS_UNSUPPORTED);
|
|
|
+ else if (bad_length) assert(ack_status == `FB_STATUS_BAD_LENGTH);
|
|
|
+ else if (request_type == `FB_CMD_SET_STIMULUS)
|
|
|
+ assert(ack_status == `FB_STATUS_UNSUPPORTED);
|
|
|
+ if (request_type == `FB_CMD_GET_SNAPSHOT && ack_status == `FB_STATUS_OK)
|
|
|
+ saw_get_ack <= 1;
|
|
|
+ end else begin
|
|
|
+ assert(saw_get_ack);
|
|
|
+ assert(tx_payload_length == `FB_SNAPSHOT_LENGTH);
|
|
|
+ saw_data <= 1;
|
|
|
+ end
|
|
|
+ end
|
|
|
+ assert(!manual_commit);
|
|
|
+ if (transaction_done) begin
|
|
|
+ assert(saw_ack);
|
|
|
+ if (request_type == `FB_CMD_GET_SNAPSHOT && request_length == 0)
|
|
|
+ assert(saw_data);
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+endmodule
|