Clock and Reset Generator
Every sequential test needs a clock and a reset with known timing. This module generates both.
The module acts as a testbench generator block. It must autonomously produce a 100 MHz clock signal and an active-low asynchronous reset. The reset must be asserted at the very beginning of the simulation to initialize downstream logic. To ensure clean recovery timing and avoid race conditions, the reset must cleanly deassert exactly on a falling clock edge.
Timing and reset rules:
- The module requires no inputs; it uses time delays to drive its outputs.
- A 100 MHz clock corresponds to a 10 ns period.
- At time
t = 0,clkmust initialize to1andrst_nmust initialize to0. clkmust toggle every 5 ns.rst_nmust remain asserted (0) for exactly 25 ns.- At exactly
t = 25 ns,rst_nmust deassert (1). This coincides exactly with the third falling edge ofclk.
Worked trace of the expected timing:t = 0 ns: clk=1, rst_n=0t = 5 ns: clk=0, rst_n=0 (first falling edge)t = 10 ns: clk=1, rst_n=0 (first rising edge)t = 15 ns: clk=0, rst_n=0 (second falling edge)t = 20 ns: clk=1, rst_n=0 (second rising edge)t = 25 ns: clk=0, rst_n=1 (third falling edge; reset cleanly deasserts)t = 30 ns: clk=1, rst_n=1 (third rising edge)
| Signal | Direction | Width | Description |
|---|---|---|---|
| clk | output | 1 | 100 MHz clock signal; initializes to 1 at t=0 |
| rst_n | output | 1 | Active-low asynchronous reset; initializes to 0, deasserts to 1 at t=25 ns |
Constraints
clkmust maintain an exact 10 ns period (100 MHz).clkmust start at1att = 0.rst_nmust start at0att = 0and transition to1at exactlyt = 25 ns.- The module has no inputs; you must use
initialandalwaysblocks with time delays (#) to generate the signals.
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.
Part of Debug and Verification
Problem 14 of 19 in the Debug and Verification track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks