Menu

Theme

Projects · Project · CHECKED ON 5.0.0

1 bit ALU Logisim project: from one bit to four

An ALU computes several results from the same inputs and uses a multiplexer to pick the one the operation code asks for. Build a 1-bit slice (AND, OR, add, XOR) and chain four of them for a 4-bit ALU. Our 4-bit ALU has a Binv input that inverts B and doubles as the carry in, so it subtracts too, plus a zero flag Z and an overflow flag V, and it passed all 2,048 input combinations in Logisim-evolution 5.0.0.
FOR
Computer-organisation students
CHECKED
11 Nov 2026
FIX TIME
about 3 hours
Checked against Logisim-evolution 5.0.0 on 1 machines
On this page

What you will build

A 1-bit ALU slice, then a 4-bit ALU made of four slices with a zero flag Z and an overflow flag V. Plan on about three hours. You need the adder project first: the slice uses a full adder as a subcircuit.

The 1-bit ALU slice

Inputs, outputs and operations

Pins: A, B, Cin, Binv and a 2-bit Op, and outputs R and Cout. Inside, B2 is B XOR Binv. The four results are AND (A·B2), OR (A + B2), SUM (a full adder of A, B2 and Cin) and XOR (A ⊕ B2). A 4-input multiplexer with Select Bits 2 picks R by Op.

Op Operation
00 AND
01 OR
10 SUM
11 XOR

Cout is the full adder’s carry for every Op. The 4-bit ALU only uses it when Op is 10.

circ-alu-1bit · mainscroll to see all
2ABBinvCin2bOpabbiciopB2bbib2ab2r00ab2r01ab2r11ABCinSCoutfasumab2cir10cor00r01r10r11opRCoutco
The 1-bit slice. All 64 combinations of A, B, Binv, Cin and Op matched in 5.0.0 and in the classic twin. CC BY 4.0 · SHA-256 f4582a1e8e51
Describe this circuit

Components: Input pin A; Input pin B; Input pin Binv; Input pin Cin; Input pin Op; XOR Gate B2; AND Gate 1; OR Gate 1; XOR Gate 2; fa sum; Multiplexer 1; Output pin R; Output pin Cout.

  • Input pin A connects to AND Gate 1, OR Gate 1, XOR Gate 2, fa sum (net A, a).
  • Input pin B connects to XOR Gate B2 (net B, b).
  • Input pin Binv connects to XOR Gate B2 (net Binv, bi).
  • Input pin Cin connects to fa sum (net Cin, ci).
  • Input pin Op connects to Multiplexer 1 (net Op, op), 2 bits wide.
  • XOR Gate B2 connects to AND Gate 1, OR Gate 1, XOR Gate 2, fa sum (net b2).
  • AND Gate 1 connects to Multiplexer 1 (net r00).
  • OR Gate 1 connects to Multiplexer 1 (net r01).
  • XOR Gate 2 connects to Multiplexer 1 (net r11).
  • fa sum connects to Multiplexer 1 (net r10).
  • fa sum connects to Output pin Cout (net co, Cout).
  • Multiplexer 1 connects to Output pin R (net R).
The rows where Op = 10 (SUM): the slice adds A, B2 and Cin.
#ABBinvCinOpRCout
00000x200
00010x210
00100x210
00110x201
01000x210
01010x201
01100x200
01110x210
10000x210
10010x201
10100x201
10110x211
11000x201
11010x211
11100x210
11110x201

Download the 1-bit ALU or its 2.7.1 version. The multiplexer’s data inputs are numbered from the top in its default orientation (multiplexers).

4-bit ALU from four slices

Chaining the slices

Four cells in a carry chain, sharing Binv and Op. Binv also drives the carry in of cell 0, so Op = 10 with Binv = 1 subtracts: A + NOT B + 1. Pins: A[4], B[4], Binv and Op[2] in; R[4], Cout, Z and V out.

circ-alu-4bit · mainscroll to see all
44244bAA0A1A2A34bBB0B1B2B3Binvbic02bOpopABBinvCinOpRCoutalu1cell0A0B0bic0opr0c1ABBinvCinOpRCoutalu1cell1A1B1bic1opr1c2ABBinvCinOpRCoutalu1cell2A2B2bic2opr2c3ABBinvCinOpRCoutalu1cell3A3B3bic3opr3c4r0r1r2r34bRCoutc4r0r1r2r3Zc3c4V
The 4-bit ALU: four slices, with flags Z and V. All 2,048 combinations matched in 5.0.0 and in the classic twin. CC BY 4.0 · SHA-256 acf33c5c9d3c
Describe this circuit

