A BASE-R FEC receiver gets bits with no marks in them. Find the blocks, repair them, and hand the PCS its 66-bit blocks.
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 PMA hands over 16 bits at a time. Nothing in them says where an FEC block starts.
rx_group takes one such group. Behind it you build the whole receive path of BASE-R FEC.
Find the block start by its parity, and hold it with the lock of the lesson.
In lock, decode every block: check the parity, and remove one burst of up to 11 bits.
Then turn the 32 words back into 32 blocks of 66 bits, each with its two sync bits.
A block that could not be corrected may be marked for the PCS. rx_setup says whether, and for which PHY.
You built the pieces in P11.29.1, P11.29.2 and P11.29.4. You may reuse your own code from there.
What is new is the path between them. Which stage sees which bits, and in what order?
Seven things are course choices, and the table labels each of them.
Four are about the stream: the 16-bit groups, the one-bit slip, the hand-over rule and the time a setup applies.
Three are about a block: the stop at 11 bits, the payload of an uncorrected block, and the status values.
The lesson's readable eth_fec74_lock holds the two counts of the lock. You may port it: it is a small part of the answer.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
bit rx_lock; bit rx_valid; reg [1:0] rx_status; reg [2111:0] rx_blocks;
function automatic void rx_setup(input bit mark_en, input bit all32);
function automatic void rx_reset();
function automatic void rx_group(input [15:0] g);
| Item | Rule |
|---|---|
rx_group(g) | 16 bits from the PMA; g[0] was received first. A course choice: every PHY type gets these groups here. In the standard only 10GBASE-R does |
rx_reset() | no lock, and no bit is kept: rx_lock and rx_valid are 0. The next bit received is the first candidate start |
rx_setup | a course choice: it may come before any call of rx_group. It applies to every FEC block whose last bit comes after it |
| Candidate block | 2,112 bits in a row, from the candidate start |
| Test | take PN-2112 off, from its start state, and check the parity of the 2,112 bits (74.7.4.7) |
| Lock | the lock of Figure 74-11, with n = 4 and m = 8, on the parity result of every candidate block |
rx_lock | changes in the call that brings the last bit of a candidate block, and in rx_reset |
| Slip | a course choice: one bit is dropped, and the next candidate block starts with the bit after it (74.7.4.7 a). Bits already tested are not tested again. The standard leaves the method open (74.10.2.3) |
| Handing over | a course choice: an FEC block is handed over if rx_lock was 1 before its last bit came. rx_valid is 1 in that call, and 0 in every other call |
rx_status | 0: the parity matched. 1: one burst of up to 11 bits was removed. 2: not corrected. The values are a course choice |
| Decoder | as in P11.29.4, a course choice: it stops at 11 bits. A pattern that would start in front of bit 0 is not corrected |
| Words | word k is bits 65k to 65k + 64 of the FEC block. The transcode bit is the lowest of them. The parity is bits 2,080 to 2,111 |
rx_blocks | block k is bits 66k to 66k + 65. First come its two sync bits, then the 64 payload bits in the order received |
| Sync bits | rebuilt from the transcode bit and data bit 8, as the lesson shows (74.7.4.5.1 a) |
| Marking | mark_en is the variable FEC_Enable_Error_to_PCS. all32 = 0 is a 10GBASE-R or 25GBASE-R PHY, and 1 a 40GBASE-R or 100GBASE-R PHY (74.7.4.5.1 b) |
| Marking off | no block is marked. Every sync header follows its transcode bit, also in a block that was not corrected (74.7.4.5.1 c) |
| Not corrected | a course choice: the payload goes out as it was received. The standard speaks of the sync bits only |
Mind the time limit. A full check sends about 40 candidate blocks.
Keep the remainder in one 32-bit vector and step it with whole-vector operations. Work PN-2112 out once and keep it.
A loop over the 32 stages for every bit of a block is about 12 times slower. It may run out of time on the server.
Examples
Example 1
A Stream That Starts One Bit Early- Input
one stray bit, then copies of the Annex 74A block; the sixth has bits 1,295 to 1,303 wrong
- Output
first_call_with_lock = 661, blocks_handed_over = 3, status_of_this_block = burst removed (1), payload_bits_not_as_sent = 0, sync_headers_not_as_sent = 0, lock_after_this_block = 1, blocks_with_sync_11 = 0x0
The first candidate fails and costs a slip. The next four are good, so the lock rises in call 661. The sixth block is handed over with its burst removed. Bit 1,300 is a transcode bit.
Example 2
A Clean Block- Input
the seventh block has no wrong bit
- Output
first_call_with_lock = 661, blocks_handed_over = 3, status_of_this_block = parity matched (0), payload_bits_not_as_sent = 0, sync_headers_not_as_sent = 0, lock_after_this_block = 1, blocks_with_sync_11 = 0x0
The parity matches: status 0. No block is marked, and all is as it was sent.
Example 3
A Block That Cannot Be Corrected- Input
the eighth block has bits 640 to 651 wrong
- Output
first_call_with_lock = 661, blocks_handed_over = 3, status_of_this_block = not corrected (2), payload_bits_not_as_sent = 11, sync_headers_not_as_sent = 6, lock_after_this_block = 1, blocks_with_sync_11 = 0x81010101
Twelve bits are too many. Five blocks get sync 11: 81010101 is blocks 0, 8, 16, 24 and 31. A sixth sync header is wrong: bit 650 is a transcode bit.
Constraints and Contract
- Keep the four names
rx_lock,rx_valid,rx_statusandrx_blocks, and the three functions with their arguments. rx_statusandrx_blocksare read only in a call that ends withrx_valid= 1.- The tests call
rx_setupafter everyrx_reset, before the next group. - Do the division and the pattern yourself: the bench library's CRC and scrambler models are not allowed here.
- The simulator here does not accept
break. Stop a loop with a done flag in its condition. - Declare variables at the top of a function, not inside a loop.
- You may add helper functions and module-level variables.
- Off limits: the names
ref_dec,rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Start with a stream of your own that begins on a block and has no wrong bit. In which call must rx_lock rise?
Hint 2
Then the sample: its stream starts one bit early. After a slip, which bits does your next candidate block hold?
Hint 3
A group can hold the end of one block and the start of the next. Where do the spare bits go?
Hint 4
Write the stages of one block in order, from 2,112 line bits to 32 blocks. Then try a burst that hits a transcode bit.
What the grader checks: The visible stream takes its expected values from an independent JavaScript model. Its three rows are three blocks of that one stream. One hidden row is the same stream going on: seven more blocks with two wrong bits each. The other hidden stream is random and changes with every submission. It is reported in three parts. The fixture builds every block from a codeword and the wrong bits it places. So it knows the status and the 32 blocks that are due. It also follows the candidate start through every slip. It compares rx_lock and rx_valid after every call, and all 2,112 bits of rx_blocks at every hand-over. A failed part names the kind of block at its first wrong call. One random block has two wrong bits on a transcode bit or on data bit 8. One has a burst in the parity alone. They hold bit 0 alone, and 11 bits from bit 0. Three blocks cannot be corrected: 12 wrong bits, twice, and two wrong bits 31 apart. One more has a pattern in front of bit 0. Each of the eight has its own setup. The lock is lost once and found again after one more slip. There are two resets. One comes straight after a slip, the other in the middle of a block. A slip counter that wraps after 16 slips is not reached. Seven things are course choices: the 16-bit groups, the one-bit slip, the hand-over rule and the time rx_setup applies. The stop at 11 bits, the payload of an uncorrected block and the status values are the others. The counters of 74.8.4, the 16-bit groups toward the PCS and rapid lock for EEE are not graded here.
7 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 5 steps and the final capstone