BASE-R FEC makes room for its parity by sending one sync bit in place of two. Build the transcoder for both directions.
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 64B/66B block starts with two sync bits. They are always opposite, so one of them carries no information.
to65 drops the first sync bit. The transcode bit takes its place: the second sync bit, XORed with data bit 8 of the same block.
to66 undoes that. It works out the second sync bit, and makes the first one its inverse.
If bad is 1, the FEC block could not be corrected. to66 then sets both sync bits to 1, so the PCS sees an invalid block.
Two things are course choices. A block is a 66-bit vector whose bit 0 is sent first. And bad is an argument: which blocks of an FEC block get marked is not graded.
The lesson's readable eth_fec.sv holds the FEC lock only, and no transcoder. The two functions are what this problem grades.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic [64:0] to65(input [65:0] blk);
function automatic [65:0] to66(input [64:0] w, input bit bad);
| Item | Rule |
|---|---|
blk | a course choice of layout: bit 0 is sent first. Two sync bits, then 64 payload bits. Data bit 0 is the first payload bit |
w | the transcode bit first, then the same 64 payload bits in the same order |
| Transcode bit | the second sync bit XOR data bit 8 (74.7.4.2). The first sync bit is dropped, whatever its value |
| Back to 66 bits | XOR the transcode bit with data bit 8 again. The result is the second sync bit; the first is its inverse (74.7.4.5.1) |
bad = 1 | both sync bits are 1. The payload is passed on as it is |
| Payload | never changed, in either direction |
A valid PCS never sends the sync values 00 or 11. The fixture still sends them into to65.
It checks that you follow Figure 74-6 as written. The first sync bit is dropped, whatever it is (74.7.3). T is the second one XOR data bit 8.
Examples
Example 1
A Data Block- Input
sync bits 0 then 1; payload 0123456789abce55h
- Output
transcode_bit = 'b1, payload = 0x123456789abce55
The second sync bit is 1 and data bit 8 is 0. So the transcode bit is 1. The payload is untouched.
Example 2
A Control Block- Input
sync bits 1 then 0; payload fedcba9876543387h
- Output
transcode_bit = 'b1, payload = 0xfedcba9876543387
The second sync bit is 0 and data bit 8 is 1. So the transcode bit is 1 here too.
Example 3
Back to a Data Block- Input
the word of the first example, `bad` = 0
- Output
sync_bit_sent_first = 'b0, sync_bit_sent_second = 'b1, payload = 0x123456789abce55
The transcode bit is 1 and data bit 8 is 0, so the second sync bit is 1. The first is its inverse: 0.
Constraints and Contract
- Keep the names and the arguments of both functions.
- Both are pure functions: keep no state.
- Off limits: the names
lib,t65,t66,score,rng,tb,rootand the modules of the bench.
Hints
Hint 1
Number the 66 bits from 0. Which bit is the second sync bit? Which is data bit 8?
Hint 2
In the 65-bit word the payload starts one place earlier than in the block.
Hint 3
A data block has sync bits 0 then 1. A control block has 1 then 0.
What the grader checks: The fixture checks 11 fixed blocks and words against an independent JavaScript model, and 600 random ones against a private transcoder. Random blocks carry all four sync values. A valid block must come back unchanged from to66(to65(blk), 0). The vector layout and the bad argument are course choices. Which blocks of an FEC block are marked, the parity, PN-2112 and the FEC lock are not graded.
13 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