DescriptionQ502
Q502DesignASIC interview problem
Increment a four-digit BCD counter
TechniquesBCDReady/validCarry propagation
DifficultyEasy
TopicRTL Design
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
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.
Example input and output
Use this case to check your interpretationInput
accepted BCD values 1999, then 9999; stall the second responseOutput
1999 -> 2000 carry_out=0; 9999 -> 0000 carry_out=1, held stable while stalledExplanation
Decimal carry propagates across trailing nines, and the all-nine case wraps all four digits with one carry flag.
02
Requirements (4)
- Treat each input digit as a decimal value from 0 through 9.
- Propagate decimal carry across any run of trailing nines.
- Create exactly one output transaction for every accepted input transaction.
- Hold all result digits and carry_out stable while out_valid is asserted and out_ready is low.
