Four lanes arrive on the wrong wires and at different times. Build the receiver that locks to their markers, lines them up and hands back the rows the transmitter dealt.
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.
The bench calls lanes_rx once per block time, with the block that arrived on each of the four wires.
Find the markers on every wire. The marker gives the PCS lane number of the wire, and its arrival time gives the skew.
Then return one row per call: the four blocks of one dealing round, with PCS lane 0 in the lowest bits. Leave the rows of markers out.
A wire has marker lock after two markers with the same lane number, exactly gap + 1 blocks apart. One marker pattern alone must not be trusted.
Six things are course choices, not the standard's. The bench works in whole blocks, after block lock. The skew is a whole number of blocks, from 0 to 28. gap is an argument: all tests but one use 60 to 100 blocks in place of 16,383. Loss of marker lock is not tested.
The last two are a start limit and a keep-up limit. The standard sets neither. It only limits the delay of the whole PCS: 281.6 ns, or 44 block times, for transmit plus receive (82.5).
Rows are graded by what they hold, not by when they come. But you must start on time and keep up: see the table.
The lesson's library, eth_am and eth_mld_lanes, is readable and holds no receiver. The starter gives you am_lane. Marker lock, deskew, reorder and marker removal are what this problem grades.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic [264:0] lanes_rx(input bit restart, input [263:0] w, input int gap);
| Item | Rule |
|---|---|
restart = 1 | forget everything. w and the result are ignored |
w | wire k is w[66*k +: 66]. Any PCS lane may be on any wire, and the wiring differs from test to test |
gap | blocks between two markers of a lane: 16,383 in the standard. A course choice: the fixture uses 60 or more |
| Marker lock on a wire | a first marker, then a marker with the same lane number exactly gap + 1 blocks later (Figure 82-13) |
| A second look that fails | the wire hunts again for a first marker. Which block it tries next is left to the design (AM_SLIP, 82.2.19.2.3). The reference tries the next block; re-testing the block that failed also passes |
| Skew | at most 28 blocks between the earliest and the latest lane. A course choice: 180 ns is 28.1 blocks of 40GBASE-R |
| The result | bit 264 is valid. With valid = 1, bits 66*l +: 66 hold the block of PCS lane l |
| Rows | the first row may be any row. After it, every row of the transmitter must follow, in order, each once |
| Marker rows | in lock, the block in the marker position is never part of a row, whatever it holds (82.2.15). Every other block is data |
| Start on time | a course choice. Take a receiver that follows Figure 82-13 and tries the next block after each failed test. Your first row must come no later than 64 block times after that receiver has every wire in marker lock |
| Keep up | a course choice: a row must come out no more than 36 block times after its last block arrived. The fixture checks this at the end of each run |
These are the rules of 82.2.13 to 82.2.15 and Figures 82-13 and 82-14 of IEEE Std 802.3-2022, with the choices named above.
The fixture starts every run with one call that has restart = 1. It never damages two markers in a row on a lane that is in lock.
Examples
Example 1
Lanes on Their Own Wires, on Time- Input
PCS lanes 0 to 3 on wires 0 to 3, no skew. Gap 100
- Output
wrong_rows = 0, started = yes, started_late = no, fell_behind = no, rows_left_out = no
Even this link needs marker lock to work in general: the other tests move the lanes, and only the markers say how. The starter never returns a row.
Example 2
Two Lanes Swapped- Input
PCS lane 0 on wire 1 and PCS lane 1 on wire 0, no skew. Gap 100
- Output
wrong_rows = 0, started = yes, started_late = no, fell_behind = no, rows_left_out = no
The marker on wire 1 names PCS lane 0. So the block of wire 1 goes into the lowest 66 bits of the row.
Example 3
One Lane Late- Input
lanes on their own wires; PCS lane 2 is 5 blocks late. Gap 100
- Output
wrong_rows = 0, started = yes, started_late = no, fell_behind = no, rows_left_out = no
The marker of lane 2 comes 5 block times after the others. The other three lanes wait 5 blocks, and lane 2 waits none.
Constraints and Contract
- Keep the name and the arguments of
lanes_rx, and keepam_lane. - Keep your state in module-level variables.
restartmust clear all of it. - Use
gapas given: the fixture changes it from run to run. - Off limits: the names
lib,rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Solve one wire first: when has it seen the same marker twice, and how long ago was its last marker?
Hint 2
All markers left together. When the last wire locks, how long ago did each other wire see its marker?
Hint 3
The last wire to lock is not always the latest lane. A marker that is about to arrive belongs to the same row as one that just came.
What the grader checks: The fixture checks 14 scripted links, 24 random links and one link with the standard's gap of 16,383 blocks. It compares every row with the blocks the transmitter dealt. Two limits are course choices. The first row must come within 64 block times of the lock time of a reference receiver. That time was worked out beforehand, and no reference receiver runs in the fixture. The last row of each run shows whether you kept up. Each link has its own seeded stream. Skew in whole blocks (0 to 28), gaps of 60 to 100 blocks and four lanes are course choices. Duplicate lane numbers are not graded. Block lock, loss of marker lock, BIP checking, 20 lanes and the descrambler are not graded.
17 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