P11.23.3 Hold the FIFO Level with Idle

MediumImplementIcarus Verilog · serverReview the topic

Two clocks are never equal, so a FIFO between them slowly fills or drains. Decide, column by column, where idle may go and where it may be added.

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 comp_col once for every XGMII column that arrives. It also hands you the FIFO level. Return what to do with the column.

At a high level, delete the column if the rules allow it. At a low level, add one idle column after it if the rules allow that.

The standard gives these rules. Idle moves in groups of four. It may be added following idle or an ordered set, and never while data is received.

The first four characters after a Terminate are not deleted. Of two consecutive sequence ordered sets one may be deleted, and only one. A signal ordered set is not deleted.

Adding and deleting are allowed, not required. A real design may choose otherwise within those rules. This problem fixes one behaviour so that answers can be compared.

So these are course choices: whole columns, the two level marks and one action per column. That the second of two sets goes is one too.

Three more are course readings. A set pairs only with a set just before it that stayed. Idle follows a column whose lane 3 is idle. Added idle columns are not remembered.

This PCS has no EEE, so no column holds low power idle.

The lesson's eth_66_comp marks columns for a bench that deletes every column it is offered. It is not this answer: here the level decides, and the rule for adding idle is wider.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signatures (keep them)
function automatic void comp_reset();
function automatic [1:0] comp_col(input [3:0] c, input [31:0] d, input int level);
// returns 0 keep the column, 1 delete it, 2 keep it and add one idle column after it
ItemRuleFrom
Columnlane k is the flag c[k] and the octet d[8k+7:8k]. Lane 0 comes firstthe bench
Idle columnfour idle characters: every flag 1, every octet 07h49.2.4.7: groups of four
Sequence ordered setflags 0001 and octet 9Ch in lane 049.2.4.10
Signal ordered setflags 0001 and octet 5Ch in lane 0. The standard reserves it. An Ethernet receiver takes O code Fh as invalid, so this column is here only to grade the rule49.2.4.10; 49.2.4.6 d)
May be deleted: idlean idle column, unless the column before it held a Terminate49.2.4.7: the first four characters after a Terminate stay
May be deleted: a seta sequence ordered set, if the column before it was a sequence ordered set that stayed. A set that got idle added after it stayed49.2.4.10 says only: one of two consecutive sets, and only one. Course choices: the second one goes, and it pairs only with a set that stayed
Never deleteda signal ordered set, and any column that is not one of the two above49.2.4.10, 49.2.4.7
Idle may be added aftera column whose lane 3 holds an idle character, and after an ordered set of either kind49.2.4.7 says only: following idle or ordered sets, not while data is received. The lane 3 test is a course reading
Memorythe rules look at the received column before this one. An idle column you added does not countcourse choice
levelcolumns waiting in the FIFO when this column arrives, 0 to 8course choice
level 6 or morereturn 1 if the column may be deleted, else 0course choice
level 2 or lessreturn 2 if idle may be added after the column, else 0course choice
level 3 to 5return 0course choice
comp_reset()forget the columns seen so far. The bench may send a column before it calls thisthe bench

Whole columns keep a Start in lane 0. With whole columns, the column after a Terminate always holds some of its four characters, so it stays.

A Terminate is the character FDh with its flag set. A data octet FDh is not one.

Three sets in a row at a high level lose the second one only. The third follows a deleted set, so it stays.

Clause 4 says the gap can shrink to 40 bit times at the receive XGMII (4.4.2, NOTE 4). That is the Terminate and four characters.

Examples

Example 1

An Idle Gap at a High Level
Input
Start, data, Terminate in lane 1, four idle columns, Start; level 6 throughout
Output
deleted_columns = 'b0000000000000000000000000000000001110000, columns_with_idle_added_after_them = 'b0000000000000000000000000000000000000000

The idle column after the Terminate stays. The three idle columns behind it may go, and at level 6 they do. Nothing else is touched.

Example 2

Three Fault Sets at a High Level
Input
idle, three local fault sets, idle; level 7 throughout
Output
deleted_columns = 'b0000000000000000000000000000000000010101, columns_with_idle_added_after_them = 'b0000000000000000000000000000000000000000

Both idle columns go. Of the three sets only the second goes: the third follows a deleted set.

Example 3

A Low Level Around a Frame
Input
data, Terminate in lane 0, idle, Start; level 1 throughout
Output
deleted_columns = 'b0000000000000000000000000000000000000000, columns_with_idle_added_after_them = 'b0000000000000000000000000000000000000110

The Terminate column ends in idle, so idle is added after it. The idle column gets one too. Data and Start get none.

Constraints and Contract

  • Keep the two function names and their arguments.
  • Keep your state in module-level variables, and clear it in comp_reset().
  • Return 0, 1 or 2 for every column. The bench applies the action; you do not build the output stream.
  • Off limits: the names rng, tb, root, names that begin with fx_ and the modules of the bench.

Hints

Hint 1

What must you remember from the column before this one? There are two facts, and each needs one bit.

Hint 2

A set that could have been deleted, but was kept because the level was fine, still counts as kept.

Hint 3

A Terminate in lane 1 leaves idle in lanes 2 and 3. May idle be added after that column?

What the grader checks: The fixture checks 37 scripted runs against an independent JavaScript model and 10,120 more columns against a private model. A full check draws other columns and levels each time. Whole columns, the two level marks, the pairing of sets and the lane 3 test are course choices. Low power idle, the FIFO itself and the 40 Gb/s rule (groups of eight, 82.2.3.6) are not graded.

41 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

An Idle Gap at a High Level

Input
Start, data, Terminate in lane 1, four idle columns, Start; level 6 throughout
Expected output
deleted_columns = 'b0000000000000000000000000000000001110000, columns_with_idle_added_after_them = 'b0000000000000000000000000000000000000000

The idle column after the Terminate stays. The three idle columns behind it may go, and at level 6 they do. Nothing else is touched.

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

Icarus Verilog · server