How to measure clock frequency in every clock edge ? Below code is measuring clock only at first rising edge only.
property p_clk_freq3;
realtime current_time,clk_period=62.5ns;
@ (posedge hclk)
disable iff (hreset)
('1, current_time = $realtime) |=>
(1, $display ("p=%t", $realtime - current_time))
##0 (($realtime - current_time) <= clk_period + 1ns && ($realtime - current_time) >= clk_period - 1ns);
endproperty
ap_clk_freq3: assert property (p_clk_freq3);
In reply to kulua:
Your code works for me. A few extra line would create a simple testcase that shows is is working.
module top;
bit hclk,hreset;
initial begin
repeat(5) #(62.4ns/2.0) hclk = !hclk;
repeat(5) #(65.4ns/2.0) hclk = !hclk;
repeat(5) #(60.4ns/2.0) hclk = !hclk;
end
property p_clk_freq3;
realtime current_time,clk_period=62.5ns;
@ (posedge hclk)disable iff (hreset)
(1, current_time = $realtime) |=>
(1, $display ("p=%t", $realtime - current_time))
##0 (($realtime - current_time) <= clk_period + 1ns && ($realtime - current_time) >= clk_period - 1ns);
endproperty
ap_clk_freq3: assert property (p_clk_freq3) $info("pass");
endmodule