Four tick dividers get their rates from defparam statements, and two rates reached the wrong instance. Move every rate to the instance it belongs to.
Hardware context: A Verilog-2001 header checker with a misspelled net and a short sensitivity list; and a bank of four tick dividers whose rates come from defparam statements. Replace the defparam statements of the tick bank with named overrides at the right instances.
A timing block makes four ticks at four rates. The dividers are one small module, instantiated four times. Their rates are set by four defparam statements at the end of the top module. Two of the dividers sit one level down, inside div_pair, and the statements reach in by name.
On the board the fast tick is slow and the slow tick is fast. Nobody saw it in review, because every instance line looks the same. This is a Fix problem: retire the defparam statements. Each rate must be a named override at the instance it belongs to, and the four rates must match the brief.
The tests enable the bank, pause it and read all four ticks after every edge. They also run Lint on your file, and a DEFPARAM message fails. They cannot see whether an override is named or by position, so that part is up to you.
Brief: rising-edge clk; rst_n asynchronous and active-low. Synthesis check: the file must build on the site's synthesis flow, with tick_bank as the top, and with no latch.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
script | 20 | input of each check |
Full specification
| Tick | Instance | One tick every |
|---|---|---|
| t_fast | u_fast | 3 enabled cycles |
| t_slow | u_slow | 10 enabled cycles |
| t_a | u_pair.u_a | 4 enabled cycles |
| t_b | u_pair.u_b | 7 enabled cycles |
| tick_div at a rising edge | Result |
|---|---|
| en = 0 | the count returns to 0 and tick is 0 |
| en = 1, count below DIV - 1 | the count goes up by 1 and tick is 0 |
| en = 1, count equal to DIV - 1 | the count returns to 0 and tick is 1 for this cycle |
Keep the three module names, the ports of tick_bank and the behaviour of tick_div. div_pair may gain parameters. You may translate the file to SystemVerilog as you go.
Each test resets the bank, then runs 20 steps of one edge each. The result holds the four ticks after every edge.
Examples
Example 1
Enabled for Twenty Cycles- Input
en=1 x20
- Output
ticks_step0 = {}, ticks_step1 = {}, ticks_step2 = {0}, ticks_step3 = {2}, ticks_step4 = {}, ticks_step5 = {0}, ticks_step6 = {3}, ticks_step7 = {2}, ticks_step8 = {0}, ticks_step9 = {1}, ticks_step10 = {}, ticks_step11 = {0, 2}, ticks_step12 = {}, ticks_step13 = {3}, ticks_step14 = {0}, ticks_step15 = {2}, ticks_step16 = {}, ticks_step17 = {0}, ticks_step18 = {}, ticks_step19 = {1, 2}
Each step lists the ticks that are 1: 0 is t_fast, 1 is t_slow, 2 is t_a, 3 is t_b. t_fast is 1 at steps 2, 5, 8 and so on; t_slow at steps 9 and 19.
Example 2
A Pause Clears Every Count- Input
en=1 x8, en=0 x2, en=1 x10
- Output
ticks_step0 = {}, ticks_step1 = {}, ticks_step2 = {0}, ticks_step3 = {2}, ticks_step4 = {}, ticks_step5 = {0}, ticks_step6 = {3}, ticks_step7 = {2}, ticks_step8 = {}, ticks_step9 = {}, ticks_step10 = {}, ticks_step11 = {}, ticks_step12 = {0}, ticks_step13 = {2}, ticks_step14 = {}, ticks_step15 = {0}, ticks_step16 = {3}, ticks_step17 = {2}, ticks_step18 = {0}, ticks_step19 = {1}
The pause at steps 8 and 9 comes one cycle before the first slow tick. Every divider starts again from 0 at step 10.
Example 3
Enabled Late- Input
en=0 x5, en=1 x15
- Output
ticks_step0 = {}, ticks_step1 = {}, ticks_step2 = {}, ticks_step3 = {}, ticks_step4 = {}, ticks_step5 = {}, ticks_step6 = {}, ticks_step7 = {0}, ticks_step8 = {2}, ticks_step9 = {}, ticks_step10 = {0}, ticks_step11 = {3}, ticks_step12 = {2}, ticks_step13 = {0}, ticks_step14 = {1}, ticks_step15 = {}, ticks_step16 = {0, 2}, ticks_step17 = {}, ticks_step18 = {3}, ticks_step19 = {0}
Nothing ticks for five steps. Then the first fast tick is at step 7, and the first of t_a at step 8.
Constraints and Contract
- en is a known 0/1 value and changes while clk is low.
- tick_bank keeps its name and its port names; all ports are one bit.
Hints
Hint 1
Write down the rate each defparam gives to each instance. Compare that list with the table in the specification.
Hint 2
A named override goes between the module name and the instance name. Write a hash sign, then the parameter name and its value in a port-style list.
Hint 3
u_a and u_b are not instances of the top. div_pair needs parameters of its own, which it passes down.
What the grader checks: Six directed and eight seeded enable patterns of twenty edges each are compared with an independent model of four dividers. Passing shows every instance has the rate of the brief. Lint runs on the file, and any DEFPARAM message fails. Named against positional overrides is not graded.
The submitted design must synthesize with 0 latches and no combinational loop. Counts come from the pinned open-source synthesis flow. They are proxies for logic size and depth, not physical area or timing.
14 checks on Icarus Verilog + Yosys · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 steps and the final capstone