MODULE 14

Logic Circuit Calculator: Adders, Subtractors & Multiplexers

Standard combinational circuit building blocks.

What is Logic Circuit?

Logic circuits are networks of logic gates that implement boolean functions in hardware. This calculator simulates the classic combinational building blocks — adders, subtractors, multiplexers — used inside real digital devices.

How Does This Calculator Work?

Click one of the preset circuits — Half Adder, Full Adder, Subtractor, MUX, DEMUX, Encoder, or Decoder — and the calculator shows its live truth table along with which gates produce each output bit.

Common Formulas & Rules

  • AND gate: outputs 1 only when all inputs are 1.
  • OR gate: outputs 1 when at least one input is 1.
  • NOT gate (inverter): flips a single input.
  • XOR gate: outputs 1 when inputs differ (exactly one is 1).
  • NAND / NOR gates: AND/OR followed by a NOT; NAND alone is "functionally complete" — any boolean function can be built from NAND gates only.

Worked Example

A half-adder circuit (adds two single bits) uses an XOR gate for the sum bit and an AND gate for the carry bit: inputs 1 and 1 give XOR = 0 (sum) and AND = 1 (carry), correctly representing 1 + 1 = 10 in binary.

Study guide: Logic Circuits

Written for students learning this topic for the first time. Last updated October 2026.

Overview

Logic gates build Boolean functions in hardware. In a combinational circuit the output depends only on the current inputs, and a handful of such blocks (adders, subtractors, multiplexers) are the foundation of every processor's arithmetic unit.

Key ideas explained

Gates

AND, OR and NOT are the basic gates; NAND, NOR, XOR and XNOR are common combinations. NAND and NOR are universal: any circuit can be built from only one of them.

The half adder and the full adder

A half adder adds two bits: Sum = A ⊕ B and Carry = A·B. A full adder adds A, B and a carry-in: Sum = A ⊕ B ⊕ Cin and Cout = AB + Cin(A ⊕ B). It can be built from two half adders and an OR gate.

Subtractors

A half subtractor computes A − B: Difference = A ⊕ B and Borrow = A′B. A full subtractor adds a borrow-in: Diff = A ⊕ B ⊕ Bin and Bout = A′B + (A ⊕ B)′·Bin.

Multiplexers and ripple-carry adders

A 2ᵏ-to-1 multiplexer uses k select lines to route one of 2ᵏ inputs to the output. Chaining n full adders makes an n-bit ripple-carry adder; the carry must travel through every stage, so delay grows with n, which carry-lookahead logic reduces.

Worked examples

One full adder

Problem. Add A = 1, B = 1 and Cin = 1.

  1. Sum = 1 ⊕ 1 ⊕ 1 = 1.
  2. Cout = AB + Cin(A ⊕ B) = 1 + 1·0 = 1.

Answer. Sum 1 and carry 1, which is binary 11 = 3.

A 4-bit ripple-carry addition

Problem. Add 0110 (6) and 0111 (7).

  1. Bit 0: 0 + 1 + 0 gives sum 1, carry 0.
  2. Bit 1: 1 + 1 + 0 gives sum 0, carry 1.
  3. Bit 2: 1 + 1 + 1 gives sum 1, carry 1.
  4. Bit 3: 0 + 0 + 1 gives sum 1, carry 0.

Answer. 1101, which is 13.

Enter these same values in the calculator above and compare each step with the working shown here.

Common mistakes to avoid

  • Confusing sum and carry. The half-adder carry is AND, not OR.
  • Forgetting that a full adder has three inputs.
  • Writing the borrow as AB′ instead of A′B.
  • Ignoring propagation delay when judging how fast a ripple adder is.
  • Mixing up the order of select lines when wiring a multiplexer.

Where this shows up in computer science

  • Processor arithmetic units are built from adders, and subtraction is done by adding the two's complement.
  • Decoders select memory rows, and multiplexers route data buses.
  • FPGA lookup tables are small multiplexer trees that realise any truth table of a few inputs.

Test yourself

Try each question before opening the answer.

What are the half-adder outputs for A = 1 and B = 1?

Sum 0 and carry 1.

How many full adders does an 8-bit ripple-carry adder need?

8.

How many select lines does an 8-to-1 multiplexer need?

3.

Frequently asked questions

What's the difference between a half adder and a full adder?

A half adder adds two single bits, producing a sum and carry, but can't accept an incoming carry. A full adder adds three bits (two inputs plus a carry-in), making it possible to chain adders together for multi-bit addition.

What does a multiplexer (MUX) do?

A multiplexer selects one of several input signals to pass through to a single output, based on a select line. A 2-to-1 MUX picks between 2 inputs using 1 select bit.

How are logic circuits related to boolean algebra?

Every logic circuit is a physical implementation of a boolean expression. Simplifying the boolean algebra before building the circuit directly reduces the number of gates needed.