Build the receive side of a 10 Gb/s PCS from raw 66-bit blocks. Nothing tells you the class of a block: you sort it yourself, then step the state diagram.
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 rx_block once per received block, in order. It hands you the block and the block that follows it. Return the eight characters for the XGMII.
First sort the block into class C, S, T, D or E. The class depends on the sync header, the block type field and the codes inside.
Then step the receive state diagram with that class. A Terminate block also needs the class of the next block, so sort that one too.
Three things can come out: the decoded characters, eight Error characters, or two local fault sets when lock is 0.
One thing is this problem's scope: the PCS has no EEE. So C code 06h is not valid and the state RX_LI is not used.
No block carries O code Fh in an O field in use. The class rule alone would call Fh valid. An Ethernet receiver takes it as invalid (49.2.4.6 d)).
P11.23.1 gave your checker the class of every block. Here the classes are yours, and one wrong rule changes what comes out.
The lesson's library has the transmit diagram, eth_66_tx, and code that works on XGMII characters. Nothing readable sorts a raw block. You may reuse your own answers to P11.22.2 and P11.23.1.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic [71:0] rx_block(input bit lock, input [65:0] blk, input [65:0] nxt);
| Item | Rule |
|---|---|
blk, nxt | this block and the one after it. Bits 1:0 are the sync header, bits 9:2 the block type field, bits 65:10 the rest. Bit 0 was received first |
| Result | bit k is the control flag of character k (k = 0 to 7). Bits 8+8k to 15+8k are its octet |
| Sync header | 01 (first bit first, so blk[1:0] is 2'b10): a data block, class D. 10: a control block. 00 or 11: class E |
| C code k | seven bits from bit 10+7k. Valid: 00h idle (07h) and 1Eh Error (FEh). Also valid: 2Dh, 33h, 4Bh, 55h, 66h, 78h, the reserved characters 1Ch, 3Ch, 7Ch, BCh, DCh, F7h |
| Ordered set | the character 9Ch with its flag, then three data octets. Its O code is valid only if it is 0h. An Ethernet receiver takes O code Fh as invalid (49.2.4.6 d)), and no block here carries it |
| 1Eh | C codes 0 to 7. Class C if all eight are valid and none is the Error code |
| 2Dh | C codes 0 to 3, O code in bits 41:38, the set's octets in bits 65:42. Class C if the codes and the O code are valid |
| 4Bh | the set's octets in bits 33:10, O code in bits 37:34, C codes 4 to 7. Class C if the O code and the codes are valid |
| 55h | two ordered sets: octets in bits 33:10 and 65:42, O codes in bits 37:34 and 41:38. Class C if both O codes are valid |
| 33h | C codes 0 to 3, bits 41:38 spare, Start (FBh) in character 4, octets 5 to 7 in bits 65:42. Class S if the four codes are valid |
| 66h | The set's octets in bits 33:10. O code in bits 37:34. Bits 41:38 spare. Start in character 4. Octets 5 to 7 in bits 65:42. Class S if the O code is valid |
| 78h | Start in character 0, octets 1 to 7 in bits 65:10. Class S |
| 87h, 99h, AAh, B4h, CCh, D2h, E1h, FFh | Terminate (FDh) in character k = 0 to 7. Octet j before it is in bits 10+8j to 17+8j. C codes k+1 to 7 follow it; the bits between are spare. Class T if those codes are valid |
| Spare bits | they change neither the class nor the characters |
| Anything else | class E: a reserved block type, a code that is not valid, an Error code in a 1Eh block |
lock = 0 | stands for every cause that restarts the receiver: reset, test mode, no block lock, a high error ratio. Return two local fault sets (LBLOCK). The next block is judged as the first one |
| First block, or after a Terminate, or between frames | class C and class S are passed on. Anything else is an error |
| Inside a frame | class D is passed on. A good Terminate is passed on. Anything else is an error |
| A good Terminate | a class T block whose next block is class C or class S |
| After an error | a good Terminate, class D and class C are passed on, and the receiver goes on from there. Anything else is another error |
| Passed on | return the decoded characters of blk |
| An error | return eight Error characters (EBLOCK) |
The formats are those of Figure 49-7 of IEEE Std 802.3-2022 and the codes those of Table 49-1. The classes are R_BLOCK_TYPE of 49.2.13.2.3. The states are those of Figure 49-17 without EEE.
A Start block puts the receiver inside a frame, and a good Terminate ends it. After an error, class D puts it back inside a frame and class C between frames.
The fixture starts every run with one call that has lock = 0. After the last block of a run, nxt is an idle block (a fixture choice).
Examples
Example 1
A Clean Frame- Input
idle, Start, data, Terminate in character 3; an idle block follows
- Output
control_flags_of_the_last_block = 'b11111000, octets_of_the_last_block_character_7_down_to_0 = 0x7070707fdc3b2a1, blocks_sent_as_eight_error_characters = 'b00000000
Classes C, S, D, T, and the next block is class C. All four blocks are passed on. The result shows the Terminate block decoded.
Example 2
An Error in the Idle Block After the Terminate- Input
the same four blocks; the block that follows is type 1Eh with one Error code
- Output
control_flags_of_the_last_block = 'b11111111, octets_of_the_last_block_character_7_down_to_0 = 0xfefefefefefefefe, blocks_sent_as_eight_error_characters = 'b00001000
That next block is class E. So the Terminate is not a good one, and eight Error characters go out in its place.
Example 3
An Error Character Behind the Terminate- Input
idle, Start, data, then a Terminate block with an Error code after the Terminate
- Output
control_flags_of_the_last_block = 'b11111110, octets_of_the_last_block_character_7_down_to_0 = 0x707070707fefda1, blocks_sent_as_eight_error_characters = 'b00000000
After a Terminate an Error code is valid. The block is class T and idle follows, so it is passed on with its Error character.
Constraints and Contract
- Keep the name and the arguments of
rx_block. You may add, change or remove the helper functions. - Keep your state in module-level variables. A call with
lock= 0 must restart it. - Sort
nxtwith the same rules asblk. - Off limits: the names
rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Where is an Error code allowed, and where does it spoil the block? Read the rows for 1Eh, 2Dh, 33h and the Terminate types again.
Hint 2
A frame ends with a Terminate block. The idle block behind it holds one Error code. What comes out for the Terminate block?
Hint 3
After an error, which classes are passed on again, and which keep the receiver in the error state?
What the grader checks: The fixture checks 48 scripted runs against an independent JavaScript model. It checks 8,904 more blocks against a private reference, and a full check draws other blocks each time. The PCS has no EEE, and no block carries O code Fh in an O field that is in use. Block lock, the BER monitor and the descrambler are not graded.
53 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 3 steps and the final capstone