Three management bits can take a PCS off the link: loopback and the two test modes. Work out what each one switches, on both sides.
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.
A PCS has a transmit side and a receive side. Management bits can turn each of them away from normal work.
Write pcs_tx_ctl. It says what the PMA is sent: transmit data, the loopback words, or one of four test patterns.
Write pcs_rx_ctl. It says which block the receive process gets, which checker runs, and which state diagrams are held at their start.
The inputs are MDIO registers 3.0 and 3.42 as they stand. This PCS has both optional patterns, PRBS31 and PRBS9.
The rules are those of the standard. The table gives the clause for each one.
Where the standard leaves a case open, the fixture does not send it. The list is below the table.
The lesson's eth_66_loop covers loopback alone. The test modes and the receive side are yours.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
test_number | 8 | input of each check |
Full specification
function automatic [18:0] pcs_tx_ctl(input [15:0] r0, input [15:0] r42, input [15:0] tx_word);
// returns {source[2:0], word[15:0]}
function automatic [70:0] pcs_rx_ctl(input [15:0] r0, input [15:0] r42, input [65:0] tx_coded, input [65:0] pma_block,
input bit signal_ok, input bit lock, input bit hi_ber);
// returns {lock_init, ber_init, rx_init, checker[1:0], rx_coded[65:0]}
| Item | Rule | From |
|---|---|---|
| Loopback bit | bit 3.0.14, here r0[14] | Table 45-234, 49.2.14.4 |
| Loopback, to the PMA | a continuous stream of 00FFh words: source 1, word 00FFh | 49.2.14.4 |
| Loopback, receive side | rx_coded is tx_coded. The block from the PMA is ignored | 49.2.14.4; the loop at the encoded block is a course choice |
| Transmit test mode | bit 3.42.3. The PMA gets the square wave if bit 3.42.1 is 1, the pseudo-random pattern if it is 0 | 49.2.14.3, 45.2.3.19.5, 45.2.3.19.7 |
| PRBS31 on the transmit path | bit 3.42.4, and only while bit 3.42.3 is 0 | 45.2.3.19.4 |
| PRBS9 on the transmit path | bit 3.42.6, and only while bits 3.42.3 and 3.42.4 are 0 | 45.2.3.19.2 |
word in a test mode | 0000h: the pattern generator named by source drives the PMA | the bench |
| Receive test mode | bit 3.42.2. It is r_test_mode in the state diagrams | 49.2.14.3, 45.2.3.19.6 |
rx_init | 1 in receive test mode, with hi_ber, or without block lock | Figure 49-17 |
ber_init | 1 in receive test mode or without block lock | Figure 49-15, 49.2.12 |
lock_init | 1 while signal_ok is 0. Test mode does not hold the lock diagram | Figure 49-14, 49.2.12 |
| Pseudo-random checker | checker 1 in receive test mode, and only while block lock is true | 49.2.12 |
| PRBS31 checker | checker 2 with bit 3.42.5, and only while bit 3.42.2 is 0 | 45.2.3.19.3 |
| Two variables | transmit test mode changes nothing on the receive side. Receive test mode changes nothing on the transmit side | 49.2.14.3 |
The fixture never sets loopback together with a test bit. It never sets receive test mode with the square wave selected.
In loopback it gives signal_ok 1, lock 1 and hi_ber 0. How lock behaves there is left to the design.
In PRBS31 receive mode it gives lock 0: that pattern has no sync headers. Reset and EEE are left out.
Three more combinations are never sent, because a PCS cannot reach them. lock 1 without signal_ok: LOCK_INIT clears block lock (Figure 49-14).
hi_ber 1 in receive test mode or without block lock: BER_MT_INIT holds hi_ber false (Figure 49-15).
Bits the table does not name may hold any value, so do not compare whole registers. Bits 3.0.13 and 3.0.6 are always 1 (45.2.3.1.5).
Examples
Example 1
Loopback, Transmit Side- Input
3.0.14 = 1, register 3.42 is 0, tx_word 1234h
- Output
word = 0xff, source = 1
The PMA gets the word 00FFh in place of the transmit data. That is a square wave of eight ones and eight zeros.
Example 2
Receive Test Mode, in Lock- Input
3.42.2 = 1; signal, block lock, no hi_ber
- Output
rx_coded = 0x2c3d2e1f0a5b4c6d6, checker = 1, rx_init = yes, ber_init = yes, lock_init = no
The checker looks at the block, because lock is true. The receive diagram and the BER monitor are held. The lock diagram runs on.
Example 3
Loopback, Receive Side- Input
3.0.14 = 1; signal_ok 1, lock 1, hi_ber 0
- Output
rx_coded = 0x155aa00ff12345679, checker = 0, rx_init = no, ber_init = no, lock_init = no
The receive process gets the PCS's own transmit block. The block from the PMA is ignored.
Constraints and Contract
- Keep both function names, their arguments and the widths of the results.
- The functions keep no state: each call is judged alone.
- Off limits: the names
rng,tb,root, names that begin withfx_and the modules of the bench.
Hints
Hint 1
Three transmit bits ask for a pattern. Write them in order of rank, highest first.
Hint 2
Which of the three state diagrams has no test mode term in its entry condition?
Hint 3
In receive test mode without block lock, is any checker looking?
What the grader checks: The fixture checks 27 fixed settings against an independent JavaScript model. It then walks every setting the standard defines against a private model, with other data on every full check. It never sends loopback with a test bit, or receive test mode with the square wave selected. It never sends states a PCS cannot reach: lock without signal, or hi_ber in test mode or out of lock. Lock in loopback, reset, EEE and the pattern generators themselves are not graded.
29 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 3 steps and the final capstone