P11.20.1 Find the Frame Between Ordered Sets

MediumImplementIcarus Verilog · serverReview the topic

A gigabit fibre port hands you decoded code-groups: idles, /S/, data, /T/, /R/ and now and then garbage. Turn them into RX_DV, RX_ER and RXD for the MAC.

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 pcs_rx once per code-group. It passes the current code-group, the next two, and whether the current one is even-numbered.

Return the GMII signals for that octet time. Find the start, pass the data, find the end, and report every error the rules below name.

The streams are full duplex. They hold no configuration sets, no bursts and no carrier extension from the MAC. After the K28.5 of an idle, the next code-group is always data.

One rule is simplified. The standard tests for a carrier on the ten bits (36.2.5.1.4). Here any decoded code-group other than K28.5 or /S/ counts.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signatures (keep them)
int st;
function automatic void pcs_reset();
function automatic bit is_data(input [9:0] c);
function automatic [9:0] pcs_rx(input [9:0] c0, input [9:0] c1, input [9:0] c2, input bit even);   // {RX_DV, RX_ER, RXD}
WhereRule
Code-groups{invalid, k, d}. K28.5 = 1BCh, /S/ = 1FBh, /T/ = 1FDh, /R/ = 1F7h, /V/ = 1FEh. Data has invalid = 0 and k = 0
Between packetsAn odd code-group, or K28.5: nothing (RX_DV = 0, RX_ER = 0). /S/ on an even one: RX_DV = 1 with RXD = 55h, and a packet begins. Anything else on an even one: a false carrier begins (this problem's simplification)
False carrierRX_ER = 1 with RXD = 0Eh on every code-group, the first included. K28.5 on an even code-group ends it; that call returns nothing
In a packet: early endOn an even code-group: K28.5, then data, then K28.5. Return RX_DV = 1 and RX_ER = 1. The packet is over
In a packet: clean endOn an even code-group: /T/, /R/, K28.5. Return nothing
In a packet: end with carrier extend/T/, /R/, /R/ on any code-group. Return RX_ER = 1 with RXD = 0Fh
In a packet: otherwiseData: RX_DV = 1 with the octet. Anything else: RX_DV = 1 and RX_ER = 1, and the packet goes on
After a clean or carrier-extend endReturn nothing until a K28.5 arrives. That K28.5 is the first code-group of the idle
RXDChecked only when exactly one of RX_DV and RX_ER is 1

The rules are those of Figures 36-7a and 36-7b of IEEE Std 802.3-2022 for full-duplex streams, with the carrier test simplified. In a packet, test them in the order of the table.

No false carrier in the streams starts with a data octet that is one bit from K28.5 on the line. So an answer that follows the ten-bit test passes too.

Examples

Example 1

A 64-octet Frame
Input
idle, /S/, preamble, 64 octets, /T/R/, idle
Output
calls_differing_from_a_correct_receiver = 0, data_octets = 72, rx_er_inside_a_packet = 0, carrier_extend = 0, false_carrier = 0, packets_started = 1

The MAC gets 72 octets: eight of preamble and SFD, with 55h in place of /S/, then the frame. /T/ and /R/ do not reach it.

Example 2

A 65-octet Frame
Input
the same with 65 octets
Output
calls_differing_from_a_correct_receiver = 0, data_octets = 73, rx_er_inside_a_packet = 0, carrier_extend = 1, false_carrier = 0, packets_started = 1

The end is /T/R/R/. The MAC gets 73 octets and then one octet time of carrier extend.

Example 3

An Error Inside
Input
a 64-octet frame with one /V/
Output
calls_differing_from_a_correct_receiver = 0, data_octets = 71, rx_er_inside_a_packet = 1, carrier_extend = 0, false_carrier = 0, packets_started = 1

The /V/ gives one octet time with RX_DV and RX_ER. The other 71 octets pass.

Constraints and Contract

  • Keep the names and widths; you may add variables.
  • One result per call; the bench gives the two code-groups ahead, so do not delay the output.
  • Compare all ten bits of a code-group: data may hold the octets BCh, FDh and F7h.
  • Off limits: the names lib, rng, tb, root and the modules of the bench.

Hints

Hint 1

Which code-groups of a clean end reach the MAC as data? Count the data octets of the first sample.

Hint 2

Why does the bench tell you whether the code-group is even-numbered? Look for an end that starts on an odd one.

Hint 3

After /T/R/R/, which state must the two /R/ not reach?

What the grader checks: The fixture checks 13 literal streams against an independent JavaScript model, and compares every call with a private reference receiver. It also checks 120 random streams of 16 packets, call by call. Configuration ordered sets, carrier extension from the MAC, bursts and the extend-error path of Figure 36-7b are not in the streams. The code-groups arrive decoded and numbered; decoding and synchronisation 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 64-octet Frame

Input
idle, /S/, preamble, 64 octets, /T/R/, idle
Expected output
calls_differing_from_a_correct_receiver = 0, data_octets = 72, rx_er_inside_a_packet = 0, carrier_extend = 0, false_carrier = 0, packets_started = 1

The MAC gets 72 octets: eight of preamble and SFD, with 55h in place of /S/, then the frame. /T/ and /R/ do not reach it.

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

Icarus Verilog · server