P11.26.1 Compute BIP3

MediumImplementIcarus Verilog · serverReview the topic

Every alignment marker carries a parity byte for its lane. Build the transmit side: keep the parity and fill both BIP fields.

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 lane_block once for every 66-bit block of one PCS lane, in the order the lane sends them.

Return each block as it is. At a marker, first write the parity into BIP3 and its inverse into BIP7.

The parity covers the lane from the previous marker on. That marker is included, as it was sent. The marker you are filling is not.

Two things are course choices, not the standard's. is_am tells you where the markers are, so the bench can use short gaps. And the parity is zero when the lane starts.

In the standard a lane carries 16,383 blocks between two markers. One hidden test uses that gap.

The lesson's library, eth_am and eth_mld_lanes, is readable and holds no parity code. The parity is what this problem grades.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signature (keep it)
function automatic [65:0] lane_block(input bit restart, input [65:0] blk, input bit is_am);
ItemRule
restart = 1the lane starts over with a parity of zero. A course choice: the standard names no first value. blk and the result are ignored
Block bitsbit 0 is sent first. Bits 1:0 are the sync header. Eight octets follow, the first in bits 9:2, each with its lowest bit first
BIP3 bit j, for j = 0 to 7the even parity of bit j of every octet: block bits 2 + j, 10 + j, and so on up to 58 + j
The sync headerblock bit 0 also belongs to BIP3 bit 3, and block bit 1 to BIP3 bit 4
What is coveredevery block from the previous marker, with that marker, up to the block before this marker
BIP3 fieldbits 33:26 of the marker. Bit 26 is BIP3 bit 0
BIP7 fieldbits 65:58 of the marker: BIP3 with every bit inverted
is_am = 0return blk unchanged

These are the rules of 82.2.8, Table 82-4 and Figure 82-9 of IEEE Std 802.3-2022.

The fixture starts every run with one call that has restart = 1. Test blocks with a single bit set are the bench's: no encoder makes them.

Examples

Example 1

A Marker, Three Idle Blocks, a Marker
Input
PCS lane 0: its marker, 3 idle blocks, its marker
Output
bip3_of_the_last_marker = 0x1e, bip7_of_the_last_marker = 0xe1, bip3_of_the_marker_before = 0x0, markers = 2, other_bits_unchanged = yes

The first marker follows the restart, so its BIP3 is 00h and its BIP7 is FFh. The second BIP3 covers that marker as sent and the three idle blocks.

Example 2

The Two Sync Header Bits
Input
PCS lane 1: its marker, a block with only bit 0 set, a block with only bit 1 set, its marker
Output
bip3_of_the_last_marker = 0x10, bip7_of_the_last_marker = 0xef, bip3_of_the_marker_before = 0x0, markers = 2, other_bits_unchanged = yes

The two test blocks add one to BIP3 bit 3 and one to BIP3 bit 4. The first marker adds the rest.

Example 3

Three Markers
Input
PCS lane 2: its marker, 5 data blocks, its marker, 5 data blocks, its marker
Output
bip3_of_the_last_marker = 0x60, bip7_of_the_last_marker = 0x9f, bip3_of_the_marker_before = 0x30, markers = 3, other_bits_unchanged = yes

The third BIP3 starts from the second marker. That marker is counted with the BIP3 and BIP7 it was sent with.

Constraints and Contract

  • Keep the name and the arguments of lane_block.
  • Keep the parity in a module-level variable. restart must clear it.
  • Do not count blocks to find the markers. Use is_am: the fixture changes the gap from run to run.
  • Off limits: the names lib, rng, tb, root, names that begin with fx_ and the modules of the bench.

Hints

Hint 1

What does one block add to the parity? Write that as a function of the block alone.

Hint 2

The first marker after a restart has a BIP3 of 00h. What is in the parity right after it?

Hint 3

Is the previous marker counted with empty BIP fields, or as it was sent?

What the grader checks: The fixture checks 12 scripted lanes and 121 random lanes against an independent JavaScript model. One of them has the standard's gap of 16,383 blocks; the others use shorter gaps, a bench choice. Marker insertion, block distribution and the receive-side comparison are not graded.

15 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 Marker, Three Idle Blocks, a Marker

Input
PCS lane 0: its marker, 3 idle blocks, its marker
Expected output
bip3_of_the_last_marker = 0x1e, bip7_of_the_last_marker = 0xe1, bip3_of_the_marker_before = 0x0, markers = 2, other_bits_unchanged = yes

The first marker follows the restart, so its BIP3 is 00h and its BIP7 is FFh. The second BIP3 covers that marker as sent and the three idle blocks.

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

Icarus Verilog · server