`timescale 1us/1ns
module clk_gen();
reg clk_tb;
real clk_period_tb = 0.04 ;
integer count ;
initial begin
clk_tb=0;
count = 0;
end
always #0.02 clk_tb = ~clk_tb;
always @(posedge clk_tb) begin
if(count < 7)
begin
#15 count = count+1;
end
else if(count == 7)
begin
#15 count = 0;
end
end
initial
begin
$monitor($time,"clk =%d",clk_tb);
#1000;
$finish;
end
endmodule
I write this code for counting the clock clock after 15us.Now I don’t know how to write assertion for checking whether the counter is incremented every 15us as well as assert the counter should be reset when it reaches 7 and again it should count from zero
In reply to kanimozhi:
Your code is very poorly written, and from what I see you need strong fundamentals in digital design. I thus strongly believe that you’ll benefit from my book Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 0-9705394-2-8
I just put a promotion at Amazon.com the book is free from 9/18/21 - 9/22/21; it will be $3 afterward. See TOC at http://systemverilog.us/RealChipDesign_preface.pdf