A 10 Gb/s receiver has found the block boundary and descrambled the payload. Turn each 66-bit block back into eight XGMII characters, and catch every invalid one.
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 decode once per block, with bit 0 the first bit received. Return the eight characters as one 72-bit vector.
There are fifteen control block types and the data block. The starter handles the data block and part of type 1Eh.
An invalid block must not be passed on in part. Return eight Error characters for it.
One thing is a course choice. In the standard the receive state diagram swaps in the Error characters (P11.23). Here decode does it.
Two things are this problem's scope. The PCS has no EEE, so C code 06h is invalid. And no block carries O code Fh, which the standard keeps for Fibre Channel.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic [71:0] decode(input [65:0] blk);
| Item | Rule |
|---|---|
| Block | bits 1:0 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): eight data octets in bits 65:2. 10: a control block. 00 or 11: invalid |
| C code k | seven bits from bit 10+7k. 00h idle (07h), 1Eh Error (FEh), 2Dh, 33h, 4Bh, 55h, 66h, 78h the reserved characters 1Ch, 3Ch, 7Ch, BCh, DCh, F7h. Any other code is invalid |
| Ordered set | the character 9Ch with its flag, then three data octets. Its O code must be 0h |
| 1Eh | C codes 0 to 7. An Error code makes this block invalid (49.2.13.2.3) |
| 2Dh | C codes 0 to 3; O code in bits 41:38; the set's octets in bits 65:42 |
| 33h | C codes 0 to 3; bits 41:38 spare; Start (FBh) in character 4; octets 5 to 7 in bits 65:42 |
| 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 |
| 55h | two ordered sets: octets in bits 33:10 and 65:42, O codes in bits 37:34 and 41:38 |
| 78h | Start in character 0; octets 1 to 7 in bits 65:10 |
| 4Bh | the set's octets in bits 33:10; O code in bits 37:34; C codes 4 to 7 |
| 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 |
| Spare bits | ignore them |
| Any other type | invalid |
| Invalid block | return eight Error characters: every flag 1, every octet FEh |
The formats are those of Figure 49-7 of IEEE Std 802.3-2022. The codes are those of Table 49-1. The validity rules are those of 49.2.4.6 and 49.2.13.2.3.
An Error code is valid after a Terminate, and beside an ordered set or a Start. Only among eight C codes does it spoil the block.
Examples
Example 1
Start in Character 0- Input
sync header 10, type 78h, octets 55h six times and D5h
- Output
control_flags_character_7_down_to_0 = 'b00000001, octets_character_7_down_to_0 = 0xd5555555555555fb
Character 0 is Start, with its flag set. The seven octets follow as data.
Example 2
Terminate in Character 3- Input
type B4h: octets A1h, B2h, C3h, then C codes 00h, 1Eh, 00h, 00h
- Output
control_flags_character_7_down_to_0 = 'b11111000, octets_character_7_down_to_0 = 0x707fe07fdc3b2a1
Three data octets, Terminate, then idle, Error, idle, idle. After a Terminate an Error code is valid.
Example 3
An Ordered Set- Input
type 4Bh: octets 00h, 00h, 01h, O code 0h, four idle codes
- Output
control_flags_character_7_down_to_0 = 'b11110001, octets_character_7_down_to_0 = 0x70707070100009c
The local fault set of P11.19 in the first four characters, then four idles.
Constraints and Contract
- Keep the name and widths of
decode; you may add or change helper functions. - Return a vector for every block.
- A control character in the result always has its flag set.
- Off limits: the names
lib,rng,tb,rootand the modules of the bench.
Hints
Hint 1
Seven of the types are two halves of four characters each. How many kinds of half are there?
Hint 2
Which bits of a Terminate block hold nothing? What must the decoder do with them?
Hint 3
The Error code is valid in some blocks and not in others. Read the three classes C, S and T again.
What the grader checks: The fixture checks 32 literal blocks against an independent JavaScript model, and 12,000 random blocks against a private reference decoder. The PCS is taken to have no EEE, and no block carries O code Fh. Returning Error characters from decode is a course choice; block synchronisation, the descrambler and the receive state diagram are not graded.
35 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 2 steps and the final capstone