P11.12.2 Retry or Give up After a Collision

MediumImplementIcarus Verilog · serverReview the topic

Write the 4.2.8 decision a half-duplex MAC makes after each collision: wait and retry, or give up, and why.

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.

After a collision and its jam, a half-duplex MAC decides what to do with the frame. It may wait a random number of slots and retry. Or it gives up and reports why.

Write retry_decision. It gets the collision count, the packet bit where the collision was seen, a random word, the rate and one option bit. It returns a verdict and the wait.

Take the parameter values from Table 4-2 in the lesson: slotTime, attemptLimit and backoffLimit at each rate.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signature (keep it)
function automatic [31:0] retry_decision(input int n, input int at_bit, input [31:0] rnd,
                                         input int mbps, input bit stop_late);
// returns {verdict[1:0], delay_bit_times[29:0]}
RuleValue
Late collisionseen after the first slotTime bits of the packet, preamble included. 4.2.8 counts from the end of the 64 header bits, which is the same point
Late, at 1000 Mb/sthe MAC must stop: verdict 2
Late, at 10 or 100 Mb/sretried like any other collision. With stop_late = 1 the MAC takes the option 4.2.8 allows and stops: verdict 2
Too many collisionswhen n reaches attemptLimit: verdict 1
Both at oncereport the late collision. 4.2.8 does so at 1000 Mb/s; at 10 and 100 Mb/s this problem keeps the same order
Otherwiseverdict 0: wait r × slotTime bit times, 0 ≤ r < 2^k, where k is n but never more than backoffLimit
rthe low k bits of rnd. This is a bench rule: the standard asks for a uniform random r
Giving upthe delay bits are 0

Examples

Example 1

First Retry at 10 Mb/s
Input
n = 1, at_bit = 200, rnd = FFFFFFFFh
Output
delay_bit_times = 512, verdict = retry (0)

Bit 200 is inside the first 512-bit slot, so this is an ordinary collision. k = 1, so r is bit 0 of rnd: 1. The wait is one slot, 512 bit times.

Example 2

Third Retry
Input
n = 3, at_bit = 300, rnd = 12345675h, 100 Mb/s
Output
delay_bit_times = 2560, verdict = retry (0)

k = 3, so r is the low three bits: 5. The wait is 5 × 512 = 2,560 bit times.

Example 3

A Late Collision at 1 Gb/s
Input
n = 1, at_bit = 5000, rnd = 3, 1000 Mb/s
Output
delay_bit_times = 0, verdict = give up: late collision (2)

At 1000 Mb/s one slot is 4096 bits, and bit 5000 is past it. The MAC must stop: verdict 2, delay 0.

Constraints and Contract

  • Keep the name and the arguments.
  • n is at least 1, at_bit at least 1. mbps is 10, 100 or 1000.
  • stop_late matters only at 10 and 100 Mb/s.
  • Off limits: the names model, rng, tb, root and the modules of the bench.

Hints

Hint 1

How many bits is one slot at 1000 Mb/s? Is a collision on that very bit late?

Hint 2

At 100 Mb/s, what does a late collision change when stop_late is 0?

Hint 3

What happens to the range after the 11th collision, and after the 16th?

What the grader checks: The fixture checks 17 literal cases against an independent JavaScript model, including every window edge and the 16th collision. It checks 800 random cases against a private model. Taking r from the low bits of rnd is a bench rule; the standard asks for a uniform random r. 4.2.8 does not fix the status a 10 or 100 Mb/s MAC reports when it takes the option. This problem uses the late-collision verdict.

19 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

First Retry at 10 Mb/s

Input
n = 1, at_bit = 200, rnd = FFFFFFFFh
Expected output
delay_bit_times = 512, verdict = retry (0)

Bit 200 is inside the first 512-bit slot, so this is an ordinary collision. k = 1, so r is bit 0 of rnd: 1. The wait is one slot, 512 bit times.

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

Icarus Verilog · server