// watchdog_fv.sv — spec model + inductive helper module watchdog_fv #( parameter int TIMEOUT = 50000, parameter bit BUG = 1'b0 ) ( input logic clk, input logic rst, input logic kick ); localparam int CW = $clog2(TIMEOUT + 1); logic bite; logic [CW-1:0] remaining; watchdog #(.TIMEOUT(TIMEOUT), .BUG(BUG)) dut (.*); initial assume (rst); default clocking cb @(posedge clk); endclocking default disable iff (rst); // spec model: ticks since the last kick or reset, saturating at TIMEOUT logic [31:0] quiet; always_ff @(posedge clk) if (rst || kick) quiet <= '0; else if (quiet != 32'(TIMEOUT)) quiet <= quiet + 1; a_spec: assert property (bite == (quiet == 32'(TIMEOUT))); a_kick_clears: assert property (kick |=> !bite); `ifndef NO_HELPER a_helper: assert property (32'(remaining) + quiet == 32'(TIMEOUT)); `endif c_bite: cover property (bite); c_recover: cover property (bite ##1 kick ##1 !bite); c_kick_just_in_time: cover property (remaining == 1 && kick); endmodule