Apr 6, 2009 #1 V 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?
Apr 6, 2009 #2 RBB Full Member level 5 Joined Jul 2, 2007 Messages 303 Helped 72 Reputation 144 Reaction score 37 Trophy points 1,308 Location USA Activity points 2,560 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
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
Apr 7, 2009 #3 V 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 Re: clock_frequency Thanks for clearing my doubt... reagrds, vinoth