Master the fundamental concepts of digital logic & boolean algebra through this focused micro-challenge.
A ripple-carry adder chains full-adders so each stage's Cout becomes the next stage's Cin. Bit 0 adds first; the carry ripples left until the MSB settles. This is slow in silicon (worst-case delay grows with width) but beautifully simple to simulate.
cLoading…
On four bits, 0011 + 0101:
1 + 1 + 0 gives sum 0, carry 11 + 0 + 1 gives sum 0, carry 10 + 1 + 1 gives sum 0, carry 10 + 0 + 1 gives sum 1, carry 0Result: 1000 (decimal 8).
For this exercise, you will implement four chained full-adders and verify addition across random test vectors. This task asks you to expose carry timing: watch how a carry injected at bit 0 eventually reaches bit 3, the same propagation delay that motivates carry-lookahead in real CPUs.
Keep the relevant datasheet, ISA manual, or architecture textbook chapter open while you implement. When your output disagrees with the reference trace on the same program, the bug is usually a mis-decoded opcode, a stale register read, or a flag bit left unchanged after arithmetic.
For this exercise, you will use those habits while implementing the requirement in the starter code. Microarchitectural product names change across CPU generations, but the control ideas (fetch, bypass, cache lines, vector lanes) stay stable enough to debug from first principles.
Build a 4-bit ripple-carry adder using full adders.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github