Loading simulator…
The controller uses five behavioral states and a separate counter rather than creating seven additional WAIT states.
The supplied solution uses the one-hot assignment Q0 = IDLE, Q1 = REQUEST, Q2 = WAIT, Q3 = ACK, and Q4 = NACK.
This is the reference implementation only; any encoding is valid when the four external outputs and timing match the specification.
For the reference one-hot register, the canonical next-state equations are:
D0 = Q0·start' + clear·(Q3 + Q4)
D1 = Q0·start
D2 = Q1 + Q2·ack'·timeout'
D3 = Q2·ack + Q3·clear'
D4 = Q2·ack'·timeout + Q4·clear'
The Moore outputs are decoded directly from the one-hot state:
REQ = Q1
BUSY = Q1 + Q2
DONE = Q3
FAIL = Q4
The 3-bit timeout counter uses T flip-flops with outputs C2C1C0:
EN = Q2·ack'
T0 = EN
T1 = EN·C0
T2 = EN·C1·C0
timeout = C2·C1·C0'
nClearCounter = Q2
nClearCounter is active LOW, so the counter is held at 000 outside WAIT and is enabled only while WAIT = 1 and ack = 0.
With no acknowledgment, the count reaches 110 after six waiting edges; timeout is then HIGH and the seventh waiting edge enters NACK.
The ack term has priority at this boundary: if ack = 1 while the count is 110, the controller enters ACK instead.
Both terminal states hold while clear = 0, and clear = 1 alone returns either one to IDLE.