P11.25.2 Build the Pseudo-Random Test Pattern

MediumImplementIcarus Verilog · serverReview the topic

A receiver test needs a pattern that both ends can make. Build the pseudo-random test pattern of a 10 Gb/s PCS, and the checker that counts its errors.

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.

This problem has two halves. pr_tx_block makes the next block of the pattern. pr_rx_block checks one received block.

The fixture grades them apart. Your checker gets blocks from the fixture's own generator, never from yours.

The pattern is a fixed data pattern sent through the scrambler. Every 128 blocks the scrambler is loaded with a seed.

The checker does not know the seeds. It descrambles as in normal reception and looks for the data pattern or its inverse.

So each seed load breaks one block at the checker. The checker counts in windows of 128 blocks to leave that one out.

You need the scrambler and the descrambler of P11.24. You may copy them from the lesson's eth_66_scr: this problem does not grade them alone.

Six things are course choices, and the table marks them.

One is how a seed is loaded: this course puts seed bit k into stage Sk. The standard does not say (Table 52-20 writes the seeds as Seed[57:0]).

Another is the counter: here reading it does not clear it. The standard's register clears when it is read and holds at all ones.

The lesson shows this pattern and its checker as tables only. Their code is what this problem grades.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signatures (keep them)
function automatic void pr_tx_start(input [57:0] seed_a, input [57:0] seed_b, input bit zeros);
function automatic [65:0] pr_tx_block();
function automatic void pr_rx_start(input bit zeros, input [15:0] count);
function automatic bit pr_rx_block(input [65:0] blk);
function automatic [15:0] pr_rx_errors();
ItemRuleFrom
Blockbits 1:0 are the sync header, bits 65:2 the payload. Bit 0 is sent first, then bit 1, and so onthe bench
Scramblereach payload bit, from bit 2 up, goes through the scrambler of Figure 49-8. The sync header does not49.2.6
Sync headerthe control one in every block of the pattern: bit 0 is 1 and bit 1 is 049.2.8
Data patternzeros = 1: 64 zeros. zeros = 0: two local fault ordered sets, the payload 0100000001000055h49.2.8; the bit is 3.42.0 (45.2.3.19.8)
Seed loadat the start of a block, every 128 blocks: seed A, A inverted, B, B inverted, and round again49.2.8
After an inverted seedthe scrambler input is the inverse of the data pattern, for those 128 blocks49.2.8
Seed bitsseed bit k is loaded into stage Skcourse choice: 49.2.8 and 45.2.3.17 do not say
pr_tx_startstores the seeds and the pattern. The next block is the first of a round and loads seed Acourse choice
DescramblerFigure 49-10. It runs on from block to block, as in normal reception49.2.10, 49.2.12
Matchthe descrambled payload is the selected data pattern or its inverse. The sync header is not looked at49.2.12, 49.2.6, 49.2.10
Window128 blocks. The first window starts at the first block after pr_rx_start. Windows follow each other without gaps, and a mismatch never moves a window49.2.12; the start point and the fixed grid are course choices
First mismatch of a windowdoes not count49.2.12
Every later mismatch of that windowadds one to the counter. The fixture reads the counter after every block49.2.12
Counter16 bits. It stops at FFFFh and stays there49.2.14.2
pr_rx_start(zeros, count)selects the pattern, sets the counter to count and starts a new windowcourse choice: a real PCS starts at 0
pr_rx_errors()reads the counter and does not clear itcourse choice: a real PCS clears register 3.43 when it is read (49.2.14.2, 45.2.3.20)
pr_rx_blockreturns 1 for a block that does not match, counted or notthe bench

The fixture uses count to bring the counter close to FFFFh without 65,000 blocks.

The standard gives the descrambler no start value. pr_rx_start may clear your descrambler or leave it: both pass.

That works because the fixture breaks the stream at every pr_rx_start. The first block after it never matches.

Standard behaviour: the checker of 49.2.12 looks at blocks only while block lock is true. This fixture has no lock input, so every block counts.

The checker also sees streams that start anywhere in a round, lose blocks, or carry the other data pattern.

Examples

Example 1

The First Block
Input
seeds 0123456789ABCDEh and 2FEDCBA98765432h, zeros pattern, one block
Output
payload_of_the_last_block = 0xd7f3ffd9e7043e15, sync_header_of_the_last_block = 'b01, fold_of_all_blocks = 0x4ee

Seed A is loaded and 64 zeros go through the scrambler. The payload is what the seed alone makes of them.

Example 2

A Clean Round
Input
512 clean blocks into the checker
Output
error_counter = 0, blocks_with_a_mismatch = 4, first_block_that_moved_the_counter = 0, last_block_that_moved_the_counter = 0

Four seed loads break four blocks: 1, 129, 257 and 385. Each is the first mismatch of its window, so nothing is counted.

Example 3

One Line Bit Flipped
Input
256 blocks; bit 30 of block 201 is flipped on the line
Output
error_counter = 2, blocks_with_a_mismatch = 4, first_block_that_moved_the_counter = 201, last_block_that_moved_the_counter = 202

The descrambler turns one wrong bit into three. They fall into blocks 201 and 202, and the window has had its free mismatch.

Constraints and Contract

  • Keep the five function names and their arguments.
  • Keep your state in module-level variables.
  • The two halves must not share a register. In some tests the fixture runs both at once, on different streams.
  • Off limits: the names lib, src, rng, tb, root, names that begin with fx_ and the modules of the bench.

Hints

Hint 1

On a clean line one block of every window does not match. Why can the checker not avoid that?

Hint 2

Blocks 129 to 256 of a clean round look wrong unless the checker accepts a second payload. Which one?

Hint 3

A line error in the last block of a window spills into the next block. Which window owns that block?

What the grader checks: The fixture checks 10 generator runs and 40 scripted checker streams against an independent JavaScript model. It checks 6 more generator runs and 16 random checker streams against a private model. A full check draws other seeds and errors each time. The two halves are graded apart. Course choices: seed bit k to stage Sk, the start points, the fixed window grid and the loadable counter. So are no clear on read and the missing lock input. Block lock, the square wave, PRBS31 and the MDIO registers are not graded.

53 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 3 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

The First Block

Input
seeds 0123456789ABCDEh and 2FEDCBA98765432h, zeros pattern, one block
Expected output
payload_of_the_last_block = 0xd7f3ffd9e7043e15, sync_header_of_the_last_block = 'b01, fold_of_all_blocks = 0x4ee

Seed A is loaded and 64 zeros go through the scrambler. The payload is what the seed alone makes of them.

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

Icarus Verilog · server