Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Increment a four-digit BCD counter

Hardware interview practice

Increment a four-digit BCD counter

MediumRTL DesignSystemVerilog

Accept four valid binary-coded decimal (BCD) digits, add one without converting the packed value to binary, and return a stallable ready/valid response. Wrap 9999 to 0000 and flag the wrap.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
accepted BCD values 1999, then 9999; stall the second response
Expected output
1999 -> 2000 carry_out=0; 9999 -> 0000 carry_out=1, held stable while stalled

Decimal carry propagates across trailing nines, and the all-nine case wraps all four digits with one carry flag.

What to cover

Requirements

  1. Treat each input digit as a decimal value from 0 through 9.
  2. Propagate decimal carry across any run of trailing nines.
  3. Create exactly one output transaction for every accepted input transaction.
  4. Hold all result digits and carry_out stable while out_valid is asserted and out_ready is low.
Continue practicing

Related questions

RTL DesignRoute a shared read bus without internal tri-states→RTL DesignAbsorb ready/valid backpressure with a skid buffer→RTL DesignImplement a synchronous FIFO with exact boundary behavior→
asic.fyi · Learn silicon end to end.info@asic.fyi