A bench monitor predicts what the Reed-Solomon decoder will report. It calls a codeword with five wrong symbols uncorrected. Find the first bad cycle 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.
A test bench puts wrong bits on the four FEC lanes of a 100 Gb/s link. The monitor below predicts what the decoder will report.
It predicts three things: corrected codewords, uncorrected codewords, and the corrected symbols of each lane.
The bench sends three codewords with 5, 7 and 8 wrong symbols. The code is RS(528,514), so up to 7 can be corrected.
The log says: ERROR: after codeword 0 the decoder would report corrected 1, uncorrected 0.
Step 1: find the first cycle where a signal differs from a correct monitor, and name the signal. Cycle N of the waveform is period N − 1.
Step 2: choose the cause from five bugs. Each is real and fails at a different cycle.
Step 3 is optional: fix the monitor and run the tests.
The lesson's readable models mark blocks and watch windows. This monitor is what the problem grades: the diagnosis first, then the optional fix.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic void mon_reset(input bit kp4);
function automatic void mon_period(input [39:0] err); // one symbol period: ten bit times on each of the four lanes
| Item | Rule |
|---|---|
| Symbol | ten bits in a row on one FEC lane. Each period carries one symbol on every lane (91.5.2.8) |
| Codeword | 132 periods for RS(528,514), 136 for RS(544,514). The first call after mon_reset is period 0 of a codeword |
| Wrong symbol | a symbol with at least one wrong bit. It counts once, however many of its bits are wrong |
| Corrected codeword | 1 to t wrong symbols: t = 7 for RS(528,514), t = 15 for RS(544,514) (91.5.3.3). corrected_cw counts it (91.6.16) |
| Uncorrected codeword | more than t wrong symbols. uncorrected_cw counts it (91.6.17) |
| Clean codeword | no wrong symbol. No counter changes |
lane_errs | the symbols corrected on each lane (91.6.19, 119.3.4). So an uncorrected codeword adds nothing. The register text says detected, but points back to 91.6.19 (45.2.1.121) |
| When | a course choice: the counters change in the call that ends a codeword |
| Size | a course choice: 16 bits a lane in one vector. The standard's counters are 32 bits each |
| Left out | the registers clear when read and stop at all ones (45.2.1.118). This monitor does neither. The lanes are taken as always aligned: fec_align_status is true (91.6.16) |
| Beyond t | a real decoder may, rarely, call such a codeword corrected (91.5.3.3). This monitor always counts it as uncorrected |
The fixture sends random wrong bits, compares the three counters after every codeword, and again at the end of the run.
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 3 is optional: fix the code in the editor, then run the tests.
Examples
Example 1
One Burst of 25 Bits- Input
RS(528,514); 25 wrong bits in a row on FEC lane 2, from bit 403
- Output
corrected_codewords = 1, uncorrected_codewords = 0, symbol_errors_lane_0 = 0, symbol_errors_lane_1 = 0, symbol_errors_lane_2 = 3, symbol_errors_lane_3 = 0
Bits 403 to 427 lie in three symbols of lane 2. Three is no more than 7, so the codeword is corrected and lane 2 counts 3.
Example 2
Seven Symbols, Two Wrong Bits in Each- Input
RS(528,514); seven symbols, 14 wrong bits
- Output
corrected_codewords = 1, uncorrected_codewords = 0, symbol_errors_lane_0 = 2, symbol_errors_lane_1 = 2, symbol_errors_lane_2 = 2, symbol_errors_lane_3 = 1
Seven wrong symbols are still corrected. The lanes count 2, 2, 2 and 1.
Example 3
A Burst Across the End of a Codeword- Input
RS(528,514); 30 wrong bits on lane 1 from bit 1,308
- Output
corrected_codewords = 2, uncorrected_codewords = 0, symbol_errors_lane_0 = 0, symbol_errors_lane_1 = 4, symbol_errors_lane_2 = 0, symbol_errors_lane_3 = 0
A codeword is 1,320 bits on a lane. Two symbols fall in codeword 0 and two in codeword 1: both are corrected, and lane 1 counts 4.
Constraints and Contract
- Keep
mon_resetandmon_periodwith their arguments. - Keep the names
corrected_cw,uncorrected_cwandlane_errs: the fixture reads them. mon_resetmust clear every counter and start a new codeword.- Off limits: the names
ref_mon,rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Codeword 0 has five wrong symbols. What does cw_errs hold when the codeword ends?
Hint 2
Find the first period where cw_errs grows by more than the number of lanes with wrong bits.
Hint 3
The code corrects symbols. Ten wrong bits in one symbol use up one of the seven.
What the grader checks: The failing run is simulated live with the faulty monitor. The first bad period and each option's symptom come from runs of each version on the same bench. The fix is checked on ten scripted runs, with expected values from a JavaScript model. It is also checked on 48 random runs, seeded for each submission. The random runs compare the three counters with a private monitor after every codeword. That private monitor agrees with a full Reed-Solomon decoder on 80 codewords in a measured run. The period call, the 16-bit lane counters and the update at the end of a codeword are course choices. Clear on read, the stop at all ones, the bypass modes, loss of alignment and mis-correction beyond t are not graded.
14 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