Adder from NAND gates
An 8-bit adder of 120 NAND gates, packaged six chips deep. Unpack it a level at a time. There is no microcontroller in it: the simulator solves the 6 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
AdvancedRuns in your browser. Free, and no account needed.
How it works
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// An 8-bit adder, built from nothing but NAND gates.
//
// There is no microcontroller here and nothing to compile: press Run and the
// simulator solves the gates. Click A or B to count it up by one, or type a
// value into its properties.
//
// A + B + CIN = S, with COUT for the ninth bit
// 200 + 100 + 0 = 300, which shows as 44 with COUT lit (300 - 256 = 44)
//
// The adder is one chip, ADDER8. Select it and press Unpack to open it:
//
// ADDER8 two ADDER4 chips, the carry running from one to the other
// ADDER4 four FULL ADDERs in a ripple chain
// FULL ADDER two HALF ADDERs and an OR
// HALF ADDER an XOR for the sum and an AND for the carry
// XOR four NAND gates
// AND, OR NAND gates and NOT
// NOT one NAND gate with its inputs tied together
//
// 120 NAND gates in all. The lessons that build every one of these chips are
// on the path From gates to a computer, under Learn.
Parts list
125 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 2 × Number switch
- 1 × Bit switch
- 120 × Logic gate
- 1 × Number display
- 1 × Bit lamp
How it is wired
26 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Number switch (1) pin D0; ADDER8 chip pin A0
- Number switch (1) pin D1; ADDER8 chip pin A1
- Number switch (1) pin D2; ADDER8 chip pin A2
- Number switch (1) pin D3; ADDER8 chip pin A3
- Number switch (1) pin D4; ADDER8 chip pin A4
- Number switch (1) pin D5; ADDER8 chip pin A5
- Number switch (1) pin D6; ADDER8 chip pin A6
- Number switch (1) pin D7; ADDER8 chip pin A7
- Number switch (2) pin D0; ADDER8 chip pin B0
- Number switch (2) pin D1; ADDER8 chip pin B1
- Number switch (2) pin D2; ADDER8 chip pin B2
- Number switch (2) pin D3; ADDER8 chip pin B3
- Number switch (2) pin D4; ADDER8 chip pin B4
- Number switch (2) pin D5; ADDER8 chip pin B5
- Number switch (2) pin D6; ADDER8 chip pin B6
- Number switch (2) pin D7; ADDER8 chip pin B7
- Bit switch pin Q; ADDER8 chip pin CIN
- ADDER8 chip pin S0; Number display pin D0
- ADDER8 chip pin S1; Number display pin D1
- ADDER8 chip pin S2; Number display pin D2
- ADDER8 chip pin S3; Number display pin D3
- ADDER8 chip pin S4; Number display pin D4
- ADDER8 chip pin S5; Number display pin D5
- ADDER8 chip pin S6; Number display pin D6
- ADDER8 chip pin S7; Number display pin D7
- ADDER8 chip pin COUT; Bit lamp pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.