0
\$\begingroup\$

In my testbench, I want to wait for two events in sequence: one after 60000 clock cycles and next after additional 5000 clock cycles

I know I can wait for clock edges using statement @(posedge clk), however how do I wait for specific number of clock edges, say 6000th positive clock edge etc.

\$\endgroup\$
0
\$\begingroup\$

Put your @(posedge clk) in a for loop:

for (i=0; i<60000; i=i+1)
   @(posedge clk) ; 
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I think the code you gave would wait for each of the 60K clock edges.I want to skip sensing first 59999 positive clock edges and only sense 60K th positive clock edge. \$\endgroup\$ – nurabha Sep 11 '19 at 23:37
  • \$\begingroup\$ You can't skip a clock cycle unless you know there was one. \$\endgroup\$ – Oldfart Sep 12 '19 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.