DescriptionQ049
Q049DVASIC interview problem
APB Protocol Monitor without SVA
TechniquesDVAPBProtocol monitorState machineLatency
DifficultyMedium
TopicProtocol Checking
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
Monitor an Advanced Peripheral Bus (APB) transfer at each rising clock edge and detect setup/access sequencing violations without using assertions.
Class declarationSystemVerilog
class ApbMonitor;
void sample(bit psel, bit penable, bit pready, bit pwrite,
longint paddr, longint pwdata, int pstrb, bit pslverr);
int error_count();
endclassExample input and output
Use this case to check your interpretationInput
cycle 0: PSEL=1, PENABLE=0, PADDR=0x40
cycle 1: PSEL=1, PENABLE=1, PREADY=0
cycle 2: PSEL=1, PENABLE=1, PREADY=1Output
one APB transfer completes at cycle 2; address remains 0x40 through the wait stateExplanation
The setup phase precedes the access phase, and all control fields remain stable while PREADY is low.
02
Requirements (4)
- 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.
