P11.21.1 Resolve Duplex and Pause

EasyImplementIcarus Verilog · serverReview the topic

Two gigabit fibre ports have traded their base pages. Decide what one port enables: full or half duplex, and which way PAUSE frames may flow.

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 an_resolve. It gets the port's own base page and the partner's, and returns five flags.

The bench calls it once for each end of the link, with the pages swapped. The two results must fit together.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signature (keep it)
function automatic [4:0] an_resolve(input [15:0] mine, input [15:0] theirs);
// [0] full duplex  [1] half duplex  [2] may send PAUSE  [3] obeys PAUSE  [4] no common duplex
RuleValue
Page bitsD5 full duplex, D6 half duplex, D7 PAUSE, D8 ASM_DIR
DuplexFull if both pages offer it. Otherwise half if both offer it. Otherwise neither: set bit 4
PAUSE on both pagessend and obey
Mine: ASM_DIR without PAUSE. Theirs: PAUSE and ASM_DIRsend only
Mine: PAUSE and ASM_DIR. Theirs: ASM_DIR without PAUSEobey only
Any other pause bitsno pause
Half duplex, or no common duplexno pause (a choice of this problem)
All other bitsignored (a choice of this problem)

The pause rows are Table 37-4 of IEEE Std 802.3-2022; full over half duplex is 37.2.4.2. Pause is a full-duplex function (Annex 31B), so this problem enables it only there.

Examples

Example 1

Full Duplex and PAUSE on Both
Input
00A0h and 00A0h
Output
first_full_duplex = yes, first_half_duplex = no, first_may_send_pause = yes, first_obeys_pause = yes, first_no_common_duplex = no, second_full_duplex = yes, second_half_duplex = no, second_may_send_pause = yes, second_obeys_pause = yes, second_no_common_duplex = no

Both offer full duplex and PAUSE. Each end may send PAUSE frames and obeys them.

Example 2

One Sends PAUSE, the Other Obeys
Input
0120h and 01A0h
Output
first_full_duplex = yes, first_half_duplex = no, first_may_send_pause = yes, first_obeys_pause = no, first_no_common_duplex = no, second_full_duplex = yes, second_half_duplex = no, second_may_send_pause = no, second_obeys_pause = yes, second_no_common_duplex = no

Both have ASM_DIR and only the second has PAUSE. The first may send PAUSE frames; the second obeys them.

Example 3

Only Half Duplex in Common
Input
0060h and 0040h
Output
first_full_duplex = no, first_half_duplex = yes, first_may_send_pause = no, first_obeys_pause = no, first_no_common_duplex = no, second_full_duplex = no, second_half_duplex = yes, second_may_send_pause = no, second_obeys_pause = no, second_no_common_duplex = no

The second port does not offer full duplex. The link runs half duplex, with no pause.

Constraints and Contract

  • Keep the name and the widths.
  • Exactly one of bits 0, 1 and 4 is set.
  • Bits 2 and 3 are 0 unless bit 0 is set.
  • Off limits: the names lib, rng, tb, root and the modules of the bench.

Hints

Hint 1

Work out the duplex first. Which of the other flags depend on it?

Hint 2

Read the second sample. Both pages have ASM_DIR. What does ASM_DIR promise on its own?

Hint 3

Swap the two pages in your head: if one end may send PAUSE, what must the other end do?

What the grader checks: The fixture checks eleven literal page pairs, both ends each, against an independent JavaScript copy of Table 37-4. It then checks all 256 settings of the four ability bits against a private reference, three times. Two of those runs set the other bits at random. The exchange of the pages, Next Pages and what a port does with Remote Fault are not graded.

14 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

Full Duplex and PAUSE on Both

Input
00A0h and 00A0h
Expected output
first_full_duplex = yes, first_half_duplex = no, first_may_send_pause = yes, first_obeys_pause = yes, first_no_common_duplex = no, second_full_duplex = yes, second_half_duplex = no, second_may_send_pause = yes, second_obeys_pause = yes, second_no_common_duplex = no

Both offer full duplex and PAUSE. Each end may send PAUSE frames and obeys them.

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

Icarus Verilog · server