P11.26.2 Deal the Blocks and Insert the Markers

MediumImplementIcarus Verilog · serverReview the topic

A 40 or 100 gigabit PCS shares one stream out over its lanes and labels every lane. Build that step of the transmitter.

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 tx_start once. Then it calls tx_block for every encoded block of the stream, in order.

Scramble each block with scramble. Then send it on its lane with lane_put. The lanes take turns, from lane 0 up (82.2.6).

After every gap blocks of a lane, every lane sends its alignment marker (82.2.7). All lanes hold it in the same place.

In this course every lane also starts with its marker, before its first block. That is a course choice: Figure 82-7 draws blocks first.

A marker is not scrambled. Build it from am_m, with the parity of the lane in BIP3 and its inverse in BIP7.

P11.26.1 graded the parity of a block. Here bip_of gives it to you, or you may paste your own answer.

The standard's gap is 16,383 blocks. Here the gap is an argument, a bench choice that keeps the tests short.

The standard's 16,383 is not run, to keep the judging time down. The longest hidden run has a gap of 4,097.

Where does the room for a marker come from? If needed, the PCS deletes interpacket gap from the XLGMII or CGMII stream (82.2.7).

That deletion is not graded. The bench never sends more blocks than the lanes can carry.

The lesson's eth_am is readable, and you may copy its marker layout. Its eth_mld_lanes deals no stream.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signatures (keep them) and what the bench gives you
function automatic void tx_start(input int lanes, input int gap);
function automatic void tx_block(input [65:0] blk);

function automatic [65:0] scramble(input [65:0] blk);            // given: the PCS scrambler, with its own state
function automatic [23:0] am_m(input int lane);                  // given: {M2, M1, M0} of that lane
function automatic [7:0]  bip_of(input [65:0] b);                // given: what one sent block adds to the parity
function automatic void   lane_put(input int lane, input [65:0] b);   // given: the next block of that lane
ItemRuleFrom
Scramblingevery block of the stream passes scramble once, in the order it arrives, before it is dealt82.2.5, 82.2.6
Dealingwhole blocks, round robin from the lowest lane. The first block of a run goes to lane 082.2.6
lanes4 for 40GBASE-R or 20 for 100GBASE-R. No other value is sent82.2.6
Marker spacingeach lane sends its marker after every gap blocks. gap is 1 or more82.2.7 has 16,383; the argument is a bench choice
All lanes togetherevery lane holds its marker in the same place of its own sequence82.2.7
Start of a runevery lane sends its marker before its first blocka course choice: the standard does not place the first marker
Marker bitsbits 1:0 are 2'b01, the control sync header. M0 to M2 in 25:2, BIP3 in 33:26, M4 to M6 in 57:34, BIP7 in 65:58Figure 82-9
M0 to M2am_m(lane), with M0 in its lowest octetTables 82-2 and 82-3
M4 to M6 and BIP7M0 to M2 and BIP3 with every bit inverted82.2.7
BIP3the parity of the lane from its previous marker, with that marker as sent, up to the block before this marker82.2.8
Parity at the startzero. So the first BIP3 of every lane is 00ha course choice, as in P11.26.1
Markers and the scramblera marker never passes scramble82.2.7
Order of the callsfree between lanes. Only the order of the blocks on each lane is judgedthe bench

You may send a marker as soon as it is due, or later. It must only come before the next block of its lane.

The scrambler state belongs to the bench, and it starts each run in a state the bench picks. So call scramble: a scrambler of your own would start elsewhere.

tx_start begins a new run. Nothing of the run before may be left over.

Examples

Example 1

A Data Block on Lane 1
Input
4 lanes, a marker after every 3 blocks, 16 data blocks. Lane 1, place 2
Output
stream_blocks_on_the_lane = 4, is_the_lanes_marker = no, stream_block = 5, bip3 = 0x0, bip7 = 0x0, lanes_with_their_marker_in_that_place = 0, wrong_or_missing_blocks = 0

Lane 1 starts with its marker. Then it holds stream blocks 1, 5 and 9, so place 2 holds block 5, scrambled. The second marker row is due after block 11, before block 12 reaches its lane.

Example 2

The Second Marker of Lane 2
Input
the same run. Lane 2, place 4
Output
stream_blocks_on_the_lane = 4, is_the_lanes_marker = yes, stream_block = 65535, bip3 = 0x19, bip7 = 0xe6, lanes_with_their_marker_in_that_place = 4, wrong_or_missing_blocks = 0

Places 1 to 3 hold three blocks, so place 4 is the marker again, on all four lanes. Its BIP3 covers the first marker and those three blocks.

Example 3

Twenty Lanes
Input
20 lanes, a marker after every 2 blocks, 60 data blocks. Lane 7, place 3
Output
stream_blocks_on_the_lane = 3, is_the_lanes_marker = yes, stream_block = 65535, bip3 = 0x3b, bip7 = 0xc4, lanes_with_their_marker_in_that_place = 20, wrong_or_missing_blocks = 0

Lane 7 holds its marker, blocks 7 and 27, its marker and block 47. All 20 lanes hold a marker in place 3.

Constraints and Contract

  • Keep the names and the arguments of tx_start and tx_block.
  • Call scramble once for every block of the stream, and never for a marker.
  • Do not fix the gap or the lane count: the fixture changes both from run to run.
  • Off limits: the names rng, tb, root, names that begin with fx_ and the modules of the bench.

Hints

Hint 1

Which two counts tell you where the next block goes, and whether markers are due first?

Hint 2

A lane's parity changes with every block that lane sends. That includes its own markers.

Hint 3

What would the far end see if a marker went through the scrambler? And what would happen to the blocks after it?

What the grader checks: The fixture checks 15 scripted runs against an independent JavaScript model. It checks 81 random runs, block by block, against a private check by place. One run has a gap of 4,097 blocks and the others use short gaps. The gap is a bench choice, and the standard's 16,383 is not run. The start with a marker row and the zero parity at the start are course choices. Idle deletion, the encoder, the scrambler itself and the parity of one block are not graded here.

18 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

A Data Block on Lane 1

Input
4 lanes, a marker after every 3 blocks, 16 data blocks. Lane 1, place 2
Expected output
stream_blocks_on_the_lane = 4, is_the_lanes_marker = no, stream_block = 5, bip3 = 0x0, bip7 = 0x0, lanes_with_their_marker_in_that_place = 0, wrong_or_missing_blocks = 0

Lane 1 starts with its marker. Then it holds stream blocks 1, 5 and 9, so place 2 holds block 5, scrambled. The second marker row is due after block 11, before block 12 reaches its lane.

Run samples executes all 3 public checks. Check all tests runs 18 checks on the server.

Icarus Verilog · server