A link asked to power down in the middle of traffic. Find the test that is true for almost every pattern of busy lanes, and fix it.
Hardware context: An idle timer for a four-lane link, and a 12-bit address decoder with six regions. Fix the idle timer so that it counts only cycles in which every lane is idle.
A four-lane link saves power when it is idle. An idle timer counts quiet cycles: cycles in which no lane is busy and software has not set hold. After four quiet cycles in a row it raises pd_req, and the link powers down.
In the lab the link powered down while three lanes still carried traffic. The timer only behaved when all four lanes were busy at once.
This is a Fix problem: the editor holds the shipped design. Find the wrong test and correct it. The fixture pulses reset, applies sixteen steps of one rising edge each, and records quiet and pd_req after every edge. Synthesis check: the design must build on the site's synthesis flow with no latch. The cell and level counts come from an open-source flow and are a proxy for area and depth, not a foundry result.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
script | 80 | input of each check |
Full specification
module idle_timer (
input logic clk,
input logic rst_n, // asynchronous, active-low
input logic [3:0] lane_busy, // one bit per lane: 1 while that lane carries traffic
input logic hold, // 1: software forbids power-down
output logic [2:0] quiet, // quiet cycles in a row, stops at 4
output logic pd_req // 1 when quiet is 4
);
...
endmodule
| Rule | Correct timer |
|---|---|
| reset | quiet is 0 while rst_n is 0. Asynchronous. |
| a quiet cycle | At a rising edge, every bit of lane_busy is 0 and hold is 0. |
| counting | A quiet cycle adds 1 to quiet, up to 4. quiet then stays at 4. |
| any other cycle | quiet returns to 0. |
| pd_req | 1 exactly when quiet is 4. |
The result lists quiet and pd_req after each of the sixteen edges.
Examples
Example 1
All Lanes Quiet- Input
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
- Output
quiet_step0 = 1, pd_req_step0 = no, quiet_step1 = 2, pd_req_step1 = no, quiet_step2 = 3, pd_req_step2 = no, quiet_step3 = 4, pd_req_step3 = yes, quiet_step4 = 4, pd_req_step4 = yes, quiet_step5 = 4, pd_req_step5 = yes, quiet_step6 = 4, pd_req_step6 = yes, quiet_step7 = 4, pd_req_step7 = yes, quiet_step8 = 4, pd_req_step8 = yes, quiet_step9 = 4, pd_req_step9 = yes, quiet_step10 = 4, pd_req_step10 = yes, quiet_step11 = 4, pd_req_step11 = yes, quiet_step12 = 4, pd_req_step12 = yes, quiet_step13 = 4, pd_req_step13 = yes, quiet_step14 = 4, pd_req_step14 = yes, quiet_step15 = 4, pd_req_step15 = yes
quiet counts 1, 2, 3, 4 and stays at 4. pd_req is 1 from the fourth edge on. The shipped design gets this case right.
Example 2
One Lane Busy All the Time- Input
0100 0100 0100 0100 0100 0100 0100 0100 0100 0100 0000 0000 0000 0000 0000 0000
- Output
quiet_step0 = 0, pd_req_step0 = no, quiet_step1 = 0, pd_req_step1 = no, quiet_step2 = 0, pd_req_step2 = no, quiet_step3 = 0, pd_req_step3 = no, quiet_step4 = 0, pd_req_step4 = no, quiet_step5 = 0, pd_req_step5 = no, quiet_step6 = 0, pd_req_step6 = no, quiet_step7 = 0, pd_req_step7 = no, quiet_step8 = 0, pd_req_step8 = no, quiet_step9 = 0, pd_req_step9 = no, quiet_step10 = 1, pd_req_step10 = no, quiet_step11 = 2, pd_req_step11 = no, quiet_step12 = 3, pd_req_step12 = no, quiet_step13 = 4, pd_req_step13 = yes, quiet_step14 = 4, pd_req_step14 = yes, quiet_step15 = 4, pd_req_step15 = yes
Lane 2 is busy for ten cycles, so quiet must stay 0. It may count only in the last six cycles.
Example 3
Traffic on Lane 3 Only- Input
1000 1000 1000 1000 1000 0000 0000 0000 0000 0000 1000 0000 0000 0000 0000 0000
- Output
quiet_step0 = 0, pd_req_step0 = no, quiet_step1 = 0, pd_req_step1 = no, quiet_step2 = 0, pd_req_step2 = no, quiet_step3 = 0, pd_req_step3 = no, quiet_step4 = 0, pd_req_step4 = no, quiet_step5 = 1, pd_req_step5 = no, quiet_step6 = 2, pd_req_step6 = no, quiet_step7 = 3, pd_req_step7 = no, quiet_step8 = 4, pd_req_step8 = yes, quiet_step9 = 4, pd_req_step9 = yes, quiet_step10 = 0, pd_req_step10 = no, quiet_step11 = 1, pd_req_step11 = no, quiet_step12 = 2, pd_req_step12 = no, quiet_step13 = 3, pd_req_step13 = no, quiet_step14 = 4, pd_req_step14 = yes, quiet_step15 = 4, pd_req_step15 = yes
A design that leaves lane 3 out of the test counts through this traffic and powers down too early.
Constraints and Contract
- Inputs are known 0/1 values and change while clk is low.
- Keep the module name and the ports.
Hints
Hint 1
Run the tests and find the first step where quiet goes up although a lane is busy. Which line decides that a cycle is quiet?
Hint 2
Work out the value of each operand of the && for lane_busy = 0100. How wide is the first operand, and when does a vector count as true?
Hint 3
Ask the question the brief asks: are all four bits 0? A comparison with zero says exactly that.
What the grader checks: Six directed and ten seeded scripts of sixteen steps run after a reset pulse. An independent model checks quiet and pd_req after every edge. Passing shows the timer follows the brief on these scripts; the synthesis check adds the latch count.
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.
16 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