Write the checker that passes a correct FEC block lock and fails seventeen broken ones. It sees one parity result at a time.
Hardware context: An Ethernet MAC and physical coding sublayer: frame builder and checker, reconciliation sublayer and block encoder. Build, check and pace Ethernet frames, and code them for the physical layer as IEEE 802.3 specifies.
A BASE-R FEC receiver gets no sync headers from the line. It finds the start of the 2,112-bit FEC block by its parity.
It tests one candidate block after another. Four good blocks in a row set FEC block lock. Eight bad ones in a row clear it.
Write a checker with three functions. For each tested block it is told whether the parity matched.
It also sees what the receiver did: its lock, and whether it slipped to the next candidate start.
The fixture runs your checker on a correct receiver and on seventeen hidden broken ones. Each run has about 1,300 blocks.
Every run starts with three good blocks and a bad one. Then come random blocks of its own, and a restart.
The last run is the correct receiver again, on other blocks.
Your checker must stay silent on the correct receiver and raise an alarm on every broken one.
Three things are fixture choices, not the standard's. The checker gets the result of the parity check, not the 2,112 bits.
The bits skipped by a slip are not shown: the next call is the next block tested. And restart stands for both reset and loss of signal.
The receiver has no rapid lock for EEE (74.7.4.8).
The lesson has a readable receiver, eth_fec74_lock, with the same two counts. You may port its logic.
What is graded is the checker around it: one call per block, the restart, and both outputs compared at every block.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
hidden_receiver | 8 | input of each check |
Full specification
function automatic void chk_reset();
function automatic void chk_block(input bit restart, input bit parity_good, input bit lock, input bit slip);
function automatic bit chk_alarm(); // 1 = alarm
| Item | Rule |
|---|---|
restart = 1 | the receiver is in reset or has no signal. Its lock must be 0 and it must not slip. The block is not counted, and both counts start again |
parity_good | 1 if the parity check of this block matched, 0 if it did not |
lock, slip | what the receiver shows after it has acted on this block |
| Two counts | good blocks in a row and bad blocks in a row. A good block sets the bad count to zero. A bad block sets the good count to zero |
| The fourth good block in a row | FEC block lock is set at that block. Both counts start again |
| Out of lock, a bad block | the receiver slips. Both counts start again |
| In lock, bad blocks 1 to 7 in a row | nothing changes, and no slip |
| In lock, the eighth bad block in a row | the lock is cleared and the receiver slips, both at that block. Both counts start again |
| Slip | 1 only at a block that makes the receiver slip. 0 at every other block |
These are the rules of Figure 74-11 of IEEE Std 802.3-2022, with n = 4 and m = 8 (74.10.2.1).
In the standard a slip moves the candidate start: by one bit in 74.7.4.7. The SLIP function of 74.10.2.3 leaves the method to the design.
The fixture calls chk_reset() once, before the first block of a run. The receiver then has no lock, and both its counts are zero.
Examples
Example 1
The Correct Receiver- Input
About 1,300 parity results: a random lead-in, near misses, runs of seven and eight bad blocks, restarts and random noise
- Output
alarm = no
It locks at the fourth good block in a row. It holds lock through seven bad blocks in a row and drops it at the eighth.
Example 2
A Broken Receiver- Input
The same kind of run through one hidden broken receiver
- Output
alarm = yes
Out of lock, the receiver sets FEC block lock at the first block with good parity.
Example 3
A Different Broken Receiver- Input
The same kind of run through one hidden broken receiver
- Output
alarm = yes
The receiver sets FEC block lock after three good blocks in a row.
Constraints and Contract
- Keep the three function names and their arguments.
- Keep your state in module-level variables, and clear it in
chk_reset(). - Judge the receiver by
lockandsliponly. The fixture's own instances are off limits. - Off limits: the names
lock_under_test,result,run_design,run_case,run_again,rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Which good block sets the lock: the third, the fourth or the fifth in a row?
Hint 2
In lock, seven bad blocks, one good block and seven more bad blocks: is the lock lost?
Hint 3
Some broken receivers show the right lock and the wrong slip. Compare both, at every block.
Hint 4
One broken receiver is wrong at a single block of the whole run. Raise the alarm at the first mismatch.
What the grader checks: The fixture runs your checker on a private lock model: a correct receiver and seventeen fault switches. Each run has about 1,300 parity results: a fixed start, a random lead-in of its own, scripted sequences and random noise. The correct receiver runs twice, the second time on other blocks. On a full check the blocks change with every submission. Random blocks and a restart then come before each scripted sequence. The checker sees parity results, not line bits. The bits skipped by a slip are not shown. restart stands for reset and loss of signal. Rapid lock for EEE and the parity check itself are not graded here.
19 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 5 steps and the final capstone