Write-the-property scenarios interview questions
Whiteboard-style questions: write assertions for arbiters, FIFOs, handshakes, counters and FSMs.
📚 Learn it first: Chapter 14: Handshakes and Credit-Based Flow Control · Chapter 15: Waveform Problems: Pass or Fail? · Chapter 12: Your Formal-Aware Workflow
Q1Write the key properties for a round-robin arbiter with N requesters.
Intermediate
// 1. mutual exclusion
assert property (@(posedge clk) $onehot0(gnt));
// 2. no grant without a request
assert property (@(posedge clk) (gnt & ~req) == '0);
// 3. work conserving: if anyone requests, someone is granted
assert property (@(posedge clk) |req |-> |gnt);
// 4. fairness / starvation freedom for each requester i (bounded form)
for (genvar i = 0; i < N; i++) begin : g_fair
assert property (@(posedge clk) req[i] && !gnt[i] |-> ##[1:N] (gnt[i] || !req[i]));
endMention the assumptions: requesters hold req until granted (if that is the protocol) and reset behaviour. Also cover "all requesters active at once".
Q2List the properties you would write for a synchronous FIFO.
Basic
- No overflow:
full |-> !pushas an assumption on the environment, and the design must keepcount <= DEPTH. - No underflow:
empty |-> !pop(assume) / design never decrements below zero. - Flags correct:
full == (count == DEPTH),empty == (count == 0). - Count update:
push && !pop && !full |=> count == $past(count) + 1. - Data integrity and ordering: tracked-item check (see the FPV topic).
- Covers: full, empty after full, simultaneous push and pop when full and when empty.
Q3Write properties for a valid/ready handshake (source side).
Basic
// once valid is raised, it stays until accepted
assert property (@(posedge clk) valid && !ready |=> valid);
// and the payload is stable while waiting
assert property (@(posedge clk) valid && !ready |=> $stable(data));
// no X on payload when valid
assert property (@(posedge clk) valid |-> !$isunknown(data));If you verify the sink, these become assumptions and you assert what the sink guarantees (e.g. ready is eventually given: valid |-> s_eventually ready).
Q4A request must be acknowledged within 2 to 5 cycles. Write the property.
Basic
assert property (@(posedge clk) disable iff (!rst_n)
$rose(req) |-> ##[2:5] ack);Follow-ups: use $rose(req) (or req && !busy) so each request starts one check, not one per cycle while req is held; and if an early ack is also an error, require ack to stay low first: $rose(req) |-> !ack[*2] ##[1:4] ack (low in cycles 0–1, then high somewhere in cycles 2–5).
Q5What properties do you write for an FSM?
Intermediate
- State is always legal:
state inside {IDLE, RUN, DONE}(or one-hot check for one-hot encoding). - Legal transitions only:
state == IDLE |=> state inside {IDLE, RUN}. - Outputs consistent with state (Moore outputs).
- No deadlock: from every state the FSM can return to IDLE (cover each state and each transition; a liveness check if a fairness assumption makes sense).
- Covers for every state and every transition — unreachable ones are dead code or over-constraint.
Q6Two write enables must never be active together. How do you check it, and what if it fails?
Basic
assert property (@(posedge clk) !(wr_en_a && wr_en_b));If it fails, read the CEX: is it a real arbitration bug, or are both enables driven by inputs that the system guarantees are exclusive? In the second case add an assumption on those inputs — and make sure that assumption is proven on the block that drives them.
Q7Write properties for a counter that counts up when en is high and wraps at MAX.
Basic
assert property (@(posedge clk) disable iff (!rst_n)
en && (cnt != MAX) |=> cnt == $past(cnt) + 1);
assert property (@(posedge clk) disable iff (!rst_n)
en && (cnt == MAX) |=> cnt == 0);
assert property (@(posedge clk) disable iff (!rst_n)
!en |=> $stable(cnt));
cover property (@(posedge clk) cnt == MAX ##1 cnt == 0); // wrap is reachableQ8How would you check a latch-based clock gate in formal?
Advanced
Check the function of the gate: every pulse of the gated clock must be allowed by the enable that was latched while the clock was low, and with the enable high the gated clock must follow the clock.
// sampled just before each gated-clock edge: the latched enable was high
assert property (@(posedge gclk) en_latched);The reverse direction (with the enable high, every clock edge gets through) involves comparing two clocks directly and is usually checked by the tool's clock-gating or sequential-equivalence mode.
In practice most teams use standard integrated clock-gating (ICG) cells and check glitch-freedom and enable timing with structural lint/CDC and STA rather than FPV. Saying that in an interview shows you know where each tool fits.
Q9Explain credit-based flow control. Which properties would you prove for it?
Advanced
The receiver has a buffer of DEPTH entries; the sender starts with DEPTH credits, spends one per transfer and may not send with zero. Each time the receiver frees a slot it returns a credit. No same-cycle ready is needed, so the link can be pipelined in both directions.
- No overdraft:
send |-> credits != 0. - Ceiling:
credits <= DEPTH(catches duplicated credits). - No overflow at the receiver.
- Conservation (the key one, written with auxiliary code): credits + data in flight + buffer occupancy + credits in flight == DEPTH. It is inductive, so it proves fast, and it catches a lost credit immediately.
- Progress: the sender eventually sends, under a fairness assumption that the consumer eventually reads.
Strong follow-up: a lost credit often does not deadlock — it just lowers bandwidth — which is why conservation beats a deadlock check. See the lab in Chapter 14.
Q10How can formal help with a clock-domain-crossing (CDC) handshake?
Advanced
Structural CDC tools check synchronizer placement. Formal adds protocol checks across domains, for example that the data bus is stable for as long as the request is being synchronized:
// source domain: data stable from req rise until ack is seen
assert property (@(posedge src_clk)
$rose(src_req) |=> $stable(src_data) throughout (src_ack_sync[->1]));With multiple clocks, formal tools model the clocks as free-running with assumed ratios or arbitrary relations, so set up clock assumptions carefully and cover slow/fast combinations.
Discussion
No comments yet.