Verification #11 · 2026-10-04 · Semaphores · Medium · about 15 min

The lock that's given back too soon

Tests write to the DUT through bus.write(addr, data) in bus_if.sv. Several test processes call it at the same time, and the semaphore lock must make their writes take turns:

  • A write drives valid = 1, addr and data at a falling edge, and holds all three until a rising edge where ready is 1. That edge accepts the beat.
  • At the next falling edge it drops valid and returns. Every write's beat is accepted exactly once, before its write call returns.
  • The bus has no back-to-back mode: valid must be low at the rising edge after each accepted beat.

With one test process everything works. Run starts three, and the DUT receives the wrong beats. Fix bus_if.sv.

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