Your first computer
A CPU of about four thousand NAND gates running a program from a ROM, with a terminal. Change the program and run yours. There is no microcontroller in it: the simulator solves the 5 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.
// Your first computer: a CPU built from NAND gates, running a program.
//
// Press Run, then click RESET to set it to 0. The CPU starts at address 0 of
// the program ROM and the terminal prints what it sends.
//
// step clock 200 ticks a second; set its mode to step to go one
// instruction a click
// RESET at 1, the next tick sets the program counter to 0
// program ROM click it: the program is Kestrel assembly in its properties
// KESTREL the CPU, one chip; Unpack it to see CONTROL, REGS4, ALU8,
// RAM8 and PC, and keep unpacking down to the NAND gates
// terminal prints each byte OUT sends it
//
// The Kestrel has four registers, R0 to R3, eight bytes of RAM and sixteen
// instructions. The help article on the program ROM lists them. Change the
// program, press Run and RESET again, and it runs yours.
//
// Every chip in it is built in the lessons on the path From gates to a
// computer, under Learn.
Parts list
4027 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Step clock
- 1 × Bit switch
- 1 × Program ROM
- 4019 × Logic gate
- 4 × Constant bit
- 1 × Terminal
How it is wired
35 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.
- Step clock pin CLK; KESTREL chip pin CLK; Terminal pin CLK
- Bit switch pin Q; KESTREL chip pin RESET
- Program ROM pin A0; KESTREL chip pin PC0
- Program ROM pin A1; KESTREL chip pin PC1
- Program ROM pin A2; KESTREL chip pin PC2
- Program ROM pin A3; KESTREL chip pin PC3
- Program ROM pin A4; KESTREL chip pin PC4
- Program ROM pin A5; KESTREL chip pin PC5
- Program ROM pin A6; KESTREL chip pin PC6
- Program ROM pin A7; KESTREL chip pin PC7
- Program ROM pin C0; KESTREL chip pin C0
- Program ROM pin C1; KESTREL chip pin C1
- Program ROM pin C2; KESTREL chip pin C2
- Program ROM pin C3; KESTREL chip pin C3
- Program ROM pin C4; KESTREL chip pin C4
- Program ROM pin C5; KESTREL chip pin C5
- Program ROM pin C6; KESTREL chip pin C6
- Program ROM pin C7; KESTREL chip pin C7
- Program ROM pin K0; KESTREL chip pin K0
- Program ROM pin K1; KESTREL chip pin K1
- Program ROM pin K2; KESTREL chip pin K2
- Program ROM pin K3; KESTREL chip pin K3
- Program ROM pin K4; KESTREL chip pin K4
- Program ROM pin K5; KESTREL chip pin K5
- Program ROM pin K6; KESTREL chip pin K6
- Program ROM pin K7; KESTREL chip pin K7
- KESTREL chip pin OUT0; Terminal pin D0
- KESTREL chip pin OUT1; Terminal pin D1
- KESTREL chip pin OUT2; Terminal pin D2
- KESTREL chip pin OUT3; Terminal pin D3
- KESTREL chip pin OUT4; Terminal pin D4
- KESTREL chip pin OUT5; Terminal pin D5
- KESTREL chip pin OUT6; Terminal pin D6
- KESTREL chip pin OUT7; Terminal pin D7
- KESTREL chip pin OUTW; Terminal pin WE
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.