A 10 Gb/s PCS gets eight XGMII characters at a time. Turn each group into one 66-bit block: data, Start, Terminate or idle.
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 encode once for each group of eight characters. Return the 66-bit block for it, with bit 0 the first bit sent.
The starter already builds the idle block and the error block. Add the data block, the two Start blocks and the eight Terminate blocks.
If the eight characters fit no format, return the error block. That is a control block of type 1Eh with C code 1Eh in all eight places.
Two things are this problem's scope, not the standard's. No group holds an ordered set or one of the six reserved control characters. And the PCS has no EEE, so low power idle fits no format.
One thing is a course choice. In the standard the transmit state diagram swaps in the error block (P11.23). Here encode does it.
P11.17 already showed which control pattern gives which block type. What is graded here is the bit layout and the rules for a group that fits no format.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic [65:0] encode(input [71:0] raw);
| Item | Rule |
|---|---|
raw | bit k is the control flag of character k (k = 0 to 7). Bits 8+8k to 15+8k are its octet |
| Characters | data: flag 0. Idle 07h, Error FEh, Start FBh, Terminate FDh, low power idle 06h: flag 1 |
| Block | bits 1:0 the sync header, bits 9:2 the block type field, bits 65:10 the rest. Bit 0 is sent first |
| Sync header | 01 for a data block, 10 for a control block, written first bit first |
| Data block | eight data octets in bits 65:2, character 0 lowest. No type field |
| Type 1Eh | eight idles. Eight 7-bit C codes: code k in bits 10+7k to 16+7k |
| Type 78h | Start in character 0, then seven data octets in bits 65:10 |
| Type 33h | Four idle or Error characters as C codes 0 to 3. Then four zero bits. Start is character 4. Octets 5 to 7 sit in bits 65:42 |
| Terminate in character k | types 87h, 99h, AAh, B4h, CCh, D2h, E1h, FFh for k = 0 to 7. Characters before it are data: octet j in bits 10+8j to 17+8j. Characters after it are idle or Error: C code j in bits 10+7j to 16+7j. All other bits are 0 |
| C codes | idle 00h, Error 1Eh |
| Eight control characters with an Error | no format: the transmit rules class this group as an error (49.2.13.2.3) |
| Anything else | the error block |
The formats are those of Figure 49-7 of IEEE Std 802.3-2022. The same code serves 25GBASE-R (107.2).
An encoder that also handles ordered sets and reserved characters as the standard says passes too. None is in the tests.
Examples
Example 1
Start in Character 0- Input
Start, 55h six times, D5h
- Output
sync_bit_sent_first = 'b1, sync_bit_sent_second = 'b0, block_type_field = 0x78, payload_bits_65_to_10 = 0xd5555555555555
A control block of type 78h. The Start needs no bits of its own. The seven octets fill the payload.
Example 2
Terminate in Character 3- Input
A1h, B2h, C3h, Terminate, four idles
- Output
sync_bit_sent_first = 'b1, sync_bit_sent_second = 'b0, block_type_field = 0xb4, payload_bits_65_to_10 = 0xc3b2a1
Type B4h. Three octets come first. Four bits stay 0, and four idle codes of 00h fill the end.
Example 3
Eight Data Octets- Input
01h to 08h
- Output
sync_bit_sent_first = 'b0, sync_bit_sent_second = 'b1, block_type_field = 0x1, payload_bits_65_to_10 = 0x8070605040302
The sync header is 01, first bit first. There is no type field: the first octet sits where a type would be.
Constraints and Contract
- Keep the name and widths of
encode; you may add or change helper functions. - Return a block for every input. Bits that hold no field must be 0.
- Look at the control flags: a data octet may have the value FBh or FDh.
- Off limits: the names
lib,rng,tb,rootand the modules of the bench.
Hints
Hint 1
The standard writes the data sync header as 01, first bit first. Which bit of your vector is sent first?
Hint 2
Count the bits of a Terminate block with three octets and four C codes. How many are left over, and where?
Hint 3
When is a Start legal? Check what comes before it and what comes after it.
What the grader checks: The fixture checks 30 literal groups against an independent JavaScript model, and 6,000 random groups against a private reference encoder. Ordered sets and the six reserved control characters are never in a group, and the PCS is taken to have no EEE. Returning the error block from encode is a course choice; the transmit state diagram, the scrambler and the gearbox are not graded.
32 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