Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Monitor an independently stalled binary adder

Q197·Free·Design Verification

Monitor an independently stalled binary adder

Difficulty
Hard
Topic
Reference Models
Language
SV
Interview prompt

Question

Verify a serial adder whose A and B operand frames handshake independently and whose least-significant-bit-first (LSB-first) sum frame can stall. Reconstruct accepted operands and check every accepted output bit and last marker. MAX_BITS is from 1 through 32, default 32. Each operand contains 1 through MAX_BITS known LSB-first bits. Sample all channels and active-low reset at posedge clk. Once both operand frames close, the first sum_valid must be sampled on that edge or within MAX_BITS+2 further clock edges, regardless of sum_ready. The base DUT owns the pair through acceptance of its final sum bit: a next operand may first be accepted on a later edge. Reset cancels partial operands and pending output. End the test only after all non-canceled operands and expected output bits complete.

Candidate starting point

Implementation scaffold

module serial_adder_checker #(parameter int unsigned MAX_BITS = 32) (
  input logic clk, rst_n,
  input logic a_valid, a_ready, a_last, a_bit,
  input logic b_valid, b_ready, b_last, b_bit,
  input logic sum_valid, sum_ready, sum_bit, sum_last
);
initial assert (MAX_BITS inside {[1:32]})
  else $fatal(1, "MAX_BITS must be from 1 through 32");
logic [31:0] a_value, b_value;
int unsigned a_len, b_len;
bit a_done, b_done, pair_built;
bit awaiting_first_sum;
int unsigned first_sum_cycles_left;
bit expected_bits[$];

task automatic build_sum_frame;
  // TODO: construct expected bits and start the first-response deadline.
endtask

always @(posedge clk) begin : sample_transaction
  // TODO: sample operands, track the deadline, compare output, and handle reset.
end

property p_sum_stable;
  // TODO: Sampled-reset-disabled valid, bit and last stability through acceptance.
endproperty
a_sum_stable: assert property (p_sum_stable);

final begin : check_finished
  // TODO: Reject remaining operand fragments, a built pair, expected bits or a pending deadline.
end
endmodule
Reviewed example

Trace one case

Input
A=3 arrives LSB-first as [1,1]; B=1 arrives independently as [1]; output ready stalls after its first beat
Expected output
expected sum bits=[0,0,1] with last only on the third accepted bit

3+1=4 requires the final carry bit; independent operand handshakes and the output stall do not advance any unsampled index.

What to cover

Requirements

  1. Advance each operand's bit index only on that channel's valid-ready handshake and close a frame only when its last bit is accepted.
  2. Pair completed A and B frames in order and predict max(length A, length B) bits plus a final bit only when carry remains.
  3. Compare sum bits only on accepted output transfers and require sum_last exactly on the final expected bit.
  4. Reject overlength, nested, or next-frame traffic while the base DUT still owns a pair.
  5. Flush partial operands and expectations on reset and require stalled output data and framing to remain stable.
Exact question handoffPractice Q197

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Verification Planning and Models

Review plan structure, stimulus, checkers, reference models, and system-level answers.

  • Reference Models
  • Stream monitor
  • Scoreboard
  • Framing
Verification Planning and Models →
Continue practicing

Related questions

Q1002 · Reference ModelsScoreboard variable-length bitmap rangesHardP→Q1153 · Reference ModelsModel a recent-ID replay streamHardP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi