Link pulses arrive one at a time. Sort them into clock pulses and data pulses, build the 16-bit word, and say when three words match.
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.
Write the receiver of twisted-pair auto-negotiation. It follows Figure 28-17 from FLP CAPTURE on.
The bench is a model. Time is a whole number of ticks, and a tick is 0.1 µs. rx_pulse(t) reports one link pulse at time t.
The timers are course choices inside Table 28-9: data_detect_min 300 ticks, data_detect_max 900 ticks, nlp_test_min 60,000 ticks.
nlp_test_min counts from the first pulse of a burst. The other two count from the last pulse the receiver counted.
A timer is done at its exact tick. A pulse 300 ticks after a clock pulse is a data pulse. One at 900 ticks is a clock pulse.
Course choice: there is no link pulse detection first. The first pulse after rx_reset opens a burst as its first clock pulse.
Course choice: a word is handed on when the 17th clock pulse of its burst is counted. A burst that ends before that hands on nothing.
Course choice: a burst that hands on nothing does not break a run of equal words.
The two match flags follow 28.3.1. They are worked out again each time a word is handed on, from the last three words.
resolve returns the best technology that both base pages offer (28B.3), as a code from the table below.
The lesson has the windows, the page fields and the priority list. Its readable model is the sender only.
What you must work out: the states the receiver needs, which pulse counts as what, and where each bit goes.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic void rx_reset();
function automatic void rx_pulse(input int t);
function automatic [25:0] rx_state();
function automatic [2:0] resolve(input [15:0] mine, input [15:0] theirs);
| Item | Rule |
|---|---|
t | the time of a link pulse in ticks of 0.1 µs. It grows from call to call |
rx_state() | a course choice of layout. Bits 15:0: the last word handed on. Bits 23:16: the number of words handed on since the reset. Bit 24: ability_match. Bit 25: acknowledge_match |
| Word | bit k of the word is Dk. D0 is the first bit on the wire (28.2.1.2) |
After rx_reset | rx_state() is 0 |
| Noise | the tests send pulses that Figure 28-17 has no arc for. Such a pulse changes nothing |
| More than 17 clock pulses | the count stops at 17 (28.3.3, rx_bit_cnt). Later pulses of the burst change nothing |
resolve | 0 nothing in common, 1 10BASE-T, 2 10BASE-T full duplex, 3 100BASE-TX, 4 100BASE-T4, 5 100BASE-TX full duplex |
| Pages | bits outside A0 to A4 play no part in resolve. The tests send pages of the IEEE 802.3 selector only |
| Samples | the fixture sends whole bursts with fx_words(pre, n, word, clock_gap, data_gap, spacing): rx_reset, then word n times. The gaps and the spacing from burst to burst are in ticks. The result is rx_state() at the end, with a sum of all states above it |
Random tests compare rx_state() with a private model after every pulse.
Examples
Example 1
One Clean Burst- Input
the word 01E1h as 22 pulses
- Output
last_word_handed_on = 0x1e1, words_handed_on = 1, ability_match = 0, acknowledge_match = 0, sum_over_the_state_after_every_pulse = 0x101e1
The pulse 62.5 µs after the first clock pulse is the 1 of D0. Four clock pulses with nothing between them are the zeros of D1 to D4. The word is handed on at the 17th clock pulse. One word is not a match.
Example 2
Three Equal Words- Input
the word 01E1h three times, 16 ms apart
- Output
last_word_handed_on = 0x1e1, words_handed_on = 3, ability_match = 1, acknowledge_match = 0, sum_over_the_state_after_every_pulse = 0xf4f0e721
The third word equals the two before it, so ability_match is 1. No word has D14 set, so acknowledge_match stays 0.
Example 3
Two Pages, Three Technologies in Common- Input
mine: all five; theirs: 10BASE-T, 100BASE-TX and 100BASE-T4
- Output
technology = 4
100BASE-TX full duplex is not on both pages. Of the three that are, 100BASE-T4 is the highest in the list of 28B.3: code 4.
Constraints and Contract
- Keep the four names and their arguments.
- You may add variables and helper functions.
rx_resetmust clear everything you keep.- Declare your variables at the top of a function, not inside a loop.
- Off limits: the names
ref_r,rng,tb,rootand the modules of the bench. - The fixture's own names are off limits too. They begin with
fx_.
Hints
Hint 1
Keep the time of the last pulse you counted, and whether it was a data pulse.
Hint 2
After a data pulse, the next pulse you count is a clock pulse. Only data_detect_min guards it.
Hint 3
After a clock pulse there are three answers: too early, in the window, or past data_detect_max.
Hint 4
Count clock pulses. The data pulse after clock pulse n is bit n − 1 of the word.
Hint 5
A new burst is told by the time since the first pulse of the burst, not since the last pulse.
Hint 6
Keep the last two words handed on. Compare them with the new one, with and without bit 14.
What the grader checks: A bench model of the receiver of Figure 28-17 from FLP CAPTURE on. Time is in whole ticks of 0.1 µs, and the three timer values are course choices inside Table 28-9. Link pulse detection before the first burst, nlp_test_max_timer, the transmit side, the arbitration states and Next Pages are not graded. A JavaScript model gives the expected values of the scripted tests. Three more tests use random runs: two compare your state with a private model after every pulse, and one compares resolve. resolve covers the five technologies of the base page; pause resolution is P11.21.1's.
50 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