vinothkumar41
Newbie level 3
clock_frequency
How to write verilog code for calculation of clock frequency?
How to write verilog code for calculation of clock frequency?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
`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