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
| Signal | Width | Role |
|---|---|---|
hidden_port | 8 | input of each check |
Full specification
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
| Item | Rule |
|---|---|
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 = 1 | the port is held in AN_ENABLE. The received ordered set is not looked at |
cfg, word | cfg = 1: a /C/ ordered set that carries word. cfg = 0: an /I/ ordered set, and word means nothing |
xmit, tx_word | what 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_match | the last three /C/ words are equal in every bit but D14. An /I/ starts the count again |
| acknowledge_match | the last three /C/ words are equal in all 16 bits and have D14 set. An /I/ starts the count again |
| consistency_match | the word of acknowledge_match equals the word that ended ABILITY_DETECT, D14 left out |
| idle_match | the last three ordered sets are /I/ |
| Zero word | ability_match is true and the last word is 0000h in all 16 bits. So 4000h is not a zero word |
| State entry | this 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_timer | starts on entry to AN_RESTART, COMPLETE_ACKNOWLEDGE and IDLE_DETECT. It is done from the call that comes timer calls after that entry |
| AN_ENABLE | sends /C/ with 0000h. The first call without restart moves the port to AN_RESTART |
| AN_RESTART | sends /C/ with 0000h. When link_timer is done: ABILITY_DETECT. Received ordered sets are not looked at |
| ABILITY_DETECT | sends /C/ with adv. On ability_match with a last word that is not 0000h: ACKNOWLEDGE_DETECT. There is no other exit |
| ACKNOWLEDGE_DETECT | sends /C/ with adv and D14 set. On a zero word: AN_ENABLE. On acknowledge_match: COMPLETE_ACKNOWLEDGE with consistency_match, AN_ENABLE without |
| COMPLETE_ACKNOWLEDGE | sends the same. On a zero word: AN_ENABLE. Otherwise, when link_timer is done: IDLE_DETECT |
| IDLE_DETECT | sends /I/. On a zero word: AN_ENABLE. Otherwise, on idle_match with link_timer done: LINK_OK |
| LINK_OK | sends 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
xmitandtx_wordonly. The fixture's own names are off limits. - Off limits: the names
port_under_test,rng,tb,root, names that begin withfx_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