Write the checker that passes a correct 1000BASE-X synchronisation process and fails fourteen broken ones. It sees one code-group 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 1000BASE-X receiver must find the code-group boundary first. It hunts for commas, declares sync, and gives sync up after too many bad code-groups.
Write a checker with three functions. For each code-group it is told the class: a comma, valid data, invalid, or none of these.
It also sees what the receiver shows after that code-group: its sync status and its rx_even flag.
The fixture runs your checker on a correct receiver and on fourteen hidden broken ones. Each run has a few thousand code-groups.
The runs use two streams of code-groups. Each stream goes to the correct receiver and to several broken ones.
Your checker must stay silent on the correct receiver and raise an alarm on every broken one.
Four things are choices of this problem, not the standard's. The code-groups arrive already classified: decoding is not graded.
No code-group here is both a comma and invalid: the figure's arcs overlap for such a code-group.
restart stands for power-on, reset and a change or loss of signal. And rx_even is not compared in LOSS_OF_SYNC.
P11.20 has a readable receiver, eth_1000x_sync, with the same states on ten-bit code-groups. You may port its logic.
What is graded is the checker around it: the classes, the restart and the comparison of both outputs.
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_cg(input bit restart, input bit comma, input bit data, input bit invalid, input bit sync, input bit even);
function automatic bit chk_alarm(); // 1 = alarm
| Item | Rule |
|---|---|
restart = 1 | the receiver is in reset or has no signal. It is in LOSS_OF_SYNC, and the code-group is not looked at |
comma, data, invalid | the class of this code-group. At most one is 1. All 0 is a valid special code-group with no comma, such as /R/ |
sync, even | what the receiver shows after it has taken this code-group: sync_status (1 = OK) and rx_even |
| rx_even | 1 at every comma the hunt accepts. At every other code-group it toggles |
| Odd position | a comma is in an odd position if rx_even was 1 after the code-group before it |
| Bad code-group | an invalid one, or a comma in an odd position. Every other code-group is good |
| LOSS_OF_SYNC | sync is 0. A comma starts the hunt. Every other code-group is passed over |
| After a comma of the hunt | the next code-group must be valid data. If it is not, the receiver is back in LOSS_OF_SYNC. It is not taken as a new comma |
| Between two commas of the hunt | a comma in an even position is the next comma. A bad code-group sends the receiver back to LOSS_OF_SYNC. Others are passed over |
| Sync | set at the data code-group after the third comma, on the first of four levels |
| In sync, a bad code-group | one level down. On the fourth level it clears sync: LOSS_OF_SYNC |
| In sync, four good code-groups in a row | one level up, unless the receiver is on the first level. A bad code-group ends the row, and each level starts its own row |
Comparing even | a choice of this problem: even need not match while your checker expects LOSS_OF_SYNC after this code-group. Everywhere else it must match |
These are the rules of Figure 36-9 of IEEE Std 802.3-2022. Good and bad code-groups are cggood and cgbad of 36.2.5.1.3.
The standard gives rx_even no starting value (36.2.5.1.3). So it is unknown until the first comma of a run.
After that comma the figure fixes it in LOSS_OF_SYNC too, and the correct receiver follows the figure there. A checker may compare it there as well.
The fixture calls chk_reset() once, before the first code-group of a run.
Examples
Example 1
The Correct Receiver- Input
A few thousand code-groups: a random lead-in, hunts that succeed and fail, bad code-groups in sync, restarts and random streams
- Output
alarm = no
It sets sync at the data code-group after the third comma. It holds sync through three bad code-groups and clears it at the fourth.
Example 2
A Broken Receiver- Input
One of the two streams through one hidden broken receiver
- Output
alarm = yes
The receiver sets sync at the data code-group after the second comma.
Example 3
A Different Broken Receiver- Input
One of the two streams through one hidden broken receiver
- Output
alarm = yes
After a comma the receiver goes on whatever the next code-group is.
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
syncandevenonly. The fixture's own names are off limits. - Off limits: the names
sync_under_test,rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
How many commas does sync need, and what must follow each one?
Hint 2
After one bad code-group and three good ones, has the receiver stepped back up?
Hint 3
Some broken receivers show the right sync and the wrong rx_even. Compare both.
What the grader checks: The fixture runs your checker on a private model of the synchronisation process: a correct receiver and fourteen fault switches. Each run has a few thousand code-groups: a random lead-in, scripted sequences and random streams. There are two such streams, and each goes to the correct receiver and to several broken ones. The checker sees classified code-groups, not line bits. No code-group is both a comma and invalid. restart stands for power-on, reset and a change or loss of signal. rx_even is not compared in LOSS_OF_SYNC. Loopback is not modelled.
16 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 2 steps and the final capstone