How to write verilog code for calculation of clock frequency

Status
Not open for further replies.

vinothkumar41

Newbie level 3
Joined
Jan 28, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
clock_frequency

How to write verilog code for calculation of clock frequency?
 

Re: clock_frequency

Code:
`timescale 1ns/10ps

module foo(clk);
     input clk;

     real t0;
     real t1;
     real frequency;

     initial
          begin
               @ (posedge clk) t0 = $realtime;
               @ (posedge clk) t1 = $realtime;
               frequency = 1.0e9 / (t1 - t0);
               $display("Frequency = %g", frequency);
               $finish;
          end
endmodule
 
Reactions: coshy

    coshy

    Points: 2
    Helpful Answer Positive Rating
Re: clock_frequency

Thanks for clearing my doubt...


reagrds,
vinoth
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…