`timescale 1ns/1ps module tb_reset_sync; reg clk=0, arst_n=1; wire rst; always #5 clk=~clk; reset_sync dut(.*); initial begin #0.1 arst_n=0; #1; if(rst!==1) $fatal(1,"assertion failed"); #1 arst_n=1; @(posedge clk); #1; if(rst!==1) $fatal(1,"released too soon"); @(posedge clk); #1; if(rst!==0) $fatal(1,"release failed"); #2 arst_n=0; #0.1; if(rst!==1) $fatal(1,"asynchronous assert failed"); #1 arst_n=1; repeat(2) @(posedge clk); #1; if(rst!==0) $fatal(1,"second release failed"); $display("PASS tb_reset_sync"); $finish; end initial begin #1000; $fatal(1,"timeout"); end endmodule