A MAC's RGMII receiver passes simulation of its own logic but every frame from the PHY arrives wrong. Find the two bad lines.
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 sends one GMII beat per RXC cycle on four data wires and one control wire, using both clock edges. It launches the data edge-aligned with RXC.
This bench models the timing: each value is unknown for 1.5 ns either side of every RXC edge. A receiver that samples near an edge reads x.
Fix the capture module so that, every cycle, rxd, rx_dv and rx_er equal the GMII beat the PHY sent. Two lines are wrong.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
module rgmii_rx (input logic rxc, input logic rx_ctl, input logic [3:0] rd,
output logic [7:0] rxd, output logic rx_dv, output logic rx_er);
| Rule (this problem) | Value |
|---|---|
| RXC | 125 MHz, period 8 ns; the cycle starts at a rising edge |
| After the rising edge | RD = RXD<3:0>, RX_CTL = RX_DV |
| After the falling edge | RD = RXD<7:4>, RX_CTL = RX_DV XOR RX_ER |
| Data timing | each value is valid from 1.5 ns to 2.5 ns after its edge, and x outside that |
| Sampling | sample both halves with RXC delayed by 2 ns |
| Outputs | the cycle's byte, RX_DV and RX_ER, valid 7 ns after its rising edge |
RGMII is not an IEEE 802.3 interface. The edge mapping and the code on the control wire follow RGMII Version 2.0 (sections 3.2 and 3.4). The timing numbers are this bench's, not a datasheet's.
Examples
Example 1
A Short Packet- Input
seven 55h, D5h, 20 frame octets
- Output
cycles_differing_from_sent = 0, xor_of_rxd_while_rx_dv = 0x36, sum_of_rxd_while_rx_dv = 0x602, rx_er_cycles = 0, rx_dv_cycles = 28
Every cycle's byte, RX_DV and RX_ER must equal what the PHY sent. The sum and XOR fold the bytes.
Example 2
Byte 3Ch- Input
one beat, data 3Ch
- Output
cycles_differing_from_sent = 0, xor_of_rxd_while_rx_dv = 0x3c, sum_of_rxd_while_rx_dv = 0x3c, rx_er_cycles = 0, rx_dv_cycles = 1
One byte with two different halves.
Example 3
RX_ER Inside a Packet- Input
RX_ER on beat 12
- Output
cycles_differing_from_sent = 0, xor_of_rxd_while_rx_dv = 0x36, sum_of_rxd_while_rx_dv = 0x602, rx_er_cycles = 1, rx_dv_cycles = 28
Exactly one cycle has RX_ER, and RX_DV stays high through it.
Constraints and Contract
- Keep the module name and ports.
- Keep the 2 ns delayed clock; the bench reads the outputs 7 ns after each rising edge.
- The fix touches two lines.
- Off limits: the names
lib,rng,tb,rootand the modules of the bench.
Hints
Hint 1
Which clock does each always block use? At what time after the edge does each one sample?
Hint 2
Which half of the byte arrives first?
Hint 3
Run the sample with data 3Ch: a swapped byte reads C3h.
What the grader checks: The fixture checks ten literal sequences against an independent JavaScript model and 800 random cycles against the beats the bench sent. Its timing is a bench model, not a datasheet: values are valid only from 1.5 to 2.5 ns after each edge. It tests 1000 Mb/s only, not the 10 and 100 Mb/s modes.
12 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