Hardware interview practice
Increment a four-digit BCD counter
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.
Reviewed example
Work through one case
Input
accepted BCD values 1999, then 9999; stall the second responseExpected output
1999 -> 2000 carry_out=0; 9999 -> 0000 carry_out=1, held stable while stalledDecimal carry propagates across trailing nines, and the all-nine case wraps all four digits with one carry flag.
What to cover
Requirements
- 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.
