`timescale 1ns/1ps module resource_fsm_equivalence_formal; (* gclk *) reg clk; reg rst_n; reg past_valid; initial begin rst_n = 0; past_valid = 0; end always @(posedge clk) begin rst_n <= 1; past_valid <= 1; end (* anyseq *) reg advance; (* anyseq *) reg recover; wire [2:0] binary_state; wire [2:0] onehot_state; wire [6:0] onehot_raw_state; ab_fsm_binary u_fsm_binary(clk, rst_n, advance, recover, binary_state); ab_fsm_onehot u_fsm_onehot(clk, rst_n, advance, recover, onehot_state, onehot_raw_state); always @(posedge clk) begin if (rst_n && past_valid) begin assert(binary_state == onehot_state); // Strengthen induction: the externally decoded state must retain // the exact reachable one-hot representation. assert(onehot_raw_state == (7'b0000001 << binary_state)); end end endmodule module resource_pi_equivalence_formal; (* gclk *) reg clk; reg rst_n; reg past_valid; initial begin rst_n = 0; past_valid = 0; end always @(posedge clk) begin rst_n <= 1; past_valid <= 1; end (* anyseq *) reg pi_sample; (* anyseq *) reg signed [15:0] pi_error; wire signed [31:0] positional_control; wire signed [31:0] incremental_control; wire signed [31:0] positional_integral_state; wire signed [15:0] incremental_previous_error_state; ab_pi_positional u_pi_positional( clk, rst_n, pi_sample, pi_error, positional_control, positional_integral_state); ab_pi_incremental u_pi_incremental( clk, rst_n, pi_sample, pi_error, incremental_control, incremental_previous_error_state); wire signed [31:0] previous_error_ext = {{16{incremental_previous_error_state[15]}}, incremental_previous_error_state}; wire signed [31:0] previous_p_term = previous_error_ext + (previous_error_ext <<< 1); always @(posedge clk) begin if (rst_n && past_valid) begin assert(positional_control == incremental_control); // Positional PI keeps I explicitly; incremental PI folds P into // control. This relation is the inductive state correspondence. assert(positional_control == positional_integral_state + previous_p_term); end end endmodule module resource_crc_equivalence_formal; (* gclk *) reg clk; reg rst_n; reg past_valid; initial begin rst_n = 0; past_valid = 0; end always @(posedge clk) begin rst_n <= 1; past_valid <= 1; end (* anyseq *) reg crc_clear; (* anyseq *) reg crc_rx_valid; (* anyseq *) reg [7:0] crc_rx_data; (* anyseq *) reg crc_tx_valid; (* anyseq *) reg [7:0] crc_tx_data; wire [15:0] independent_rx_crc, independent_tx_crc; wire [15:0] shared_rx_crc, shared_tx_crc; ab_crc_independent u_crc_independent( clk, rst_n, crc_clear, crc_rx_valid, crc_rx_data, crc_tx_valid, crc_tx_data, independent_rx_crc, independent_tx_crc); ab_crc_shared u_crc_shared( clk, rst_n, crc_clear, crc_rx_valid, crc_rx_data, crc_tx_valid, crc_tx_data, shared_rx_crc, shared_tx_crc); always @(posedge clk) begin if (rst_n && past_valid) begin // Host request parsing and response transmission never overlap. assume(!(crc_rx_valid && crc_tx_valid)); assert(independent_rx_crc == shared_rx_crc); assert(independent_tx_crc == shared_tx_crc); end end endmodule