Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Vote across redundant state monitors

Q006·Free·SystemVerilog

Vote across redundant state monitors

Difficulty
Easy
Topic
RTL Design
Language
SV
Interview prompt

Question

Sample five redundant multi-bit state codes and return the code that appears at least three times. If no strict majority exists, report an invalid result and return zero. Assume a positive static CODE_W.

Candidate starting point

Implementation scaffold

module redundant_state_voter #(
  parameter int unsigned CODE_W = 4
) (
  input  logic              clk,
  input  logic              rst_n,
  input  logic              check,
  input  logic [CODE_W-1:0] code [0:4],
  output logic              done,
  output logic              majority_valid,
  output logic [CODE_W-1:0] majority_code
);
  logic majority_valid_next;
  logic [CODE_W-1:0] majority_code_next;
  logic check_q;

  always_comb begin : vote_whole_codes
    // TODO: Initialize the majority outputs for the no-winner case.
    for (int unsigned i = 0; i < 5; i++) begin
      int unsigned match_count;
      // TODO: Count complete-code matches for candidate i and select the first strict majority.
    end
  end

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

Trace one case

Input
five sampled state codes=[3,5,3,3,5]
Expected output
majority_valid=1; majority_code=3

Three complete codes equal 3, satisfying the strict majority without unsafe per-bit voting.

What to cover

Requirements

  1. Compare complete state codes rather than voting each bit independently.
  2. Require at least three identical entries out of five.
  3. Produce deterministic zero data when the sampled set has no strict majority.
  4. On a clock edge where check is high and was low at the previous sampled edge, sample all five entries together, register the result, and raise done for one cycle. Holding check high must not create another request.
Exact question handoffPractice Q006

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.

  • RTL Design
  • Majority voter
  • Fault tolerance
  • Comparison fabric
RTL Synthesis and Proof →
Continue practicing

Related questions

Q745 · Waveform DebuggingIndependent Reset Releases Create a Permanent False MismatchHardP→Q200 · Reliable RTLDetect and recover an upset one-hot FSMMedium→
ASIC.FYI · Learn silicon end to end.info@asic.fyi