DescriptionQ002
Q002DesignDVASIC interview problem
Build a synchronous FIFO and race-free BFM
TechniquesFIFOBFMClocking blockSimultaneous access
DifficultyMedium
TopicRTL Design
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
Design a parameterized synchronous FIFO, then write a small bus-functional model that can reset it, push one item, and pop one item without testbench races.
Example input and output
Use this case to check your interpretationInput
cycle 0: rst_n=0
cycle 1: rst_n=1, push=1, data=0x2A, pop=0
cycle 2: push=1, data=0x7C, pop=1
cycle 3: push=0, pop=1Output
cycle 0: empty=1, count=0
cycle 1: accept 0x2A, count=1
cycle 2: pop 0x2A and accept 0x7C, count remains 1
cycle 3: pop 0x7C, empty=1, count=0Explanation
The simultaneous push/pop cycle preserves occupancy, and the race-free BFM samples accepted transfers only on the active clock edge.
02
Requirements (4)
- Expose full and empty, reject reads while empty, and reject writes while full unless a same-cycle read creates space.
- Define registered read-data semantics and handle simultaneous accepted reads and writes without corrupting occupancy.
- Support non-power-of-two depths with explicit pointer wrap logic.
- Use an interface clocking block so the BFM drives and samples on deterministic scheduler regions.
