| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- module thermal_6400_transport_properties_formal (
- input wire clk,
- input wire rst_n
- );
- (* anyseq *) reg byte_valid;
- (* anyseq *) reg [7:0] byte_data;
- (* anyseq *) reg snapshot_ready;
- (* anyseq *) reg tx_done;
- (* anyseq *) reg rs232_rx;
- (* anyseq *) reg ttl_rx;
- (* anyseq *) reg shared_tx;
- wire frame_valid;
- wire frame_ready;
- wire frame_accept_enable;
- wire [7:0] frame_type;
- wire [7:0] frame_length;
- wire [7:0] payload_read_addr;
- wire [7:0] payload_read_data;
- wire payload_wr_en;
- wire [7:0] payload_wr_addr;
- wire [7:0] payload_wr_data;
- wire rx_formal_crc_accepted;
- wire rx_formal_bad_crc_event;
- wire target_commit;
- wire [7:0] target_celsius;
- wire snapshot_capture;
- wire tx_start;
- wire [7:0] tx_frame_type;
- wire [7:0] tx_payload_length;
- wire transaction_done;
- wire command_busy;
- wire selected_rx;
- wire rs232_tx;
- wire ttl_tx;
- wire host_locked;
- wire host_port_sel;
- wire production_stimulus_accept = frame_valid && frame_ready &&
- frame_accept_enable && frame_type == 8'h03 && frame_length == 8'd33;
- frame_rx #(.MAX_PAYLOAD(33), .INTER_BYTE_TIMEOUT_CYCLES(8)) u_frame_rx (
- .clk(clk), .rst_n(rst_n), .byte_valid(byte_valid), .byte_data(byte_data),
- .accept_enable(frame_accept_enable), .frame_valid(frame_valid), .frame_ready(frame_ready),
- .frame_type(frame_type), .frame_length(frame_length),
- .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
- .payload_wr_en(payload_wr_en), .payload_wr_addr(payload_wr_addr),
- .payload_wr_data(payload_wr_data),
- .formal_crc_accepted_o(rx_formal_crc_accepted),
- .formal_bad_crc_event_o(rx_formal_bad_crc_event)
- );
- payload_ram #(.DEPTH(33), .ADDR_WIDTH(8)) u_payload (
- .clk(clk), .wr_en(payload_wr_en), .wr_addr(payload_wr_addr), .wr_data(payload_wr_data),
- .rd_addr(payload_read_addr), .rd_data(payload_read_data)
- );
- thermal_host_command #(.ENABLE_STIMULUS(0), .SNAPSHOT_LENGTH(193)) u_command (
- .clk(clk), .rst_n(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_commit(target_commit), .target_celsius(target_celsius),
- .stimulus_wr_en(), .stimulus_wr_addr(), .stimulus_wr_data(),
- .stimulus_commit(), .stimulus_duration_seconds(), .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_done(tx_done),
- .transaction_done(transaction_done), .busy(command_busy)
- );
- host_port_selector #(.IDLE_UNLOCK_CLKS(16)) u_selector (
- .clk(clk), .rst_n(rst_n), .rs232_rx_async(rs232_rx), .ttl_rx_async(ttl_rx),
- .shared_tx(shared_tx), .transaction_done(transaction_done), .selected_rx(selected_rx),
- .rs232_tx(rs232_tx), .ttl_tx(ttl_tx), .locked(host_locked), .port_sel(host_port_sel),
- .rs232_rx_sync(), .ttl_rx_sync()
- );
- reg [1:0] reset_cycles = 0;
- reg accepted_crc_good = 0;
- reg bad_crc_quarantine = 0;
- reg [7:0] bad_crc_target = 0;
- always @(posedge clk) begin
- if (reset_cycles < 2) begin
- assume(!rst_n);
- reset_cycles <= reset_cycles + 1'b1;
- end else assume(rst_n);
- if (!rst_n) begin
- accepted_crc_good <= 0;
- bad_crc_quarantine <= 0;
- bad_crc_target <= target_celsius;
- end else begin
- if (rx_formal_bad_crc_event) begin
- bad_crc_quarantine <= 1;
- bad_crc_target <= target_celsius;
- end
- if (frame_valid && frame_ready) begin
- assert(rx_formal_crc_accepted);
- accepted_crc_good <= rx_formal_crc_accepted;
- bad_crc_quarantine <= 0;
- end
- if (transaction_done)
- accepted_crc_good <= 0;
- // P06 end-to-end: from a rejected CRC through the parser and
- // command engine, Target is immutable until another CRC-valid
- // frame is explicitly accepted.
- if (bad_crc_quarantine && !(frame_valid && frame_ready)) begin
- assert(!target_commit);
- assert(target_celsius == bad_crc_target);
- end
- if (target_commit)
- assert(accepted_crc_good);
- // Production has no stimulus capability. A CRC-valid stimulus
- // frame is still an unsupported command and therefore retires
- // silently without an ACK or a hidden stimulus commit.
- if (formal_past_valid && $past(rst_n) &&
- $past(production_stimulus_accept)) begin
- assert(transaction_done);
- assert(!tx_start);
- assert(!stimulus_commit);
- end
- cover(bad_crc_quarantine && !target_commit &&
- target_celsius == bad_crc_target);
- cover(target_commit && accepted_crc_good && tx_start &&
- tx_frame_type == 8'h81);
- cover(formal_past_valid && $past(production_stimulus_accept) &&
- transaction_done && !tx_start && !stimulus_commit);
- end
- end
- endmodule
|