Menu

Theme

Projects · Project · CHECKED ON 5.0.0

Build a half adder, full adder and 4-bit adder in Logisim

A half adder is one XOR gate (sum) and one AND gate (carry). A full adder in Logisim is two half adders plus an OR gate that combines their carries, giving S = A ⊕ B ⊕ Cin and Cout = A·B + Cin·(A ⊕ B). Chain four full adders, each carry-out into the next carry-in, and you have a 4-bit ripple-carry adder. Below you build each one in Logisim and check it with our test vectors.
FOR
First- and second-year digital logic students
CHECKED
11 Nov 2026
FIX TIME
about 2 hours
Checked against Logisim-evolution 5.0.0 on 1 machines
On this page

What you will build

Four circuits, each checked with a test vector: a half adder, a full adder, a 4-bit ripple-carry adder and a 4-bit adder-subtractor. They use AND, OR, XOR gates, pins, splitters and subcircuits. Plan on about two hours. Every circuit is a download, so you can compare yours with ours.

Before you start

Use Logisim-evolution 5.0.0. Classic 2.7.1 files are offered for the half adder, the full adder and the 4-bit adder because some courses still require 2.7.1 (which version?). Give every pin a Label, and keep the labels on this page: A, B, Cin, S, Cout. If you are new to the window, do the tutorial first.

Half adder in Logisim

Half adder: S is 1 when exactly one input is 1 (XOR); C is 1 only when both are (AND).
#ABSC
0000
0110
1010
1101

  1. Place two input pins

    Use the Input pin tool and label the pins A and B.

    Check: Pins A and B are on the canvas.

  2. Place an XOR gate and an AND gate

    From the toolbar. Two inputs is the default in 5.0.0 (gates).

    Check: Both gates have two inputs.

  3. Place two output pins

    Label them S and C.

    Check: Pins S and C are on the canvas.

  4. Wire it

    A and B each go to both gates; XOR to S and AND to C.

    Check: Every pin is joined.

  5. Poke and compare

    Use the Poke tool on A and B.

    Check: All four rows match the table.

circ-tutorial-half-adder · mainscroll to see all
ABSC
The half adder. All four rows matched in 5.0.0; the classic 2.7.1 file gives the same table in the 5.0.0 reader. CC BY 4.0 · SHA-256 cc7c23c201c8
Describe this circuit

Components: Input pin A; Input pin B; XOR Gate 1; AND Gate 1; Output pin S; Output pin C.

  • Input pin A connects to XOR Gate 1, AND Gate 1 (net A).
  • Input pin B connects to XOR Gate 1, AND Gate 1 (net B).
  • XOR Gate 1 connects to Output pin S (net S).
  • AND Gate 1 connects to Output pin C (net C).

Download the half adder or its 2.7.1 version. Project, Analyze Circuit shows the table Logisim derives from your circuit; see the tutorial and Combinational Analysis.

Full adder in Logisim

Full adder. S = A ⊕ B ⊕ Cin and Cout = A·B + Cin·(A ⊕ B).
#ABCinSCout
00000
00110
01010
01101
10010
10101
11001
11111

The second form of Cout reuses the first XOR: A ⊕ B is already computed for the sum.

Two half adders and an OR gate

Build the full adder as two half adders and an OR gate. The first half adder takes A and B. The second takes its sum and Cin. The OR gate combines the two carries. Our file draws it with gates directly:

circ-tutorial-full-adder · mainscroll to see all
ABCinSCout
Full adder from two XOR, two AND and one OR gate. All 8 rows matched in 5.0.0 and in the classic twin. CC BY 4.0 · SHA-256 137b2cf35d4e
Describe this circuit

Components: Input pin A; Input pin B; Input pin Cin; XOR Gate 1; AND Gate 1; XOR Gate 2; AND Gate 2; OR Gate 1; Output pin S; Output pin Cout.

  • Input pin A connects to XOR Gate 1, AND Gate 1 (net A).
  • Input pin B connects to XOR Gate 1, AND Gate 1 (net B).
  • Input pin Cin connects to XOR Gate 2, AND Gate 2 (net Cin).
  • XOR Gate 1 connects to XOR Gate 2, AND Gate 2.
  • AND Gate 1 connects to OR Gate 1.
  • XOR Gate 2 connects to Output pin S (net S).
  • AND Gate 2 connects to OR Gate 1.
  • OR Gate 1 connects to Output pin Cout (net Cout).

