Write a repetition rule that checks both bounds: busy for exactly three edges after start, then low.
Hardware context: A job engine whose busy flag must last exactly three cycles. Check both bounds of a fixed busy period with one repetition rule.
A job starts when start is 1. From the next edge, busy is high for exactly three edges, and it is low on the edge after them.
Write one concurrent assertion with a consecutive repetition, and count its failures. A job that is too short and a job that is too long are both bugs.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
start | 1 | stimulus, the same for every design |
busy | 1 | stimulus, the same for every design |
your errors | 32 | your checker's error count |
Full specification
module busy_three (
input logic clk,
input logic start, // starts a job
input logic busy, // high while the job runs
output int errors
);
// three_busy: after start, busy on the next three edges, then low on the edge after them.
endmodule
The program shown here gives the sampled value of each signal at each rising edge (at 5, 15, 25, ...):
| Edge | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| start | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| busy | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |
The full check also runs a second program that this page does not show, with another clock and other jobs.
Examples
Example 1
Two Bad Jobs- Input
Program: 3 jobs
- Output
errors = 2
Jobs start at edges 2, 7 and 12. Only the first one is busy for exactly three edges.
Example 2
One Failure by t=110- Input
Program: 3 jobs
- Output
errors = 1
The job from edge 7 is still busy on its fourth edge.
Example 3
One Failure After t=110- Input
Program: 3 jobs
- Output
errors = 1
The job from edge 12 stops after two busy edges.
Constraints and Contract
- Use busy[*3] in one concurrent assertion.
- Check the low edge after the three busy edges too.
- Count failures in errors.
- Do not change the ports.
Hints
Hint 1
On which edge does the job start: the edge of start, or the next one?
Hint 2
Which part of the rule fails a job that stays busy for four edges?
Hint 3
A range such as [*1:3] at the end of a rule passes at its shortest match.
What the grader checks: Two copies of your rule each watch a fixed program. One is shown here; the other is hidden, with another clock. Graded on each: failures early, later and in total. The rule must use busy[*3].
6 checks on Verilator · 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 3 steps and the final capstone