Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Find the unpaired fault ID

Q039·Free·SystemVerilog

Find the unpaired fault ID

Difficulty
Easy
Topic
Streaming RTL
Language
SV
Interview prompt

Question

Consume a framed stream in which every fault ID appears exactly twice except one ID that appears once, then return the unpaired ID. Assume ID_W >= 1 and that the producer satisfies this frame-content promise; the unit need not validate multiplicities.

Candidate starting point

Implementation scaffold

module unpaired_fault_finder #(
  parameter int ID_W = 12
) (
  input  logic            clk,
  input  logic            rst_n,
  input  logic            fault_valid,
  input  logic            fault_last,
  input  logic [ID_W-1:0] fault_id,
  output logic            fault_ready,
  output logic            result_valid,
  input  logic            result_ready,
  output logic [ID_W-1:0] result_id
);
  logic [ID_W-1:0] xor_accum;

  assign fault_ready = !result_valid;

  always_ff @(posedge clk) begin : accumulate_and_publish
    // TODO: Implement accumulate_and_publish using the supplied state and interface.
  end
endmodule
Reviewed example

Trace one case

Input
accepted fault IDs=[5,2,5,2,7], last asserted with 7
Expected output
result_id=7

The two copies of 5 cancel, and the two copies of 2 cancel. Including the final accepted 7 leaves result_id=7, which remains valid until consumed. The same logic also supports an unpaired ID of zero.

What to cover

Requirements

  1. Change the accumulator only when fault_valid and fault_ready are both asserted.
  2. Include the accepted final item in the result when fault_last is asserted.
  3. Support an unpaired ID of zero.
  4. Hold result_id and result_valid stable during result backpressure.
Exact question handoffPractice Q039

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

RTL Synthesis and Proof

Review widths, parameterization, memory inference, pipelining, implementation pressure, and proof evidence.

  • Streaming RTL
  • XOR
  • Framing
  • Backpressure
RTL Synthesis and Proof →
Continue practicing

Related questions

Q1091 · Bit ManipulationFind the single non-duplicateEasyP→Q638 · Bit ManipulationCompute Hamming distanceEasyP→Q329 · RTL DesignImplement and verify a two-input XOREasyP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi