Hardware interview practice
Control a request/acknowledge handshake
Design a four-phase controller that accepts start while idle, holds req until ack, drops req, waits for ack to return low, and emits a one-cycle done pulse when ack is sampled. Write a responder bus functional model (BFM) with a configurable delay.

Reviewed example
Work through one case
Input
cycle 0: req=0, ack=0
cycle 1: req=1, ack=0
cycle 2: req=1, ack=1
cycle 3: req=0, ack=1
cycle 4: req=0, ack=0Expected output
state: IDLE -> WAIT_ACK -> WAIT_REQ_LOW -> IDLE
done pulses once at cycle 2The controller holds the request phase until acknowledge and does not accept a second transaction until both sides return low.
What to cover
Requirements
- Ignore additional start pulses while a transaction is active.
- Keep req asserted continuously until ack is sampled.
- Pulse done only for the req-and-ack handshake and do not return to idle until ack is low.
- Initialize ack low and drive it for exactly one sampled cycle in the BFM.
