A Clause 45 driver skips address frames it thinks it does not need. One status read comes back as xxxx. Find the first bad frame and the cause.
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 driver reads PHY registers over Clause 45 MDIO. To save frames, it remembers what it last left in each address register and skips address frames it does not need.
The log says: ERROR: PCS status 1 (3.1) read xxxx, expected 0004. Later reads go wrong too.
Step 1: find the first frame slot where a signal differs from a correct driver, and name the signal. Step 2: choose the cause from five bugs. Each is a real bug; two of them first fail at the same slot.
Step 3 is optional: fix the driver and run the tests.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic void c45_reset();
function automatic void c45_job(input bit write, input int device, input int address, input int count, input [15:0] value);
function automatic [30:0] c45_tick(); // {valid, st, op, prtad, devad, data}
function automatic void c45_resp(input logic [15:0] v);
| Rule | Correct driver |
|---|---|
| ST | 00 on every Clause 45 frame |
| Address frame | OP 00, data = the register address; sent only when the MMD's address register may not hold it |
| One register | OP 11 (read) or 01 (write); the address register does not change |
| Several registers | OP 10 (post-read-increment) for each; the MMD adds 1 after each, but never past 65535 |
| Memory | one remembered address per MMD; -1 when unknown |
| Frame slot | one frame per slot; the slot counter is cycle |
The bench MMDs are 1 (PMA/PMD), 3 (PCS) and 7 (auto-negotiation) at port address 0. A slot is one whole management frame.
Diagnose the Failing Run
The test below runs the buggy design. Read its log, then find where it first goes wrong in the waveform.
Log
Waveform
Click a signal at a cycle to select it. Or focus the waveform and use the arrow keys: Left and Right move one cycle, Up and Down one signal.
Step 3 is optional: fix the code in the editor, then run the tests.
Examples
Example 1
Polling Two MMDs- Input
read 1.1 and 3.1 in turn
- Output
jobs_differing_from_a_correct_driver = 0, xor_of_values_read = 0x0, frames_sent = 8
Each MMD needs one address frame, the first time. After that, each poll is one read frame.
Example 2
The Top Address- Input
three reads from 65534, then 3.0
- Output
jobs_differing_from_a_correct_driver = 0, xor_of_values_read = 0x2040, frames_sent = 6
The address register stops at 65535. So 3.0 needs a fresh address frame.
Example 3
Writes Between Reads- Input
write and read 1.0, write 7.0
- Output
jobs_differing_from_a_correct_driver = 0, xor_of_values_read = 0x0, frames_sent = 6
A write to MMD 7 leaves MMD 1's address register alone.
Constraints and Contract
- Keep the four functions and their arguments.
- Send an address frame only when it is needed: the tests count frames.
- Port address 0 throughout.
- Off limits: the names
mmd,rng,tb,root, names that begin withref_and the modules of the bench.
Hints
Hint 1
Which frame did the driver send for the second job? What did that MMD's address register hold then?
Hint 2
An address register belongs to one MMD. Writing 3.x does not move 1.x.
Hint 3
Which job is the first to use an MMD other than the one before it?
What the grader checks: The failing run is simulated live with the faulty driver. The first bad slot and each option's symptom come from runs of each version on the same bench. The optional fix is checked on five fixed job lists against an independent JavaScript model. It is also checked on 600 random jobs against a private reference driver. The bench works one frame per slot; MDC bit timing is not modelled.
7 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