Components: Input pin A; Splitter 1; Input pin B; Splitter 2; Input pin Binv; Input pin Op; alu1 cell0; alu1 cell1; alu1 cell2; alu1 cell3; Splitter 3; Output pin R; Output pin Cout; NOR Gate 1; Output pin Z; XOR Gate 1; Output pin V.

  • Input pin A connects to Splitter 1 (net A), 4 bits wide.
  • Splitter 1 connects to alu1 cell0 (net A0).
  • Splitter 1 connects to alu1 cell1 (net A1).
  • Splitter 1 connects to alu1 cell2 (net A2).
  • Splitter 1 connects to alu1 cell3 (net A3).
  • Input pin B connects to Splitter 2 (net B), 4 bits wide.
  • Splitter 2 connects to alu1 cell0 (net B0).
  • Splitter 2 connects to alu1 cell1 (net B1).
  • Splitter 2 connects to alu1 cell2 (net B2).
  • Splitter 2 connects to alu1 cell3 (net B3).
  • Input pin Binv connects to alu1 cell0, alu1 cell1, alu1 cell2, alu1 cell3 (net Binv, bi, c0).
  • Input pin Op connects to alu1 cell0, alu1 cell1, alu1 cell2, alu1 cell3 (net Op, op), 2 bits wide.
  • alu1 cell0 connects to Splitter 3, NOR Gate 1 (net r0).
  • alu1 cell0 connects to alu1 cell1 (net c1).
  • alu1 cell1 connects to Splitter 3, NOR Gate 1 (net r1).
  • alu1 cell1 connects to alu1 cell2 (net c2).
  • alu1 cell2 connects to Splitter 3, NOR Gate 1 (net r2).
  • alu1 cell2 connects to alu1 cell3, XOR Gate 1 (net c3).
  • alu1 cell3 connects to Splitter 3, NOR Gate 1 (net r3).
  • alu1 cell3 connects to Output pin Cout, XOR Gate 1 (net c4, Cout).
  • Splitter 3 connects to Output pin R (net R), 4 bits wide.
  • NOR Gate 1 connects to Output pin Z (net Z).
  • XOR Gate 1 connects to Output pin V (net V).

Control table

Binv / Op Operation
0 / 00 AND
0 / 01 OR
0 / 10 ADD
1 / 10 SUB
0 / 11 XOR

The other Binv combinations (for example 1 / 00) give AND, OR and XOR with NOT B. They are side effects, not operations we support.

Zero and overflow flags

Z is a NOR of the four result bits. V is the carry into bit 3 XOR the carry out of bit 3, and only means something when Op is 10, so our vector marks V as don’t care (x) on other rows. The vector uses the special value that Logisim accepts for don’t care in a test vector.

Some ADD and SUB rows of the 2,048-row vector (A, B, Binv, Op; then R, Cout, Z, V).
#ABBinvOpRCoutZV
0x00x000x20x0010
0x00x010x20x0110
0x00x100x20x1000
0x00x110x20xf000
0x00x200x20x2000
0x00x210x20xe000
0x00x300x20x3000
0x00x310x20xd000
0x00x400x20x4000
0x00x410x20xc000
0x00x500x20x5000
0x00x510x20xb000
0x00x600x20x6000
0x00x610x20xa000
0x00x700x20x7000
0x00x710x20x9000

Download the 4-bit ALU, its 2.7.1 version and the vector.

What is not in this version

We did not build the whole-word 8-bit and 16-bit ALUs with a carry and negative flag, or a calculator. The 4-bit design above is the one we tested.

Check yourself

Before you move on0 / 4 done

Back to adders, or see what is inside these files in the .circ file page.

Frequently asked questions

How do I make a 1-bit ALU in Logisim?

Invert B with an XOR and Binv, compute AND, OR, a full-adder sum and XOR, and pick one with a 4-input multiplexer driven by a 2-bit Op. Our slice matched all 64 input rows.

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

Chain four slices: each carry out into the next carry in, Binv into the first carry in. Our 4-bit ALU matched all 2,048 rows.

How do I subtract with the ALU?

Set Binv to 1 and Op to 10: it computes A plus NOT B plus 1.

How do I get the overflow flag?

Overflow V is the carry into the top bit XOR the carry out of it. It only means something for add and subtract; our vector marks V as don't care for the other operations.

What is the zero flag?

Z is 1 when all result bits are 0: a NOR of the four result bits.

Sources

  1. ALU circuits on Logisim-evolution 5.0.0 and the classic twins, logisim.dev lab data: src/content/circuits/circ-alu-1bit*, circ-alu-4bit*

Try: , , ,