A 10 Gb/s station keeps sending frames although its partner reports a fault. Now and then it also drops a fault it should hold. Find the two bad lines.
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 RS below runs the link fault state machine on every received column. It then decides what to send: the MAC's column, Remote Fault ordered sets or Idle.
In the lab, it kept sending MAC frames for the whole outage while Remote Fault arrived. With a slow, steady Local Fault it went back to OK every 128 columns.
Fix it so that link_fault and the column it sends follow the rules below on every column. Two lines are wrong.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic void lf_reset();
function automatic [1:0] lf_rx(input [3:0] c, input [31:0] d); // 0 OK, 1 LF, 2 RF, 3 LI
function automatic [35:0] lf_tx(input [3:0] mc, input [31:0] md); // {c, d} to send
| Rule | Value |
|---|---|
| Fault sequence | c = 0001 and lanes 0 to 3 = 9Ch, 00h, 00h, then 01h (LF), 02h (RF) or 03h (LI) |
| Set link_fault | after the 4th fault sequence of one type in a row, each less than 128 columns after the last |
| A different type | starts a new count of 1; link_fault keeps its old value until the new type reaches 4 |
| Back to OK | when 128 columns in a row hold no fault sequence |
| Counting (bench reading) | col_cnt counts columns without a fault sequence; the 128th makes it 128 and link_fault OK |
| Send | OK: the MAC's column; Local Fault: Remote Fault ordered sets (9Ch, 00h, 00h, 02h); Remote Fault or Link Interruption: Idle |
The state diagram is Figure 46-11 of IEEE Std 802.3-2022. Whether the counter is tested before or after it counts the 128th column is this bench's reading of it.
Examples
Example 1
Four Local Fault Sets- Input
four in a row, then 20 idle columns
- Output
mac_columns_passed = 8, idle_columns_sent = 0, remote_fault_columns_sent = 21, columns_not_ok = 21, first_column_not_ok = 9, link_fault_at_end = Local Fault (1)
link_fault becomes Local Fault on the 4th set, and the station sends Remote Fault from then on.
Example 2
Only Three- Input
three sets
- Output
mac_columns_passed = 28, idle_columns_sent = 0, remote_fault_columns_sent = 0, columns_not_ok = 0, first_column_not_ok = 0, link_fault_at_end = OK (0)
Three are not enough: link_fault stays OK and the MAC's columns go out.
Example 3
A Fault That Keeps Coming- Input
one set every 100 columns
- Output
mac_columns_passed = 300, idle_columns_sent = 0, remote_fault_columns_sent = 700, columns_not_ok = 700, first_column_not_ok = 301, link_fault_at_end = Local Fault (1)
Each set comes less than 128 columns after the last, so the fault holds to the end.
Constraints and Contract
- Keep the three functions and the five variables.
- The bench calls lf_rx, then lf_tx, once per column.
- The fix touches two lines.
- Off limits: the names
rng,tb,root, names that begin withref_and the modules of the bench.
Hints
Hint 1
Which branch runs when the same fault keeps arriving while link_fault is already set? What happens to col_cnt there?
Hint 2
Which values of link_fault must stop the MAC's frames?
Hint 3
Run "Remote Fault received": how many MAC columns should pass?
What the grader checks: The fixture checks 11 literal scenarios against an independent JavaScript model, and 300 random scenarios column by column against a private reference. It tests one station's RS; the PHY and the far station are not modelled. The 128-column limit is tested both ways.
13 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