Verification #12 · 2026-10-05 · Mailboxes · Medium · about 10 min

Five packets in the mailbox, all the same one

generator makes packets and passes them to the driver through a mailbox. run(n) must:

  • put n packets in mbx, in order, with id 0 to n−1 and each with its own random data;
  • record each packet's data in sent, in the same order, for the scoreboard.

Whoever takes a packet out of the mailbox must find the id and data it was put in with, however late they look at it and however long they keep it. The mailbox may be bounded or unbounded.

Run sends five packets to a driver that takes one every 10 time units. The driver gets five packets, but not the five that were sent. Fix generator.sv.

Write and run your answer in the browser. The hidden tests check it, and it’s free.