Download the full adder, its 2.7.1 version and the 8-row vector. To make it a subcircuit for the next step, see Subcircuits. We did not build the multiplexer-based and Combinational Analysis versions.

4-bit ripple-carry adder

How the carry ripples

Four full adders FA0 to FA3: FA0’s carry in is Cin, each carry out feeds the next carry in, and the last carry out is Cout. Bit 0 is the least significant bit. Each stage waits for the carry of the one before it, which is why this design is slow for wide adders.

Splitting buses into bits

A and B are 4-bit pins. A splitter with Fan Out 4 and Bit Width In 4 gives four wires per bus. With the default mapping the first end is bit 0 (F11, Splitter).

circ-full-adder-ripple-4bit · mainscroll to see all
4444bAA0A1A2A34bBB0B1B2B3Cinc0ABCinSCoutfafa0A0B0c0s0c1ABCinSCoutfafa1A1B1c1s1c2ABCinSCoutfafa2A2B2c2s2c3ABCinSCoutfafa3A3B3c3s3c4s0s1s2s34bSCoutc4
Four copies of one full-adder subcircuit. All 512 combinations of A, B and Cin matched in 5.0.0. CC BY 4.0 · SHA-256 c649fcc8ec1d
Describe this circuit

Components: Input pin A; Splitter 1; Input pin B; Splitter 2; Input pin Cin; fa fa0; fa fa1; fa fa2; fa fa3; Splitter 3; Output pin S; Output pin Cout.

  • Input pin A connects to Splitter 1 (net A), 4 bits wide.
  • Splitter 1 connects to fa fa0 (net A0).
  • Splitter 1 connects to fa fa1 (net A1).
  • Splitter 1 connects to fa fa2 (net A2).
  • Splitter 1 connects to fa fa3 (net A3).
  • Input pin B connects to Splitter 2 (net B), 4 bits wide.
  • Splitter 2 connects to fa fa0 (net B0).
  • Splitter 2 connects to fa fa1 (net B1).
  • Splitter 2 connects to fa fa2 (net B2).
  • Splitter 2 connects to fa fa3 (net B3).
  • Input pin Cin connects to fa fa0 (net Cin, c0).
  • fa fa0 connects to Splitter 3 (net s0).
  • fa fa0 connects to fa fa1 (net c1).
  • fa fa1 connects to Splitter 3 (net s1).
  • fa fa1 connects to fa fa2 (net c2).
  • fa fa2 connects to Splitter 3 (net s2).
  • fa fa2 connects to fa fa3 (net c3).
  • fa fa3 connects to Splitter 3 (net s3).
  • fa fa3 connects to Output pin Cout (net c4, Cout).
  • Splitter 3 connects to Output pin S (net S), 4 bits wide.

Test it

Load the 512-row vector with Simulate, Test Vector and expect Passed: 512. From the command line:

Terminal
java -jar logisim-evolution-5.0.0-all.jar --no-splash -w main circ-full-adder-ripple-4bit.vec.txt circ-full-adder-ripple-4bit.circ

A failing run still exits with code 0, so a script must read the text for Failed: 0 (F17). The option needs a display (F18). Download the 4-bit adder or its 2.7.1 version.

The first rows of the vector (A, B, Cin, S, Cout).
#ABCinSCout
0x00x000x00
0x00x010x10
0x00x100x10
0x00x110x20
0x00x200x20
0x00x210x30
0x00x300x30
0x00x310x40
0x00x400x40
0x00x410x50
0x00x500x50
0x00x510x60
0x00x600x60
0x00x610x70
0x00x700x70
0x00x710x80

Adder-subtractor

To subtract, add the two’s complement: invert B and add 1. XOR each B bit with a SUB signal, and use SUB as the first carry in. SUB = 0 adds; SUB = 1 subtracts.

