Frequency checker in system verilog or verilog

5 posts / 0 new
Last post
azhars_09
Offline
Academy Total Access User
Joined: 11/24/2011
Posts: 1
Frequency checker in system verilog or verilog

Hai...
i want to generate a clk of frequency 10Mhz and want to check the frequency in checker or testcase .. wheather frequency is correct or not ,Can any help and teach me , how to do it in a better a way .

forever
#400 clk=~clk ;

ben@SystemVerilog.us
Offline
Academy Total Access User
Joined: 03/23/2010
Posts: 14
Re: Frequency checker in system verilog or verilog

Verification Guild http://bit.ly/zWkxBS
I did a google search on: VerificationGuild clock frequency assertion
There are many posts on this topic.
Ben Cohen

aming
Offline
Academy Total Access User
Joined: 11/13/2009
Posts: 19
Re: Frequency checker in system verilog or verilog

Do you think below works?

property name ( int clk_period);
@(posdege clk) disable iff (rst)
('1, current_time = $time) |=> (clk_period == ( $time - current_time) )
endproperty

ben@SystemVerilog.us
Offline
Academy Total Access User
Joined: 03/23/2010
Posts: 14
Re: Frequency checker in system verilog or verilog

// This is the correct way, you need the local variable current_time.
// You cannot do an assign from within the property.
// I move the clocking event to the assertion.
time clk_period = 20ns;
property p_period ( int clk_period);
time current_time;
disable iff (rst)
('1, current_time = $time) |=> (clk_period == ($time - current_time) );
endproperty : p_period
ap_period: assert property(@ (posedge clk) p_period(clk_period));
Ben Cohen SystemVerilog.us

dave_59
Offline
Verification Forum Moderator
Joined: 03/10/2010
Posts: 976
Re: Frequency checker in system verilog or verilog

Basic timing checks can be performed using Verilog timing checks like $period. You can put these into existing modules or interfaces, or bind them into your design.

__________________

Dave Rich
Mentor Graphics
http://go.mentor.com/drich