P11.21.2 Verify Auto-Negotiation

EasyVerifyIcarus Verilog · server16 hidden designsReview the topic

Write the checker that passes a correct Clause 37 auto-negotiation port and fails sixteen broken ones. It sees one received ordered set at a time.

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.

Two 1000BASE-X ports agree on a link by trading a 16-bit word. Each port walks through seven states; the seventh sends data.

Write a checker with three functions. For each ordered set the port receives, it is told the kind and the word.

It also sees what the port sends after that ordered set, and which word.

The fixture runs your checker on a correct port and on sixteen hidden broken ones. Each run has a few thousand ordered sets.

There are two runs, each with its own page, timer and partner words. Each goes to the correct port and to several broken ones.

Your checker must stay silent on the correct port and raise an alarm on every broken one.

Five things are choices of this problem, not the standard's. First, link_timer is counted in calls. The standard's is 10 ms and may run up to 20 ms.

Second, the port has no Next Pages. It uses the simpler exit that the NOTE under Figure 37-6 allows.

Third, restart stands for every condition that forces AN_ENABLE: power-on, reset, a management restart, loss of sync, an invalid ordered set.

Fourth, a port that returns to AN_ENABLE by itself stays there for one call. In the figure that step takes no time.

Fifth, auto-negotiation is always enabled.

P11.21 has a readable port, eth_an37, with the same states and match functions. You may port its logic.

What is graded is the checker around it: the restart, the timer of the run, and the comparison of both outputs.

Signals in the Timeline

SignalWidthRole
hidden_port8input of each check
Full specification
Signatures (keep them)
function automatic void chk_reset(input [15:0] adv, input int timer);
function automatic void chk_set(input bit restart, input bit cfg, input [15:0] word, input [1:0] xmit, input [15:0] tx_word);
function automatic bit  chk_alarm();   // 1 = alarm
ItemRule
chk_reset(adv, timer)called once, before the first ordered set. adv is the port's base page, with D15 and D14 at 0. timer is link_timer in calls, 4 or more. The port is in AN_ENABLE
restart = 1the port is held in AN_ENABLE. The received ordered set is not looked at
cfg, wordcfg = 1: a /C/ ordered set that carries word. cfg = 0: an /I/ ordered set, and word means nothing
xmit, tx_wordwhat the port sends after this ordered set. 0: /C/ with tx_word. 1: /I/. 2: data. tx_word means nothing unless xmit is 0 (the fixture fills it with a random value)
ability_matchthe last three /C/ words are equal in every bit but D14. An /I/ starts the count again
acknowledge_matchthe last three /C/ words are equal in all 16 bits and have D14 set. An /I/ starts the count again
consistency_matchthe word of acknowledge_match equals the word that ended ABILITY_DETECT, D14 left out
idle_matchthe last three ordered sets are /I/
Zero wordability_match is true and the last word is 0000h in all 16 bits. So 4000h is not a zero word
State entrythis problem reads the NOTEs of 37.3.1.2 as: all three counts start again. The ordered set that caused the entry does not count in the new state
link_timerstarts on entry to AN_RESTART, COMPLETE_ACKNOWLEDGE and IDLE_DETECT. It is done from the call that comes timer calls after that entry
AN_ENABLEsends /C/ with 0000h. The first call without restart moves the port to AN_RESTART
AN_RESTARTsends /C/ with 0000h. When link_timer is done: ABILITY_DETECT. Received ordered sets are not looked at
ABILITY_DETECTsends /C/ with adv. On ability_match with a last word that is not 0000h: ACKNOWLEDGE_DETECT. There is no other exit
ACKNOWLEDGE_DETECTsends /C/ with adv and D14 set. On a zero word: AN_ENABLE. On acknowledge_match: COMPLETE_ACKNOWLEDGE with consistency_match, AN_ENABLE without
COMPLETE_ACKNOWLEDGEsends the same. On a zero word: AN_ENABLE. Otherwise, when link_timer is done: IDLE_DETECT
IDLE_DETECTsends /I/. On a zero word: AN_ENABLE. Otherwise, on idle_match with link_timer done: LINK_OK
LINK_OKsends data. On ability_match, with any word: AN_ENABLE

These are the rules of Figure 37-6 and of 37.3.1.2 of IEEE Std 802.3-2022, without the Next Page states.

The NOTE under each match function in 37.3.1.2 says that it takes its default value on state entry.

The timer in calls and the one call in AN_ENABLE are bench choices. The readable eth_an37 makes the same two.

Examples

Example 1

The Correct Port
Input
A few thousand ordered sets: exchanges that complete, zero words and other pages in every state, restarts, and random changes
Output
alarm = no

It waits in ABILITY_DETECT through zero words. It returns on a zero word from three states, and from LINK_OK on any three matching words.

Example 2

A Broken Port
Input
One of the two runs through one hidden broken port
Output
alarm = yes

In ABILITY_DETECT, a zero word sends the port back to AN_ENABLE.

Example 3

A Different Broken Port
Input
One of the two runs through one hidden broken port
Output
alarm = yes

In LINK_OK, the port returns on a zero word only, not on any three matching words.

Constraints and Contract

  • Keep the three function names and their arguments.
  • Keep your state in module-level variables, and set it up in chk_reset().
  • Judge the port by xmit and tx_word only. The fixture's own names are off limits.
  • Off limits: the names port_under_test, rng, tb, root, names that begin with fx_ and the modules of the bench.

Hints

Hint 1

Which states start link_timer, and from which call is it done?

Hint 2

A port in ABILITY_DETECT gets 0000h three times. What does it do? And a port in LINK_OK that gets its partner's page three times?

Hint 3

The word 4000h has only the Ack bit. Is it a zero word? Does it match 0000h for ability_match?

What the grader checks: The fixture runs your checker on a private model of the arbitration: a correct port and sixteen fault switches. Each run has a few thousand ordered sets: scripted exchanges for every state and guided exchanges with random changes. There are two runs, each with its base page, timer length and partner words. Each goes to the correct port and to several broken ones. The timer is a count of calls, 4 to 10, in place of 10 ms. There are no Next Pages. restart stands for the conditions that force AN_ENABLE. Auto-negotiation is always enabled. What the two ends enable afterwards is P11.21.1.

18 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

The Correct Port

Input
A few thousand ordered sets: exchanges that complete, zero words and other pages in every state, restarts, and random changes
Expected output
alarm = no

It waits in ABILITY_DETECT through zero words. It returns on a zero word from three states, and from LINK_OK on any three matching words.

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

Icarus Verilog · server