REDSTONEPEDIA › Circuits › Adders

Half adder: adds two bits into a sum and a carry

half adder: two bits into a sum and a carry · 17 blocks

Adds two one-bit inputs, A and B: the sum output (S) is on when exactly one of them is on, the carry output (COUT) when both are.

reacts in 12 ticks (0.6 s) · fits in 4×2×3

half adder: two bits into a sum and a carryHalf adder3D view loading (or not available in this browser)

Try it

Turn on A0, B0 or both with the buttons under the view: with one on, S0 (the sum) lights; with both, COUT (the carry) lights instead, because 1 + 1 = 10 in binary. Press play under the view to watch a demo on a loop; touch any other control to take over.

How this design does it: A torch on input A and input B's wire meet in a comparator that is fully on when both are off, barely on when only B is on, and off when A is on.

Build it

Download .litematic Download the design as text

The .litematic opens in Litematica (Minecraft 26.3): every block of the design in one region. The text file is the same build written as plain text, block by block.

Blocks used: comparator redstone block redstone torch redstone wire repeater stone

Details: how it works, measurements and properties

In depth

adds two binary numbers, bit by bit with the carry

How to try it

Press play under the view to watch the demo on a loop (the badge reads demo with the step it is on; the same sequence is drawn as a timing diagram below). Touch any control to stop it and try the circuit yourself.

To try it: press and hold the A0 button of the bar (or the cell tagged A0) to power that input; a quick tap sends a short 2-tick pulse; press and hold the B0 button of the bar (or the cell tagged B0) to power that input; a quick tap sends a short 2-tick pulse.

Inputs are tagged in lime; the output is tagged COUT, S0: the redstone lamp in that cell (the view adds it to show the output) lights while the output is on (the output strip by the demo badge shows its last 40 game ticks, 2 seconds). Drag to look around, pinch or scroll to zoom, step one game tick at a time with the step button.

Inputs and output over time

The inputs follow this schedule (the 3D view's demo plays the same). Lime: an input is on; orange: the output is on (taller = a stronger signal, 1 to 15). Time runs left to right in game ticks (20 ticks = 1 s).

gray 1gray 3gray 2walk 0walk 2walk 0walk 1walk 3walk 2walk 3walk 1walk 0jump 3jump 0jump 2jump 1jump 0jump 3jump 1jump 2A0B0COUTS0ticks050100150200250300350400450500

Swipe the diagram sideways: the whole sequence lasts 521 ticks (26.05 s).

Step by step (6 lines)
  on-blip: 2 inputs change from a=0 b=0 to a=1 b=1: s0
  on-blip: 2 inputs change from a=0 b=0 to a=1 b=1: s0
  on-blip: 2 inputs change from a=1 b=0 to a=0 b=1: cout
  gray: 3 states, worst latency 12 ticks (0.6 s)
  walk: 9 states, worst latency 12 ticks (0.6 s)
  jump: 8 states, worst latency 12 ticks (0.6 s)

Measurements

metricvaluewhat it means
latency12 ticks (0.6 s) (a0 falls from a=1 b=1)the worst time from an input change to the output's change
glitches4extra output changes while the inputs change
carryoutcarry in and out: it takes a carry input and gives a carry output, so copies chain into wider adders; carry out: a carry output only

Notes from its designer

A torch on input A and input B's wire meet in a comparator that is fully on when both are off, barely on when only B is on, and off when A is on. The carry lights when B is on and that comparator is off (both inputs on); the sum lights when exactly one input is on. Found by a SAT search.

Properties

StudyAdders
KindHalf adder: adds two bits into a sum and a carry
Blocks placed17 (not counting the input levers or buttons and the lamp the view adds)
Box4×2×3 (24 blocks of space)
Made of (the blocks that change state)comparator, redstone torch, redstone wire, repeater
Inputs / outputsA0 (repeater), B0 (repeater) / COUT, S0
Design fileha-17b

The design file

on GitHub

Design file (26 lines)
# Half adder: half adder: two bits into a sum and a carry · 17 blocks
# https://vjeux.github.io/redstonepedia/circuits/adder/ha-17b.html
name: ha-17b
circuit: adder 1
port input.a0: 3 1 -1
port input.b0: 2 1 3
port output.cout: -1 1 2
port output.s0: 0 1 -1
origin: 0 0 0
palette:
  A minecraft:redstone_wall_torch[facing=south,lit=true]
  B minecraft:redstone_wire[east=side,north=side,power=0,south=side,west=side]
  C minecraft:comparator[facing=east,mode=subtract,powered=false]
  D minecraft:repeater[delay=1,facing=north,locked=false,powered=false]
  R minecraft:redstone_block
  S minecraft:stone
  c minecraft:comparator[facing=south,mode=subtract,powered=false]
  r minecraft:redstone_wall_torch[facing=north,lit=true]
layer 0:
  RSS
  .SS
  .SS
layer 1:
  cBCA
  rDB
  SCB