Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Mailbox peek and blocking put

Hardware interview practice

Mailbox peek and blocking put

MediumVerification UtilitiesSystemVerilog

Which behavior is guaranteed for this bounded mailbox?

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

mailbox #(int) m = new(1);
fork
  begin
    m.put(7);
    m.put(8);
  end
  begin
    int v;
    #2 m.peek(v);
    #2 m.get(v);
  end
join
Choose one

Answer choices

  1. A. peek removes 7 at time 2, so put(8) completes then
  2. B. put(8) overwrites 7 immediately
  3. C. peek returns 7 without freeing space; put(8) remains blocked until get removes 7 at time 4, then 8 can be inserted
  4. D. get returns 8 at time 4 because peek advances the mailbox cursor
Continue practicing

Related questions

Verification UtilitiesNonblocking event triggers→
asic.fyi · Learn silicon end to end.info@asic.fyi