// tag_alloc_fv.sv — formal wrapper with a symbolic tag module tag_alloc_fv #( parameter int N = 4, parameter bit BUG = 1'b0 ) ( input logic clk, input logic rst, input logic alloc_req, input logic free_vld, input logic [$clog2(N)-1:0] free_tag, input logic [$clog2(N)-1:0] sym_tag // symbolic: chosen once by the tool ); localparam int TW = $clog2(N); logic alloc_gnt; logic [TW-1:0] alloc_tag; logic [N-1:0] free_mask; tag_alloc #(.N(N), .BUG(BUG)) dut (.*); initial assume (rst); default clocking cb @(posedge clk); endclocking default disable iff (rst); // ---------------------------------------------------- auxiliary model am_sym_stable: assume property ($stable(sym_tag)); logic sym_busy; // is the symbolic tag handed out? always_ff @(posedge clk) if (rst) sym_busy <= 1'b0; else if (alloc_gnt && alloc_tag == sym_tag) sym_busy <= 1'b1; else if (free_vld && free_tag == sym_tag) sym_busy <= 1'b0; // ---------------------------------------------------- environment am_free_busy_only: assume property (free_vld && free_tag == sym_tag |-> sym_busy); // ---------------------------------------------------- checks a_no_double_alloc: assert property (alloc_gnt && alloc_tag == sym_tag |-> !sym_busy); a_mask_matches: assert property (free_mask[sym_tag] == !sym_busy); a_gnt_when_free: assert property (alloc_req && free_mask != '0 |-> alloc_gnt); a_gnt_free_tag: assert property (alloc_gnt |-> free_mask[alloc_tag]); // ---------------------------------------------------- covers c_all_busy: cover property (free_mask == '0); c_sym_reused: cover property (sym_busy ##1 !sym_busy ##[1:$] sym_busy); c_alloc_free: cover property (alloc_gnt && free_vld); endmodule