Computer Engineering

Adder Networks

Adds two 4-bit numbers with the von Neumann, parallel or serial adder and shows the bit/decimal step table with carry/overflow u.

Result · von Neumann adder

9 + 6 = 15

Carry/overflow u: 0

Steps

CycleuAcc (binary)Acc (decimal)Buffer (binary)Buffer (decimal)
000000000000
101001901106
2011111500000

Explanation

Motivation

A computer ultimately adds integers bit by bit in hardware. Even adding two 4-bit numbers raises the central question of digital logic: how is the carry passed from one bit position to the next? Different adder networks answer this with different trade-offs between circuit area, number of clock cycles and propagation delay. This tool contrasts three classic variants — the von Neumann adder, the parallel adder and the serial adder — and shows for each the bit/decimal step table together with the carry/overflow bit uu.

All three compute the same sum

s=a+p,s = a + p,

with a,p{0,,15}a, p \in \{0, \dots, 15\}. The result may leave the 4-bit range: if a+p16a + p \ge 16 an overflow occurs, captured in the fifth bit u=(a+p)/16u = \lfloor (a+p)/16 \rfloor. The accumulator then holds (a+p)mod16(a + p) \bmod 16, and the full value is u16+accu \cdot 16 + \text{acc}.

How the three networks work

von Neumann adder

The von Neumann adder separates sum without carry from carry and iterates until no carry remains. At each step, for the current accumulator aa and buffer pp:

a=ap,p=(ap)1.a' = a \oplus p, \qquad p' = (a \wedge p) \ll 1.

Here \oplus is bitwise XOR (the carry-free sum) and (ap)1(a \wedge p) \ll 1 shifts the carries generated at each position one place to the left. As soon as a carry reaches bit position 44, the overflow bit is set:

u  =  [(ap)1]4.u \;\mathrel{|}=\; \big[(a \wedge p) \ll 1\big]_4 .

The iteration ends when p=0p = 0 (the ss column then becomes 00). The number of steps depends on how far the carries propagate.

parallel adder

The parallel adder forms the sum in one combinational step (a ripple-carry chain, shown here as a single cycle). The lower four bits land in the accumulator, the fifth bit is the carry-out:

acc=(a+p)mod16,u=a+p16.\text{acc} = (a + p) \bmod 16, \qquad u = \left\lfloor \frac{a + p}{16} \right\rfloor .

It needs the fewest cycles but the most simultaneous logic.

serial adder

The serial adder uses one full adder that processes one bit per clock — starting from the least-significant bit (LSB) upward. For the current bits a0,p0a_0, p_0 and the carry uu, the full-adder equations are

s0=a0p0u,u=(a0p0)    (u(a0p0)).s_0 = a_0 \oplus p_0 \oplus u, \qquad u' = (a_0 \wedge p_0) \;\vee\; \big(u \wedge (a_0 \oplus p_0)\big).

The sum bit s0s_0 is shifted into the most-significant bit of the accumulator, while aa and pp shift right by one. After four cycles the accumulator holds the sum and uu is the carry-out. The serial adder needs the least logic but four clock cycles.

Worked example

We add a=9=10012a = 9 = 1001_2 and p=6=01102p = 6 = 0110_2 with the von Neumann adder — the preset of the calculator above.

ap=10010110=11112=15,(ap)1=(10010110)1=00001=00002=0.\begin{aligned} a \oplus p &= 1001 \oplus 0110 = 1111_2 = 15, \\ (a \wedge p) \ll 1 &= (1001 \wedge 0110) \ll 1 = 0000 \ll 1 = 0000_2 = 0. \end{aligned}

Since ap=0a \wedge p = 0 there is no carry: after a single step the buffer is already 00, the overflow bit stays u=0u = 0, and the accumulator holds 11112=151111_2 = 15. Indeed 9+6=15<169 + 6 = 15 < 16, so it just fits into four bits.

Common pitfalls

  • Reading the accumulator without the carry: the accumulator only holds (a+p)mod16(a + p) \bmod 16. On overflow you must add bit uu as the 1616s place, or the carry is missing from the final result.
  • Confusing XOR with addition: in the von Neumann step apa \oplus p is the carry-free sum — not a+pa + p. The carry lives separately in (ap)1(a \wedge p) \ll 1.
  • Wrong bit order in the serial adder: it starts at the LSB and shifts right. Starting at the MSB propagates the carry in the wrong direction.
  • Forgetting the carry uu between cycles: the serial adder carries uu from cycle to cycle; only then does a correct multi-bit addition emerge.