Home › Practice › RTL Design › Single-digit BCD adder
Single-digit BCD adder
EasyRTLcombinationalarithmeticcodes
Build a 1-digit Binary-Coded Decimal (BCD) adder with carry-in and carry-out.
- Compute the 5-bit binary sum
raw = a + b + cin. - If
raw > 9, setcout = 1and add6(4'd6) to the lower 4 bits sosum = raw[3:0] + 4'd6. - Otherwise (
raw <= 9), setcout = 0andsum = raw[3:0]. - Apply this exact rule for all 4-bit inputs (no clock).
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.