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,addranddataat a falling edge, and holds all three until a rising edge wherereadyis 1. That edge accepts the beat. - At the next falling edge it drops
validand returns. Every write's beat is accepted exactly once, before itswritecall returns. - The bus has no back-to-back mode:
validmust 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.