Q049FreeDesign Verification
APB Protocol Monitor without SVA
Interview prompt
Question
Monitor an Advanced Peripheral Bus (APB) transfer at each rising clock edge and detect setup/access sequencing violations without using assertions.
Starting point
Question code
class ApbMonitor;
void sample(bit psel, bit penable, bit pready, bit pwrite,
longint paddr, longint pwdata, int pstrb, bit pslverr);
int error_count();
endclassReviewed example
Trace one case
Input
cycle 0: PSEL=1, PENABLE=0, PADDR=0x40
cycle 1: PSEL=1, PENABLE=1, PREADY=0
cycle 2: PSEL=1, PENABLE=1, PREADY=1Expected output
one APB transfer completes at cycle 2; address remains 0x40 through the wait stateThe setup phase precedes the access phase, and all control fields remain stable while PREADY is low.
What to cover
Requirements
- Every access phase must be preceded by a setup phase.
- Address, direction, write data, and strobes remain stable while PREADY is low.
- PSLVERR is meaningful only on a completing access transfer.
- Support legal back-to-back transfers and flag an access that stalls beyond N cycles.