circ-adder-subtractor-4bit · mainscroll to see all
4444bAA0A1A2A34bBB0B1B2B3SUBsubc0B0subbb0ABCinSCoutfafa0A0bb0c0s0c1B1subbb1ABCinSCoutfafa1A1bb1c1s1c2B2subbb2ABCinSCoutfafa2A2bb2c2s2c3B3subbb3ABCinSCoutfafa3A3bb3c3s3c4s0s1s2s34bSCoutc4
Four XOR gates on B, and SUB as the first carry in. All 512 rows (A, B, SUB) matched in 5.0.0. CC BY 4.0 · SHA-256 cecdf1f07bd4
Describe this circuit

Components: Input pin A; Splitter 1; Input pin B; Splitter 2; Input pin SUB; XOR Gate 1; fa fa0; XOR Gate 2; fa fa1; XOR Gate 3; fa fa2; XOR Gate 4; fa fa3; Splitter 3; Output pin S; Output pin Cout.

  • Input pin A connects to Splitter 1 (net A), 4 bits wide.
  • Splitter 1 connects to fa fa0 (net A0).
  • Splitter 1 connects to fa fa1 (net A1).
  • Splitter 1 connects to fa fa2 (net A2).
  • Splitter 1 connects to fa fa3 (net A3).
  • Input pin B connects to Splitter 2 (net B), 4 bits wide.
  • Splitter 2 connects to XOR Gate 1 (net B0).
  • Splitter 2 connects to XOR Gate 2 (net B1).
  • Splitter 2 connects to XOR Gate 3 (net B2).
  • Splitter 2 connects to XOR Gate 4 (net B3).
  • Input pin SUB connects to XOR Gate 1, fa fa0, XOR Gate 2, XOR Gate 3, XOR Gate 4 (net SUB, sub, c0).
  • XOR Gate 1 connects to fa fa0 (net bb0).
  • fa fa0 connects to Splitter 3 (net s0).
  • fa fa0 connects to fa fa1 (net c1).
  • XOR Gate 2 connects to fa fa1 (net bb1).
  • fa fa1 connects to Splitter 3 (net s1).
  • fa fa1 connects to fa fa2 (net c2).
  • XOR Gate 3 connects to fa fa2 (net bb2).
  • fa fa2 connects to Splitter 3 (net s2).
  • fa fa2 connects to fa fa3 (net c3).
  • XOR Gate 4 connects to fa fa3 (net bb3).
  • fa fa3 connects to Splitter 3 (net s3).
  • fa fa3 connects to Output pin Cout (net c4, Cout).
  • Splitter 3 connects to Output pin S (net S), 4 bits wide.
Some SUB = 1 rows (subtraction). For example 5 - 3 gives 2 with Cout 1: the carry out is 1 when there is no borrow.
#ABSUBSCout
0x00x010x01
0x00x110xf0
0x00x210xe0
0x00x310xd0
0x00x410xc0
0x00x510xb0
0x00x610xa0
0x00x710x90
0x00x810x80
0x00x910x70
0x00xa10x60
0x00xb10x50

Download circ-adder-subtractor-4bit.circ.

Check yourself

Before you move on0 / 4 done

To see what is inside these files, read the .circ file page. Next: an ALU.

Frequently asked questions

How do I make a full adder in Logisim?

Use two XOR gates for the sum (A XOR B, then XOR Cin), two AND gates and an OR gate for the carry. Our gate version passed all 8 rows in 5.0.0.

Why is my 3-input XOR wrong for 1, 1, 1?

By default a 3-input XOR is 1 only when exactly one input is 1. Use two 2-input XOR gates, or set its XOR behaviour to an odd number of inputs on (F39).

How do I make a 4-bit adder in Logisim?

Make a full-adder subcircuit, place four copies, and chain each carry out into the next carry in. Use splitters to take bits from 4-bit pins. Bit 0 is the first end of the splitter (F11).

How do I test my adder?

Use Simulate, Test Vector with our 512-row file, or run it from the command line. A passing run reports Passed: 512.

How do I make an adder-subtractor?

XOR each B bit with a SUB signal and use SUB as the first carry in. SUB = 0 adds and SUB = 1 subtracts. Our version matched all 512 rows.

Sources

  1. Adder circuits on Logisim-evolution 5.0.0 and the classic twins, logisim.dev lab data: src/content/circuits/circ-tutorial-*, circ-full-adder-ripple-4bit*, circ-adder-subtractor-4bit

Try: , , ,