P11.28.1 Which PCS Lane Is on Which Wire?

MediumDebugIcarus Verilog · serverReview the topic

A 100 Gb/s port sends 20 PCS lanes through a 10:4 bit mux. The far end cannot find all 20 lanes on the four wires. Find the first bad tick and the cause.

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 mux below takes ten input lanes, each with two PCS lanes. It sends them on four wires, each with five PCS lanes.

The bench sends 30 bits of every PCS lane. Then the far end looks at each turn of each wire. The log says: ERROR: turn 0 of wire 0 carries no whole PCS lane.

Step 1: find the first tick where a signal differs from a correct mux, and name it. Cycle N of the waveform is tick N − 1.

Step 2: choose the cause from five bugs. Each is real and fails at a different tick.

Step 3 is optional: fix the mux and run the tests.

Four things are course choices, not the standard's. Time is counted in ticks, ten to a PCS-lane bit. The first call after pma_reset is tick 0. The fixture reads each wire on even ticks. A PCS lane may be delayed by 0 to 3 of its own bit times.

The order of the PCS lanes on the wires is free in the standard (83.5.2). So the tests accept any order that is one-to-one and stays.

The lesson's eth_pma is readable. It reorders whole bit times and has no ticks. This tick-level mux is what the problem grades: the diagnosis first, then the optional fix.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
The mux API (keep it)
function automatic void pma_reset();
function automatic [3:0] pma_tick(input [9:0] in);   // one tick: ten input lanes in, four wires out
ItemRule
Ticka course choice: one PCS-lane bit lasts 10 ticks. The first call after pma_reset is tick 0
Input lane icarries two PCS lanes, a bit of each in turn. A new bit starts on ticks 0, 5, 10, ...
Which lane firsta detail of this tick model. Input lane i sends PCS lane 2i on ticks 0 to 4 of each bit time. PCS lane 2i + 1 follows on ticks 5 to 9
Wire wcarries five PCS lanes, a bit of each in turn. A new bit starts on every even tick and is held for two ticks
Same lane againbits x and x + 5 of a wire belong to the same PCS lane (83.5.2: x + z/n)
Orderfree: any PCS lane may take any turn of any wire. Each of the 20 goes out in exactly one turn
Order over timethe chosen order must stay while the input is valid (83.5.2). After pma_reset it may be new
Delaya course choice: a fixed delay of 0 to 3 PCS-lane bit times for each lane. The standard's limit is much looser (83.5.4, Table 83-1: 92.16 ns for all 100GBASE-R PMAs of one end together)
Readinga course choice: the fixture reads each wire once per bit, on the even tick

The fixture sends random bits on all 20 PCS lanes. Then it asks, for each turn of each wire, which lane it carries.

Diagnose the Failing Run

The test below runs the buggy design. Read its log, then find where it first goes wrong in the waveform.

Log

Waveform

Click a signal at a cycle to select it. Or focus the waveform and use the arrow keys: Left and Right move one cycle, Up and Down one signal.

Step 1 · The first bad cycle and signal
Step 2 · The cause

Step 3 is optional: fix the code in the editor, then run the tests.

Examples

Example 1

Twenty Random Lanes
Input
96 bit times of random data on all 20 PCS lanes
Output
pcs_lanes_found_once = 20, pcs_lanes_missing = 0, pcs_lanes_repeated = 0, turns_with_no_lane = 0, turns_that_changed_lane = 0, wire_bits_not_held_two_ticks = 0

Every turn of every wire must carry one whole PCS lane, and every lane must be found once.

Example 2

A Longer Link
Input
three runs with no reset
Output
pcs_lanes_found_once = 20, pcs_lanes_missing = 0, pcs_lanes_repeated = 0, turns_with_no_lane = 0, turns_that_changed_lane = 0, wire_bits_not_held_two_ticks = 0

The lane in each turn must be the same in all three runs. A mux may not change its order in mid-stream.

Example 3

A Reset in the Middle
Input
two runs with a reset between them
Output
pcs_lanes_found_once = 20, pcs_lanes_missing = 0, pcs_lanes_repeated = 0, turns_with_no_lane = 0, turns_that_changed_lane = 0, wire_bits_not_held_two_ticks = 0

After a reset the order may be new. It must again be one-to-one.

Constraints and Contract

  • Keep pma_reset and pma_tick with their arguments.
  • Keep your state in module-level variables. pma_reset must clear all of it.
  • Do not read the bench: only in tells you what arrives.
  • Off limits: the names gen, chunk, run, score, rng, tb, root, names that begin with fx_ and the modules of the bench.

Hints

Hint 1

How many PCS lanes share one wire? Count the turns pos takes before it starts again.

Hint 2

Compare pos with the tick number in the first ten ticks.

Hint 3

A wire that skips one turn drifts: the same turn then carries another lane in every bit time.

What the grader checks: The failing run is simulated live with the faulty mux. The first bad tick and each option's symptom come from runs of each version on the same bench. The fix is checked on four fixed links and 16 random ones, each with its own seeded data. The fixture accepts any one-to-one order that stays, with a fixed delay of 0 to 3 bit times. The tick model, the delay limit and the reading tick are course choices. Markers, skew between input lanes, clock recovery and PAM4 are not graded.

6 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 1 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Twenty Random Lanes

Input
96 bit times of random data on all 20 PCS lanes
Expected output
pcs_lanes_found_once = 20, pcs_lanes_missing = 0, pcs_lanes_repeated = 0, turns_with_no_lane = 0, turns_that_changed_lane = 0, wire_bits_not_held_two_ticks = 0

Every turn of every wire must carry one whole PCS lane, and every lane must be found once.

Run samples executes all 3 public checks. Check all tests runs 6 checks on the server.

Icarus Verilog · server