Turn the GMII receive signals into frames: find the SFD, keep the frame octets, and report errors and false carrier.
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 PHY drives RX_DV, RX_ER and RXD<7:0> on every RX_CLK. Write gmii_rx, the receive side of the Reconciliation Sublayer.
While RX_DV is high it receives a packet: some preamble, the SFD, then the frame. Keep only the frame octets. When RX_DV falls, report how the packet went.
While RX_DV is low, watch for the false carrier code.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
bit [7:0] frame [0:2047]; // frame octets after the SFD
int n; // how many
function automatic void rx_reset();
function automatic [3:0] gmii_rx(input bit dv, input bit er, input [7:0] d); // {false_carrier, done, status[1:0]}
| Rule | Value |
|---|---|
| Preamble | any number of 55h octets, zero or more, before the SFD: RX_DV may rise late |
| SFD | D5h. The octets after it, while RX_DV stays high, are the frame |
| No SFD | a value other than 55h or D5h before the SFD: drop the rest of this RX_DV period |
| done | 1 on the first clock with RX_DV low after RX_DV was high; 0 otherwise |
| status | with done: 2 if no SFD was found; else 1 if RX_ER was high on any clock with RX_DV high; else 0 |
| RX_ER in the preamble | this RS's rule: it marks the packet too. 22.2.1.5 speaks of frame reception, and 35.2.2.9 of the data octets |
| false_carrier | 1 on any clock with RX_DV low, RX_ER high and RXD = 0Eh, the done clock included |
| frame, n | after done, the frame octets in order and their count; n is 0 when no SFD was found |
Examples
Example 1
Full Preamble- Input
seven 55h, D5h, then 20 octets
- Output
frame_octets = 20, xor_of_frame_octets = 0x40, status = good (0), done_pulses = 1, false_carrier_beats = 0
The 20 octets after the SFD are the frame. One done, status 0.
Example 2
RX_DV Rises Late- Input
three 55h, D5h, then 20 octets
- Output
frame_octets = 20, xor_of_frame_octets = 0x40, status = good (0), done_pulses = 1, false_carrier_beats = 0
The PHY raised RX_DV inside the preamble. The frame is the same.
Example 3
RX_ER Inside the Frame- Input
RX_ER high on one frame clock
- Output
frame_octets = 20, xor_of_frame_octets = 0x40, status = RX_ER seen (1), done_pulses = 1, false_carrier_beats = 0
The octets still arrive, but the status says the PHY saw an error.
Constraints and Contract
- Keep the names and arguments; you may add your own variables.
- rx_reset is called before each test.
- Do not check the FCS: the MAC does that.
- Off limits: the names
rx_model,lib,fold_model,rng,tb,rootand the modules of the bench.
Hints
Hint 1
Which octets belong to the frame: does the SFD?
Hint 2
Does RX_ER on a preamble clock count?
Hint 3
Which other codes may RXD carry with RX_ER high and RX_DV low?
What the grader checks: The fixture checks 15 literal packets against an independent JavaScript model. It checks 300 random packets against a private bench receiver on every clock. It does not check the FCS, carrier extension inside a burst, or the MII.
17 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 1 steps and the final capstone