A 10 Gb/s port sleeps when it has nothing to send. Now and then the first frame after a sleep is lost. Find the two wrong 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 design below is the transmit side of an Energy-Efficient Ethernet port: the RS and the LPI part of the PCS.
While the LPI client asks for Low Power Idle, the RS sends LPI on the XGMII and holds the MAC back.
The PCS then signals sleep, switches its transmitter off, and wakes it for a short refresh now and then.
When the request ends, the PCS wakes the link. The MAC must wait for the whole wake time before it starts a frame.
In the lab, frames that arrive in the quiet time start far too early. A frame that arrives during a refresh starts at once.
Fix the design so that its five outputs follow the two state diagrams in every tick. Two lines are wrong.
This design is a model. Time is counted in ticks, and the bench sets the length of each timer in ticks.
The lesson has both state diagrams as tables. Its readable library holds the XGMII columns only.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic void lpi_reset(input int tsl, input int tql, input int twl, input int t1u, input int tw_sys, input bit bypass);
function automatic void lpi_tick(input bit lpi_request); // one tick
| Item | Rule |
|---|---|
lpi_request | LP_IDLE.request is ASSERT. The RS sends LPI on the XGMII in exactly these ticks, and Idle or frames in the others (46.3.1.5, 46.4) |
| RS states | Figure 46-13. LPI_DEASSERTED goes to LPI_ASSERTED when the request comes. LPI_ASSERTED goes to LPI_WAIT when it ends. LPI_WAIT goes to LPI_DEASSERTED when its timer ends |
| LPI_WAIT | has one way out: its timer of tw_sys ticks. A new request during the wait changes neither the state nor the timer |
carrier | 1 in LPI_ASSERTED and in LPI_WAIT. The MAC may start a frame only when it is 0 |
| PCS input | a course choice of the model. The PCS finds an LPI block in every tick in which the RS sends LPI. It finds none in the others |
| TX_ACTIVE | tx_mode DATA. An LPI block leads to TX_SLEEP |
| TX_SLEEP | timer tsl. A tick without an LPI block leads back to TX_ACTIVE at once. If the timer ends first, TX_QUIET follows |
| TX_QUIET | tx_mode QUIET, timer tql. It ends when the timer ends or when a tick has no LPI block. TX_ALERT follows |
| TX_ALERT | tx_mode ALERT, timer t1u. Only the timer ends it. TX_WAKE follows |
| TX_WAKE | tx_mode DATA, timer twl. Only the timer ends it. Then TX_SCR_BYPASS follows if bypass is 1. If not, TX_SLEEP follows after an LPI block and TX_ACTIVE without one |
| TX_SCR_BYPASS | scrambler_bypass is 1, timer t1u. Only the timer ends it. Then TX_SLEEP follows after an LPI block and TX_ACTIVE without one. scrambler_bypass is 0 in every other state |
| Timers | a course choice of the model. A state with a timer of N ticks lasts N calls, the call that enters it included. The call after them makes the transition. LPI_WAIT counts the same way |
| No time | transitions take no time (1.2.1, 21.5.1). So the call that ends LPI_WAIT may end in LPI_ASSERTED |
| Order in one call | a course choice: the RS first, then the PCS with the request of this call |
| The tests | every timer is 1 to 18,000 ticks. For 10GBASE-KR a tick is 0.1 µs: tsl 50, tql 17,500, twl 110, t1u 12 (Table 49-2) and tw_sys 154 (Table 78-4) |
Random tests compare the five outputs with a private model after every tick.
Examples
Example 1
A Sleep of 1,000 Ticks- Input
`fx_lpi(50, 300, 110, 12, 154, 0, 1000, 200)`
- Output
carrier = 0, scrambler_bypass = 0, tx_mode = DATA (0), pcs_state = TX_ACTIVE (0), rs_state = LPI_DEASSERTED (0), ticks_with_tx_mode_quiet = 606, ticks_with_carrier = 1154, times_tx_alert_was_entered = 3, check_of_every_tick = 0x41cb49a
The PCS signals sleep for 50 ticks and is quiet for 300. A refresh is 12 + 110 + 50 ticks. The request ends in the third quiet time, so TX_ALERT is entered a third time. The carrier is held for 1,000 + 154 ticks.
Example 2
The Timer Values of 10GBASE-KR- Input
`fx_lpi(50, 17500, 110, 12, 154, 0, 17650, 300)`
- Output
carrier = 0, scrambler_bypass = 0, tx_mode = DATA (0), pcs_state = TX_ACTIVE (0), rs_state = LPI_DEASSERTED (0), ticks_with_tx_mode_quiet = 17500, ticks_with_carrier = 17804, times_tx_alert_was_entered = 1, check_of_every_tick = 0x6d32efc
One tick is 0.1 µs. The quiet time is 1.75 ms. The request ends 88 ticks into the wake of the first refresh. TX_WAKE runs its 110 ticks, and the carrier is held for 154 ticks from the end of the request.
Example 3
With the Scrambler Bypass- Input
`fx_lpi(50, 300, 110, 12, 154, 1, 1000, 200)`
- Output
carrier = 0, scrambler_bypass = 0, tx_mode = DATA (0), pcs_state = TX_ACTIVE (0), rs_state = LPI_DEASSERTED (0), ticks_with_tx_mode_quiet = 600, ticks_with_carrier = 1154, times_tx_alert_was_entered = 2, check_of_every_tick = 0x1543db2
Each wake is followed by 12 ticks of TX_SCR_BYPASS. So a refresh is 12 ticks longer, and the request ends in the sleep signal after the second refresh.
Constraints and Contract
- Keep
lpi_resetandlpi_tickwith their arguments. - Keep the names
rs_state,carrier,pcs_state,tx_modeandscrambler_bypasswith their codes: the fixture reads them. lpi_resetmust clear all state.- The fix touches two lines.
- Off limits: the names
ref_l,rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Who knows how long the link partner needs? Not the PCS of this port.
Hint 2
In LPI_WAIT, which signal does the design test? Which one does Figure 46-13 test?
Hint 3
In the PCS, compare each timed state with its row above. Which states may end before their timer?
What the grader checks: A JavaScript model gives the expected values of the 30 scripted tests. Each folds the five outputs after every tick into a check value. Six more tests compare the outputs with a private model after every tick, on random runs seeded for each submission. The private model is written in another way than the solution, and it agrees with the JavaScript model on random scripts. This design is a model in ticks. The timer lengths come from the bench, and a state with a timer of N ticks lasts N calls. The PCS sees an LPI block in every tick of the request. A real PCS sees one block in 6.4 ns. The receive side, the PMD and the link partner are not graded. Nor is the content of the wake signal or the LLDP exchange that can lengthen the wake time.
36 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