Home / Learn Verilog / Clock Generation
Clock Generation
Create a clock in simulation.
Quick summaryCreate a clock in simulation.
How to think about this
The basic idea
Use always #half clk = ~clk; or a forever loop.
Why this comes up
Every synchronous test needs a clock.
The mechanics
Parameterise the period.
Where it is used
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
Parameterised clockVerilog: edit and run
Change PERIOD and re-run.
Quick check
1. Clock toggles every...
#(PERIOD/2).