Block lock can hold on a line that is far too noisy. Build the monitor that counts invalid sync headers and raises hi_ber.
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 bench calls ber_header once for every sync header a locked receiver tests. Return hi_ber after that header.
The monitor counts invalid headers while a timer runs. When the count reaches limit, hi_ber is set at once.
When the timer is done, a new period starts with a count of zero. hi_ber is cleared only at the end of a period whose count stayed below limit.
Three things are course choices, not the standard's. The bench makes one call per header. The timer is a count of headers: it is done at header number window of each period. And restart stands for reset, test-pattern mode and loss of block lock.
In the standard the timer runs for 125 µs, which is about 19,531 headers of 10GBASE-R. One hidden test uses that number.
The starter handles restart for hi_ber only. The counters, the limit and the period are yours.
The lesson shows this monitor as a diagram and a table only. Its code is what this problem grades.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic bit ber_header(input bit restart, input bit sh_valid, input int limit, input int window);
| Item | Rule |
|---|---|
restart = 1 | the monitor starts over: hi_ber is 0, the count is 0, and the next header is header 1 of a new period. Return 0 |
sh_valid | 1 if the two bits of the sync header differ. A header with sh_valid = 0 is counted once. That is this course's reading of the figure: see the note below the table |
limit | 16 for 10GBASE-R and 5GBASE-R, 97 for 25GBASE-R. The fixture also uses other values, from 1 up |
window | headers in one period, never less than limit. A course choice: the standard's timer measures time |
The count reaches limit | hi_ber is 1 from that header on. Later invalid headers of the period change nothing |
| The last header of a period | it is counted first. Then, if the count is below limit, hi_ber is 0. The next header starts a new period |
A period that reached limit | hi_ber stays 1 into the next period |
These are the rules of Figure 49-15 of IEEE Std 802.3-2022, with the count as 49.2.13.2.4 defines it. The 25GBASE-R numbers are those of 107.1.2.
Standard behaviour: read literally, Figure 49-15 can count an invalid header twice when a valid one came before it. Figure 82-15 adds a wait state that counts each header once. This problem counts once, and an answer that counts twice fails.
The fixture starts every run with one call that has restart = 1.
Examples
Example 1
Sixteen Invalid Headers at the Start- Input
16 invalid headers, then 112 valid ones. Limit 16, period 64
- Output
hi_ber_at_the_end = no, headers_with_hi_ber = 112, first_header_with_hi_ber = 16, last_header_with_hi_ber = 127
hi_ber rises at header 16. The first period ends at header 64 with hi_ber still set. The second one is clean, so hi_ber drops at header 128.
Example 2
The 16th on the Last Header of a Period- Input
48 valid headers, 16 invalid ones, then 74 valid ones. Limit 16, period 64
- Output
hi_ber_at_the_end = no, headers_with_hi_ber = 64, first_header_with_hi_ber = 64, last_header_with_hi_ber = 127
Header 64 is counted before the period closes. The count is 16, so hi_ber is set there and held through the next period.
Example 3
A Restart While hi_ber Is Set- Input
16 invalid headers, 10 valid ones, one header with restart, 20 valid ones. Limit 16, period 64
- Output
hi_ber_at_the_end = no, headers_with_hi_ber = 11, first_header_with_hi_ber = 16, last_header_with_hi_ber = 26
hi_ber is set from header 16 to header 26. The restart at header 27 clears it at once.
Constraints and Contract
- Keep the name and the arguments of
ber_header. - Keep your state in module-level variables.
restartmust clear all of it. - Use
limitandwindowas given: the fixture changes them from run to run. - Off limits: the names
lib,rng,tb,rootand the modules of the bench.
Hints
Hint 1
What is hi_ber on the header that makes the count reach the limit?
Hint 2
hi_ber is set, and the next period is clean. On which header does hi_ber drop?
Hint 3
What if the header that reaches the limit is also the last header of the period?
What the grader checks: The fixture checks 15 scripted header streams against an independent JavaScript model, and 161 random runs against a private reference monitor. The timer is a count of headers; the standard's timer runs for 125 µs. restart stands for reset, test-pattern mode and loss of block lock. Block lock, the receive state diagram and the MDIO counter are not graded.
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