Write the checker that passes a good clock and data recovery loop and fails four broken ones, on the same four runs.
Hardware context: The digital blocks of a serializer/deserializer: line encoder and decoder, scrambler, CRC and error-correcting code. Keep the line balanced and busy, and detect or correct the errors a fast serial link makes.
A clock and data recovery (CDR) loop moves its sampling point to the middle of each bit. You get a report from it once per unit interval (UI).
Write a checker with three functions. chk_reset() starts a run. chk_ui(ui, err, step) takes one UI. chk_alarm() says, after the run, whether the loop broke a rule.
The fixture runs your checker on a good loop and on four hidden broken ones. Each sees the same four runs: the transmitter at the same frequency, 300 ppm faster, 5000 ppm faster and 5000 ppm slower.
Your checker must stay silent on the good loop and raise an alarm on every broken one.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
hidden_loop | 8 | input of each check |
Full specification
function automatic void chk_reset();
function automatic void chk_ui(input int ui, input real err, input int step);
function automatic bit chk_alarm(); // 1 = alarm
| Input | Meaning |
|---|---|
ui | The UI number, from 1 to 3,000 in each run. |
err | The sampling point's distance from the bit centre after this UI, from 0 to 0.5 UI. |
step | How many bits the sample moved in this UI: 1 normally, 2 for a skipped bit, 0 for a repeated bit. |
| Rule | Limit (bench value) |
|---|---|
| Lock | The first UI with err below 0.05 is the lock UI. It must come by UI 200. |
| Before lock | Anything goes. The loop is still pulling in, and a slip is allowed. |
| After lock, from the next UI on | err stays at or below 0.1, and step is always 1. |
Every run starts 0.45 UI away from the centre, on PRBS7 data. The limits are this problem's bench values, not a standard's.
A run where the loop never locks breaks the lock rule.
Examples
Example 1
The Good Loop- Input
Four runs of 3,000 UI on the good loop
- Output
alarm = no
It locks by UI 63 in every run and then stays within 0.062 UI. At 5000 ppm faster it skips one bit during pull-in, which the rules allow.
Example 2
A Broken Loop- Input
The same four runs on one hidden broken loop
- Output
alarm = yes
The sampling point never moves. Started 0.45 UI off the centre, it never locks.
Example 3
A Different Broken Loop- Input
The same four runs on one hidden broken loop
- Output
alarm = yes
Each step is 1/4 UI. The loop locks fast, then jumps about 0.25 UI around the centre.
Constraints and Contract
- Keep the three function names and their arguments.
- Keep your state in module-level variables, and clear it in
chk_reset(). - Decide only from
ui,errandstep. The fault switches are not visible to you.
Hints
Hint 1
Keep the lock UI in a variable that starts at -1. Every other rule depends on whether it is set yet.
Hint 2
A good loop may slip while it is still pulling in from 0.45 UI off. When does a slip become a failure?
Hint 3
One broken loop locks quickly and never slips. What else would show that it is wrong?
What the grader checks: The fixture runs your checker on the library's behavioural loop: a good one and four fault switches. Each gets four runs of 3,000 UI. The loop has no noise or jitter, and the limits are bench values.
5 checks on Icarus · browser samples / server checks. 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 1 steps and the final capstone