The Blinking Computer: 2026 design

Draft of 13 Nov 2026. Markdown source for blinkingcomputer.org.

Summary

Electrical rules

The bus

Sixteen lines BUS0..BUS15, active high, 1k pull-up to 3.3 V on each.

Pico 2 pins

These are the CPU-facing pins. The I/O section explains why the final board is likely an RP2350B with more GPIO rather than a Pico 2.

Signal Direction Count Meaning
BUS0..15 both 16 the bus
TICK out 1 a 1.5 µs low pulse into the tick shaper's base when the panel switch selects the Pico as clock source
READY out 1 the handshake: raised when the Pico has finished with the bus in this phase, dropped when it has released the bus
SET1 in 1 held high by the strobe generator from "latched" until READY drops
SET2 in 1 held high by the strobe generator from "phase advanced" until READY rises
RESET out 1 clear P, the flags, the ring and the strobe generator; set ring stage 0
MEMREQ in 1 the current phase is a memory access: fetch, operand or write-back, address then data (the fetch phases included from 27 Nov 2026)
WRITE in 1 this memory phase is the data of a write: sample the bus instead of driving it (added 27 Nov 2026)
PHASE0 in 1 ring slave 0, for the probe: marks an instruction; the memory does not need it
total 24 of 26 available

The CLR1 and CLR2 strobes are made on the CPU and never reach the Pico. Before 15 Nov 2026 the Pico drove all four strobes; the count is unchanged.

Host communication is over USB serial, no pins.

Storage cells

Naming: a cell is transistors TA and TB, cross-coupled. Node NA is TA's collector, NB is TB's collector. Bit = 1 means TA on, NA low, NB high. The LED on TA's collector lights for 1, the LED on TB's collector lights for 0.

Register bit, 4 transistors

Part Connections
TA base from NB via 10k; collector NA with LED+1k to 5 V; emitter on the register's lift line ER
TB base from NA via 10k; collector NB with LED+1k to 5 V; emitter to ground
TSET base from BUSn via 47k; collector to NA; emitter on the register's write line WE
TREAD base from NA via 10k; collector to BUSn; emitter on the register's read line RE

TSET can only write a 1. Clearing is done for the whole register by one transistor TLIFT in the return of the ER line: TLIFT is normally saturated (base via 1k to 5 V); pulling its base low floats the sixteen TA emitters and every bit falls to 0. A write is therefore: lift (all bits to 0), then set (the 1 bits from the bus).

TREAD conducts when the bit is 0 and RE is active, pulling the bus low. So the bus shows the register value.

Per register: 16 bits x 4 plus TLIFT, the WE driver and the RE driver = 67.

Latch bit, 3 transistors

IR, IN0 and IN1 are register bits without TREAD. Their outputs are taken straight from NA and NB, which gives both polarities free. Per latch: 16 x 3 plus lift and WE drivers = 50.

Flag and carry-in bits

eq0, lt0, carry and CIN are single latch bits (3 transistors each) with their own lift and set gating.

Line currents

Ring counter

Thirteen one-hot stages, each a master latch bit and a slave latch bit (3 transistors each).

The master-slave arrangement means the SET1 strobe can be arbitrarily long without the token rippling through. 13 x 6 plus four line drivers plus reset = 84 transistors.

Clock and strobe generator

The CPU makes its own timing edges. Decided 15 Nov 2026, replacing a design in which the Pico made every edge; the reasons are at the end of this section.

The handshake uses the two SET strobes as request levels, which is why the Pico reads SET1 and SET2 and no extra request wire is needed:

  1. The generator advances the ring and holds SET2 high. The Pico sees SET2 high: new phase, the bus is valid once the pull-ups settle. It drives the bus if this is a memory data phase it owns, samples the bus for the analyser, and raises READY.
  2. The generator waits for READY and for the next tick, then drops SET2, pulses CLR1 and holds SET1 high. The Pico sees SET1 high: latched. It drops READY, and keeps driving the bus.
  3. The generator sees READY low, drops SET1, pulses CLR2 and holds SET2 high, which is step 1 again. The Pico sees SET1 low and only then releases the bus.

The order in step 2 matters, found by simulation on 18 Nov 2026: a set transistor can only write a 1, and the latch is transparent for the whole SET1 hold, so a bus released while SET1 is still high floats high and writes all ones. The same rule binds every bus source: whatever drives the bus in a phase holds it until SET1 has fallen. Register and ALU sources do so by construction, because their enable lines follow the phase; the host does so by watching the SET1 pin.

The generator never moves without the Pico's answer, so a slow or paused Pico lengthens a phase and can never miss one. The Pico can stop at the two points a class wants, "on the bus" by withholding READY and "latched" by holding READY high. The analyser works at every speed, because the Pico answers in microseconds and the oscillator sets the pace. RESET clears the generator to the state with SET2 held.

Why a real clock rather than the Pico making every edge:

One instruction, phase by phase

The Pico performs one phase as: wait for SET2 high; if MEMREQ is high and this is the first phase of a pair, wait for the bus to settle, about 3 µs with the diode carry, and latch it as the address; if it is the second, drive the word at that address, or if WRITE is high sample the bus and store it; sample the bus in every phase for the analyser; raise READY; wait for SET1 high; drop READY; wait for SET1 low; release the bus. That is the whole of the memory's rule (27 Nov 2026, see "The host as a RAM"): it counts no phases and knows no instruction. The strobes themselves come from the clock and strobe generator, and the speed is the oscillator or the Pico's tick rate.

INC2 means: the instruction read through P and did not execute a direct write to P, exactly the emulator's rule.

F Name Bus driven by MEMREQ Pico, before READY Written at SET1
0 FETCH-A P 1 sample address
1 FETCH-D Pico, m[address] 1 drive IR
2 INC-LD P 0 IN0; IN1 lifted only, so 0
3 INC-WB ALU, ADD with carry-in 1 0 P
4 OP0-A src0 register or constant isrc0 sample address if MEMREQ
5 OP0-D Pico if isrc0, else src0 again isrc0 drive if MEMREQ IN0
6 OP1-A src1 register or constant isrc1 sample address if MEMREQ
7 OP1-D Pico if isrc1, else src1 again isrc1 drive if MEMREQ IN1
8 CIN nothing 0 CIN from the op and the carry flag; EXEC from the condition field and the flags
9 WB-A dst register or constant if idst idst and exec sample address if MEMREQ
10 WB-D ALU if EXEC idst and EXEC sample data if MEMREQ, store it, OS call if address is 0xFFFF dst register if EXEC and not idst and dst is P A B or C; flags if EXEC
11 INC2-LD P if INC2 0 IN0; IN1 lifted, if INC2
12 INC2-WB ALU, ADD with carry-in 1, if INC2 0 P if INC2

Notes. - The carry flag is never read by the ALU directly. F8 copies the right carry-in into CIN, so updating the carry flag in F10 cannot disturb the result that is being written in the same strobe. - For the same reason exec is latched at F8, into EXEC, with the same strobes as CIN. Found by the whole-machine simulation on 18 Nov 2026: a conditional jump taken on lt0 writes a result that clears lt0; with exec computed live it dropped between the lift and the set of F10, so neither P nor the flags were set, and P held the zero the lift had left. It happened to be the right jump target. From F9 on, everything that was gated by exec, the write-back address and data, the register and flag writes, the ALU enables and INC2, is gated by EXEC. - The increment phases force the ALU to ADD and force carry-in to 1 by wired-OR onto the control lines, and never touch the flags. - Non-executed instructions still walk every phase and still get INC2, as in the emulator.

ALU, per bit

Inputs a and not-a from IN0, b and not-b from IN1, cin from the bit below. Gates are RTL with diode AND-OR fan-in, one transistor each: each AND term is a pulled-up node with a diode to each input, an OR diode from each term feeds the base, and a second series diode in the base path shifts the level back down so the off-state base sits near 0 V. Simulation on 17 Nov 2026 showed that with only one diode of level shift two half-true terms turn the gate on; the second diode is the classic DTL fix and costs one diode per gate. Result drivers are open collectors onto the bus; a driver pulls its bus line low when the result bit is 0, so each driver's base wants the complement of the result, and in most cases that complement is already available.

Transistors Produces
2 b' = b for ADD ADC, not-b for SUB SBC; both polarities
2 x = a xor b'; both polarities
1 not-sum = not(x xor cin), which is exactly what the SUM driver needs
2 the carry: cout = majority(a, b', cin) and not-cout = majority(not-a, not-b', not-cin), each one AND-OR-invert gate, so one gate delay per bit in both polarities and nothing leaves the bit slice
1 SUM driver, base from not-sum
1 AND driver, base from the diode OR of not-a and not-b
1 OR driver, base from the diode AND of not-a and not-b
1 XOR driver, base from not-x
1 SHIFT driver, base from not-a of bit n+1
12 per bit, 192 for 16 bits, plus 7 enable line drivers and 3 for the bit 15 shift input

Decode and control

Decode uses both polarities of every IR bit, which the latch gives free. Diode AND of three IR bits plus one transistor makes one select line.

Instruction set

The rule is: as many instructions as the 16 opcode slots allow, provided each is cheap in transistors. Most instructions cost one open-collector driver per bit, about 17 transistors, and some cost almost nothing because they are wiring.

Code Mnemonic Result Carry Cost beyond the adder
0000 AND a and b 17
0001 LSR a >> 1, bit 15 = 0 a0 17, shared with ASR and ROR
0010 ADC a + b + C carry out
0011 SBC a - b - C borrow out
0100 XOR a xor b 17
0101 OR a or b 17
0110 ROR a >> 1, bit 15 = C a0 3
0111 ASR a >> 1, bit 15 = a15 a0 2
10cc ADD a + b, conditional on cc
11cc SUB a - b, conditional on cc

cc is 00 always, 01 lt0, 10 eq0, 11 ne0. The carry flag is a borrow flag after SBC: set when a is less than b, as the emulator has always done. Changes from emu/emu.c: ROR and ASR replace HCF0 and HCF1, and the right shifts now write the carry. HCF, exit and all I/O stay as writes to 0xFFFF, which the Pico services.

Things that are already free and need no opcode: move is ADD 0, compare is a write to a constant register, shift left is ADD with both sources the same, rotate left through carry is ADC with both sources the same, negate is 0 SUB x. Bitwise NOT is two instructions and would cost 17 transistors to add; it is the first candidate if a slot is ever freed.

Transistor budget

Block Count
P A B C 268
IR IN0 IN1 150
flags, CIN 16
ring counter 84
clock and strobe generator 29
ALU 202
decode and control 65
bus indicators 16
reset and misc 5
total about 825

LEDs about 760. At 3 mA each the worst case is 2.2 A at 5 V, in practice about half light at once. A 5 V 3 A supply.

Pico firmware

C with the Pico SDK.

The Pico as logic analyser

The build will have mistakes in it, and schools building it will have more. So the Pico checks the hardware against the reference emulator at every phase, not just when it services memory, and stops on the first disagreement.

The Pico runs a copy of emu.c in lock step with the ring counter. It samples the bus in every phase, whether or not it is a memory phase, because the bus carries something checkable in almost all of them:

F What is on the bus Checked against Which block is suspect if wrong
0 P emulator P register P, its read line, or whatever last wrote P
1 the instruction the Pico drove nothing, but IR is checked through everything below
2 P emulator P register P
3 P + 1 from the ALU emulator P + 1 adder, carry-in forcing, IN0 or IN1 load
4 src0 register or constant emulator r[src0] that register, src0 decode, constant diodes
5 src0 again or memory data emulator operand 0 as above, or the Pico bus drive
6, 7 as 4 and 5 for src1 emulator operand 1
9 dst register if idst emulator r[dst] that register, dst decode
10 ALU result if exec emulator result ALU op decode, that op's drivers, CIN, exec logic
11, 12 P and P + 1 if INC2 emulator P INC2 logic

It also checks MEMREQ and WRITE in every phase against what the instruction says they should be, which tests the decode of isrc0, isrc1, idst and exec, and it checks that PHASE0 comes back exactly every 13 phases, which tests the ring.

The latches themselves are checked indirectly: a bad IN0 shows up at F10, a bad IR shows up as wrong operands, wrong MEMREQ or a wrong result, and a bad register shows up the next time it is read. Between them these checks cover every transistor in the machine within one or two instructions of it going wrong.

On a mismatch the Pico holds the clock, so the LEDs freeze at the failing phase for probing, and reports over USB serial: the instruction address and its disassembly in the asm.py notation, the phase name, the expected and seen bus values in binary with the differing bits marked, and the suspect block from the table above. Commands then let you continue ignoring the error, single step onwards, or reset. The same machinery gives self-tests that need no program: walk a 1 across the bus, write and read back each register with random words, and run the ring on its own.

Software stack

Three layers, each visible to a student and each runnable on the emulator and on the hardware.

Layer What it is State
Assembler asm.py, one line per instruction in A = B ADD C form done
Forth sys.4th and forth2asm.py, threaded code with the data stack in B, the call stack in C and the execution pointer in A; words for 16 and 32 bit integer arithmetic, a 24-bit float format, text output done, 247 tests
C chibicc with a new back end that emits the threaded-code layer; emu/cc.sh compiles and runs a program working, 13 Nov 2026: integers, longs, pointers, arrays, structs, switch, function pointers, printf

C is the right top layer: it is standard, it is the original portable assembler, it has no large runtime of its own, and it is what schools and the museum will recognise.

How the C compiler works

Decision, 13 Nov 2026: port chibicc rather than write a compiler from scratch or retarget TinyCC. chibicc is about nine thousand lines of C under the MIT licence, supports most of C11, and was written as a teaching compiler with one feature per commit, which suits the project. The port lives in chibicc/ with the changes listed in chibicc/BLINKING.md; the front end is untouched apart from type sizes, and codegen.c is new.

Each C function becomes one colon definition. Expressions are evaluated on the data stack, so a + b is literally the Forth +. A function's arguments and locals are a frame on the data stack addressed through a frame pointer cell, with the words enter, leave, fload, fstore and faddr in emu/clib.4th doing the work. Names defined in C get a c_ prefix so they cannot collide with runtime words; a C declaration with no definition names a runtime word directly, which is how putc and putd are called. printf with a literal format is expanded at compile time into the runtime's output words, so no formatting code runs on the machine.

Type sizes follow the machine, which is word addressed with no bytes:

C type Words Notes
char, short, int 1 CHAR_BIT is 16, which C permits
long 2 high word first in memory and on the stack
pointers 1 addressing 64K words
float not yet; the Forth F3 and F2 formats are the candidates

Not yet supported: floating point, variadic functions other than printf, structs passed or returned by value, bitfields, alloca and variable length arrays.

Testing: emu/ctest.sh compiles and runs every program in emu/ctest/ and compares the output with the // out line in the source; emu/clibtest.sh runs the tests embedded in clib.4th; emu/utest.sh is unchanged and still passes. The emulator's SBC sets the carry on a borrow, which the runtime words and the ISA table above now both state.

System calls

A write to 0xFFFF is a system call serviced by the Pico, with arguments in the low words of memory as emu.c does now. The C library is therefore mostly on the Pico: putchar, getchar, puts, printf's formatting, string functions, and anything else that would cost more machine code than it teaches. A student can still write their own printf in C if the lesson is about printf.

The levels a C program runs at

Decision, 19 Nov 2026. The same C source runs at four levels, and the levels are the switch between "is the display real" and "is the CPU real". The last of the four is itself a ladder, below.

Level Compiler Runs on Display Speed What it proves
1 gcc on the Pi the ARM, writing straight into the Blinking memory the host draws the memory millions of instructions a second the memory map and the display work
2 chibicc for the Blinking CPU the emulator on the ARM, inside the host program the host draws the memory hundreds of thousands a second the compiler, runtime and program are right
3 chibicc for the Blinking CPU the Blinking CPU, with putchar as a host call the host keeps the cursor and draws about 6,000 a second, ~1,000 characters a second the CPU runs the program
4 chibicc for the Blinking CPU the Blinking CPU, drawing by writing to memory the CPU itself, word by word about 6,000 a second, 75 to 500 characters a second the CPU has the screen address and the glyph in its registers, visibly

Speed on the Blinking CPU is therefore not a problem: anything that needs to be fast runs at level 1 or 2, and levels 3 and 4 exist to be watched. The lesson at level 4 is the one the LEDs are for. A C program writes a word wherever it is told, *(unsigned *)0xE000 = 'H' is legal C, and because the machine is word addressed with a 16-bit char, that one statement is one store into the top left cell of a text screen. On the LEDs it is the address 0xE000 appearing in a register, the word 0x0048 on the bus, and the H appearing on the HDMI screen on the next frame. Nothing else in the project shows the whole stack at once as directly as that.

The levels differ in only three choices, and all three are made outside the program:

Level 4 is a ladder, 19 Nov 2026. "Run on the Blinking CPU" has rungs below it, each slower and each showing more, and the mode line and its keys walk down them:

Rung What runs What you see
4a the CPU on its own clock the program, the LEDs as a blur
4b one instruction per key P, IR and the registers settle once per key; the display changes a character at a time
4c one phase per key, the 13-phase ring the token moves one LED; the bus shows what this phase carries; stopping before or after SET1 shows "on the bus" and then "latched"
4d one phase, with an oscilloscope on it a simulated panel on the screen beside the real one, and a voltage trace for any node you point at, from ngspice

Rung 4d is the bottom, and it is the one the LEDs cannot show by themselves: an LED says on or off, a trace says how, in how long, through what. Two things make it possible. The whole machine is one generated netlist, sim/cpu.py, which is also the schematic and the PCB source, so the host can draw every LED of the panel on the screen at its real position from the same file, lit from the emulator's state, and the simulated panel is a second display mode of the host. And at a phase step the host knows the logic state of every node at the start of the phase, because the emulator runs in lock step, so it does not need to simulate the whole machine to show one trace. It takes the gates around the chosen node, a slice or a ring stage or the generator, drives their inputs from the known state with ideal sources, and runs ngspice on that sub-netlist for the 12 µs of one phase. The full machine takes twelve minutes a millisecond on a server; a slice for one phase is a fraction of a second even on the Pi. ngspice is packaged for arm64 Debian, so it runs on the Pi Zero itself, and the trace appears a second or so after the key. Measured on the Pi Zero 2 W on 19 Nov 2026 with ngspice 44.2 from Debian 13:

Netlist Transistors Simulated time Pi Zero 2 W Server
one ALU slice with its inputs, sim/scope1.cir 12 + 6 sources 12 µs, one phase 0.56 s 0.16 s
four ALU slices, sim/alu.cir 48 45 µs 14 s
the 16-bit ALU, sim/alu16.cir 195 40 µs 138 s
the whole machine, sim/cpu.py --stop 60 887 60 µs 480 s 33 s

So the sub-netlist is the only way on the Pi, and it is comfortably fast enough: half a second for a slice, and the 1,200-point trace it writes is more than a screen can show. A ring stage or the generator is the same size. The whole machine for one phase is eight minutes on the Pi, which is the reason the host simulates the neighbourhood of a node and not the machine. The class points at a light, presses the key, and sees the carry ripple arrive as a voltage, the 0.3 µs a gate takes to come out of saturation, and the 0.6 µs a cell takes to clear. The real panel and the simulated panel sit side by side and are supposed to agree; when they do not, the analyser has already said which block to suspect.

Levels 1 and 2 are also what makes the machine debuggable before it exists and after it breaks: the host is already running the emulator at level 2 to check the hardware phase by phase, so every program has a reference run to compare against. How the user switches levels: a mode line, decided 19 Nov 2026. On either board, Pico or Pi Zero (both now in hand), the host builds the HDMI picture from the Blinking memory, so it can add a line of its own above or below the program's screen. That line is drawn by the host, lives outside the CPU's 64K, costs the program nothing and cannot be overwritten by it. It shows the level (ARM, EMU or CPU), the run state (running, stepping by phase, stepping by instruction, stopped by the analyser), the clock rate, the current phase and the values of P and IR, and the loaded program's name. A key per level switches the level and reloads the program, and the stepping keys are the same ones the firmware section already lists, so the keyboard that types into the program also drives the machine. Which keys is a detail for the host program; what matters is that no laptop is needed.

Input and output

The Pico 2 has 26 GPIO and the CPU interface uses 23. The RP2350's video output, HSTX, needs eight of them, GPIO 12 to 19, so a single Pico 2 cannot do both. Two ways forward:

Decision, 13 Nov 2026: one RP2350B board with HDMI, so the machine stands alone with its own screen and keyboard, which is the demonstration that matters. It costs about £15 in the UK, 15 percent of the budget, and buys both the video output and the spare pins. A laptop over USB serial remains the fallback and the debug channel.

The display

From the program's point of view a display mode is a logical resolution and a memory layout, nothing more. The host board, Pico or Pi Zero, turns that memory into a 640 by 480 or 800 by 600 picture by repeating pixels, and the program never sees the output timing. What the program does see is the memory: a 320 by 240 one-bit screen is 4800 words, a 640 by 480 one is 19200, and in a 64K-word machine that factor of four is the difference between a screen a program can afford and one it cannot.

Screen modes

The mode a program chooses is the logical resolution and the rows per text line; the output timing underneath is fixed, 640 by 480 at 60 Hz on either board or 800 by 600 where the board allows it, and the host repeats each logical pixel a whole number of times horizontally and vertically to fill it. Because the renderer builds every scan line, the two scales need not be equal and the rows per text line can be anything from 8 up. Cell sizes assume a 4:3 picture pillarboxed on a 16:9 monitor of the stated diagonal; a projector with a 1.5 m high picture multiplies the 24" figures by five. The rule of thumb for reading is 25 mm of letter height for every 3 m of viewing distance, so a 32" monitor in 2×2 serves the front half of a classroom and a projector or 4×4 serves the back. The last column is the size of a one-bit-per-pixel bitmap in 16-bit words: at 320 by 240 and below the whole screen fits comfortably in the discrete CPU's 64K words, so a program can draw pixels as well as characters, as a BBC Micro program did in Mode 4.

Output Pixel scale x×y Logical pixels Rows per line Text cols×lines Cell on 24" (mm) Cell on 32" (mm) 1-bit bitmap (words) Note
640×480 1×1 640×480 8 80×60 5×5 7×7 19200 the crowded 1980s look; BBC Mode 0 was 80×32
640×480 1×1 640×480 10 80×48 5×5 7×7 19200 80 columns with a gap between lines
640×480 1×1 640×480 12 80×40 5×5 7×7 19200
640×480 1×2 640×240 8 80×30 5×10 7×13 9600 tall thin characters, like a 1980s 80-column terminal
640×480 2×2 320×240 8 40×30 10×10 13×13 4800 the home mode; BBC Mode 1 and 4 were 40×32
640×480 2×2 320×240 10 40×24 10×10 13×13 4800
640×480 2×2 320×240 12 40×20 10×10 13×13 4800
640×480 2×3 320×160 8 40×20 10×15 13×20 3200 double-height text
640×480 4×4 160×120 8 20×15 20×20 27×27 1200 demonstration size
640×480 4×4 160×120 10 20×12 20×20 27×27 1200
640×480 5×5 128×96 8 16×12 25×25 33×33 768 the biggest that still shows a line of code
800×600 1×1 800×600 8 100×75 4×4 5×5 30000 100 columns
800×600 1×1 800×600 10 100×60 4×4 5×5 30000
800×600 1×1 800×600 12 100×50 4×4 5×5 30000
800×600 2×2 400×300 8 50×37 8×8 11×11 7500
800×600 2×2 400×300 10 50×30 8×8 11×11 7500
800×600 2×2 400×300 12 50×25 8×8 11×11 7500
800×600 4×4 200×150 8 25×18 16×16 21×21 1875
800×600 4×4 200×150 10 25×15 16×16 21×21 1875
800×600 5×5 160×120 8 20×15 20×20 27×27 1200

Modes are software, so the list is not fixed. The cases to support first are 2×2 with 8 and 10 rows per line as the everyday text screens, 1×1 at 8 rows for the authentic crowded look, and 4×4 for demonstrations.

What the machine cannot do is run Doom. Doom drew 320 by 200 pixels 35 times a second on a 486, some tens of millions of operations a second. The discrete CPU executes a few thousand instructions a second at speeds where the LEDs can be followed, and tens of thousands at most, with no multiply instruction. Clearing a 320 by 240 one-bit screen is 4800 word writes, about half a second; one Doom frame would take minutes. The Pi Zero alongside it runs Doom without noticing, which is itself a lesson about forty years of progress.

A class that cannot read the LEDs from the back of the room can also have the registers and phase drawn on the screen beside the program's output.

Framebuffer and web, 21 Nov 2026

The user's division of the display and hardware options into two sets that can each be built:

The question is then where the computation runs, and the answer is by weight of computation, not by principle:

Computation Where Why
the emulator, emu/emu.c browser a few hundred lines of C; Emscripten gives WebAssembly, or a JavaScript rewrite; millions of instructions a second
a logic-level twin of the 887 transistors, one light each, stepping with the phase table browser derived from sim/cpu.py as the netlist is; a gate evaluation is nanoseconds; this is the web page's main view
ngspice on one gate, one latch, one ring stage, one slice browser ngspice compiles to WebAssembly without modification and runs client-side: EEcircuit, MIT, formerly EEsim, with its engine on npm as eecircuit-engine; WebSpice is built on it; there is also wokwi/ngspice-wasm and an unstable upstream patch. The small netlists in sim/ run in seconds natively and a few times slower in WebAssembly, which is single-threaded and without OpenMP, so still seconds
ngspice on the whole machine server, in advance 1.3 ms of the 887-transistor netlist is twelve minutes native, so half an hour or more in a browser; run it once, serve the traces, and the page plays them back against the twin
the real machine the Pi, streamed the Pi Zero W and 2 W have Wi-Fi and the original Zero has USB gadget Ethernet, so the same host program that draws the framebuffer can serve the analyser stream over a websocket to the web page; the RP2350-PiZero has no radio, so it is framebuffer only

The rule that keeps the two sets one project: the panel is drawn from one description. sim/cpu.py already knows every transistor and will know every LED's position once the tiles are laid out, so it emits the SVG the web page shows and the coordinate table the framebuffer code uses, and a light means the same thing in both. The web page's twin, the framebuffer's view of the real machine, and the ngspice traces then line up light for light.

A page you can click, 21 Nov 2026

The user's reading of the above: this can be built now, before anything is soldered, and the whole machine in ngspice at once was never wanted, because it would be information overload for a student who wants to play. What is wanted is to click on a few components and run one step.

The mechanism is mixed-level simulation with the twin providing the stimulus:

  1. The generator emits the twin. sim/cpu.py builds the machine from a dozen primitives, inv, nor, aoi, cell, setq, latchbit, driver, lifter, pulldown, oc33, cond and srstage. Beside the SPICE netlist it emits the same calls as a logic netlist, one record per primitive with its type, inputs, output, block and whether it carries an LED. Nothing is drawn twice.
  2. The twin runs in the browser. A dozen JavaScript functions evaluate the primitives; a step is one phase of the ring, later one bit of the serial walk, or one instruction. Every LED is a light that is the output of its primitive. This is the page's resting state: the machine stepping, with the emulator alongside confirming the registers.
  3. Clicking cuts out a netlist. The clicked primitives, plus their resistors, diodes and LEDs, become a SPICE netlist with the generator's own component values. Every node on the boundary is driven by a piecewise-linear source made from the twin's values before and after the step, with the edge times measured in the Simulation section. ngspice in WebAssembly runs the step, about 15 µs of simulated time, and the page draws the waveforms on the clicked components and plays the LEDs at true brightness.
  4. Cost. Native ngspice on the existing test netlists: one cell for 50 µs in 0.06 s, a 16-bit register on the full bus for 50 µs in 2 s, the 16-bit ALU for 40 µs in 4.9 s. A clicked set of a dozen transistors for one phase is therefore about a second natively and a few seconds in WebAssembly, which is the pace of a click.

This is independent of the parallel-or-serial decision: the primitives are the same in both, the twin is read from the generator, and it follows whichever machine the generator describes. The emulator comes first because it exists; the twin second because it is the generator's output; the click-and-run third. It is also the test of the generator before the boards are made, since a twin that steps the phase table wrongly is a generator error found for nothing.

Built, 21 Nov 2026, the same day: blinkingcomputer.org/web/. sim/cpu.py --twin records every primitive as it emits it, with the netlist lines it produced, so the generator's output is unchanged byte for byte and web/machine.json is a second view of the same calls. web/twin.js gives the dozen primitive types their logic meaning and steps the strobe sequence the way the hardware does: tick, A with CLR1, the timer, B with SET1, the host dropping READY, C with CLR2, the timer, D with SET2, the host's duties for the new phase and READY again. The only abstractions are the RC timers, the astable and the host, which are the stepper's inputs on the real board too. It is event-driven, about 500 evaluations a phase and 2,000 instructions a second in node. The page has the four panels the user asked for: the screen the Pi would draw, 4:3 at 40 by 30 in the Blink font, with the registers, the phase, the decoded instruction and the flags under the program's output; the signals as a logic analyser, one column per settle of the machine; the panel of sixteen slices and the control board with its 547 LEDs lit from the twin, placed by block from the floor plan; and a close-up that follows the pointer where components are clicked. The ngspice button cuts the clicked components out of the netlist with the pull-ups of the lines they drive, puts a piecewise-linear source on every boundary node from the twin's history of the last two phases, and runs it in the browser with ngspice compiled to WebAssembly (EEcircuit's engine, MIT, 20 MB loaded on first use); the same cut-out run through native ngspice agrees with the twin (web/test.js).

The twin was checked against the emulator before anything was drawn: web/compare.py runs each of the twelve compiled C tests on both and compares the register trace instruction by instruction. All agree, over 100,000 instructions. On the way it found the first bug of the day in the emulator rather than the hardware: emu.c computed eq0 on the unmasked sum, so an ADD that wraps to 0x0000 left the flag clear where the hardware's 16-diode OR of the bus sets it, and a Forth word, limitS2S1, had an underflow test that only passed because of it. Both are corrected and utest.sh and ctest.sh pass. This is the generator being tested before a board exists, as intended, except that the first error it found was in the reference.

The machine on the web, 21 Nov 2026

The user asked whether one physical machine could talk to one Pi Zero and be driven from a browser. Yes, and nothing new is needed on the panel, because the Pi is already the host: it holds the memory, it sees all sixteen bus bits and every strobe on its GPIO, it is the logic analyser, and in STEP mode it makes every tick. A web server on the Pi exposes what it already has:

Which host does this: the Zero W and the Zero 2 W over Wi-Fi. The original Zero without the W has no radio and reaches a network only as a USB gadget on a PC, so it is a framebuffer host. The RP2350-PiZero has no radio and no camera connector, so it too is framebuffer only. The camera is the one component in the kit box that a school might add and a museum would want.

Every LED named, 21 Nov 2026

Asked for: a name on every LED, on the page and on the boards, so that anyone can tell what each one is doing by looking at it; and whether printing the names makes the boards bigger. The layout rules above said the LEDs needed no label because each sits on the collector it reports; that is true for the person holding the schematic and not for the visitor, so the rule is revised.

The rule. An LED is in a collector load and lights when its collector is low. Its name is therefore the condition that is true when it is lit, and a complement is written here with a leading ~ and printed as an overbar (KiCad writes it ~{P7}; the page draws the bar). One rule per kind of part, applied by the page's model.js and by web/leds.js, which writes the table web/leds.tsv: board, block, name, node, and what it means when lit.

Names are 2 to 8 characters: 150 of two, 156 of three, 91 of four, 66 of five, 72 of six, 9 of seven and 3 of eight (SHIFT_EN and its complement, ~CARRYOP). On the page the names appear in the close-up as soon as it is zoomed to about two pixels a millimetre, shrunk to the room beside the LED, and the note under the close-up reads out the LED under the pointer: name, lit or dark, and the node.

Does it make the boards bigger? No, at the size the rest of the silkscreen is readable; yes by about six per cent if every name had to be read from a metre.

The boards drawn as boards, and the program pane, 21 Nov 2026

Asked for, the same afternoon: the bottom panels should look like the PCBs will, with the top-layer tracks visible so that one can see a part of the ALU working or a register being copied; a first example, loading a constant into A; a pane showing the program as the host holds it, the last instruction, the one executing and the next few, taking the register and strobe block off the screen so the screen is a clean 640 by 480 at two web pixels a pixel; and if room is short, shrink or hide the close-up and the signals until the instruction-level flow is right.

Every part placed. web/model.js now reads the generator's netlist lines, not just its primitives: 5,170 parts (887 transistors, the resistors, diodes, LEDs and capacitors). Each part has a slot of 7.3 by 6.5 mm, 0.47 cm², less than the floor plan's 0.8 cm² because the slot holds the part and the track beside it but not the margins, connectors and rails, which are separate; the two agree within the floor plan's own uncertainty, and the first KiCad tile calibrates both. A primitive's parts fill a tile column by column, inputs on the left, the transistor, then its load and LED on the right, which is the rule "placement follows the schematic" applied mechanically; a cell is two mirrored halves. Tiles are packed first-fit into the floor plan's rows and blocks: six columns to a slice, two slot rows to a register row and three to the ALU rows and the control board. The slice fits: a register bit is a cell of eight parts, a set transistor and a read transistor with their base resistors, four plus one plus one columns. IN0, IN1 and the constants rows grew by a millimetre or two for the grid (13, 13, 5 became 14, 14, 8; the ALU gave them up: 165 became 160, and still holds its 124 parts a slice in eight shelves). The control board's blocks are sized by packing them, which is a better estimate than the part-count weights the floor plan used.

Every signal routed, by rule. The bus runs down a spine at the right of each slice, every part that touches it reaching it by a stub; the control lines run up a rail beside the spine, one lane each, 0.48 mm apart, each lane only as far up as its highest consumer (the ALU enables and constants stop low, the register lines go on up), 23 lanes at the connector; nets that cross boards, the 16 bus bits, 27 control lines, carries in and out of the chain and the shift and SUBSEL signals, 50 in all, run in a backplane bundle in the 20 mm between the slices and the control board; a carry between neighbouring slices is a jumper across the 4 mm gap; everything else on a board is an L-route between its pins in order of x. Power is on the bottom layer and not drawn. This is the layout rules executed, not a routed board: tracks cross without bridges and run under parts, and the rail at 0.48 mm pitch is the one place the slice width is genuinely tight (23 lanes is 11 mm; the real board will taper the rail and put part of it on the bottom layer).

Lit from the twin. A track is drawn bright when the twin says its node is low, as the LED on it would be; a bus bit is drawn bright when it is 1, as the bus indicators are. So when A = *P ADD 0 reaches its write-back, the SUM_EN lane lights down every slice, the bus shows the constant, A_we lights to the sixteen set transistors, and the A cells flip. That is the picture the request asked for, with the program pane saying in words what the tracks are saying in light. Levels of detail: the whole panel shows boards, tracks and LEDs; from 1.6 px/mm the parts, from 2.2 the LED names, from 6 the resistor values and transistor types.

The program pane shows the host's memory around P: the last three instructions executed (the host keeps the fetch addresses), the one executing with its phase and what the phase does, the next eight, with operand words that follow an instruction reading through P shown as data and marked while they are on the bus. Under it: P, A, B, C in hex, binary and decimal, the bus, the flags, EXEC and MEMREQ, the strobe state and READY, the decoded IR, and the control lines that are active now (a lift line is active when high, the rest when low; at rest only set2 is active, because the machine rests in SET2). The screen is a clean 40 by 30 console, drawn at the largest integer scale that fits about 60 per cent of the window, 2 by 2 web pixels a pixel from about 1,750 px of height; the signals and close-up panels have show/hide buttons and the boards take the room.

First example. web/prog/const.asm: A = 1234 (one instruction, A = *P ADD 0, the constant in the next word, P stepping over it), B = A, C = A ADD B, A = C SUB B, P = start. Assembled with the emulator's assembler; the twin and the emulator agree on it instruction for instruction. It is the default program.

The function on every tile, the supplies on the silkscreen, 22 Nov 2026

Asked for: the function of the circuit has to be readable from the board. The Megaprocessor built its logic from boards for AND, NOR and so on and printed the gate symbol on each; we have much less room but should still name each tile's output, its inputs and the function between them. And if an LED (or any part) connects to V+, the silkscreen should say so, since power is on the bottom layer and otherwise invisible from the top.

Rule: a 1.5 mm strip above every tile carries its function, as output = f(inputs), in the node names the tracks carry. · is AND, + is OR, ~ is NOT, in 1 mm letters (JLCPCB's minimum). The forms, one per kind of primitive: a gate sel0_0 = ~(IR8nb + IR9nb + IR10nb) or aoi_977 = ~(Anb·s1nb); an inverter or pull-down busind0 = ~bus0; a line stage line errst = ~rstc; a diode AND condab = Dnb·ready·tick; a cell flip-flop IR0: IR0na = ~IR0nb; a set or read transistor Ana = 0 when condab, bus0 = 0 when IR0nb·~P_re (a transistor pulls its collector low when its base is high and its emitter is low, and the control lines are active low); an ALU transistor AND: bus0 = 0 when (IN00na + nbp0)·~AND_EN; a constant diode bus0 = 0 when ~K0; a pull-up pull-up bus0 1k; a timer tma = Anb delayed 10k 680p. The web page draws the strip from 5 px/mm and shows the same text when the pointer is over a tile.

Rule: a pad on a supply gets the supply's symbol beside it on the silkscreen: a bar above the pad for 5 V, the same bar with 3V3 for the 3.3 V rail, the three-line ground symbol below the pad for 0 V. An LED's anode pad therefore shows the bar; a transistor's emitter shows ground or nothing (an emitter on a control line has a track).

Cost. The strip adds 1.5 mm to every tile and, since tiles are packed in shelves, 1.5 mm to every shelf: the bus and constants rows go from 8 to 9 mm, IN0 and IN1 from 14 to 16, the ALU from 160 to 170; a slice is 299 mm long instead of 283, 5.7 per cent more; the control board is unchanged at 187 mm because its blocks had a shelf in hand. That is the honest answer to whether writing on the boards makes them bigger: the LED names did not, the function strips do, by about six per cent of slice length.

Where it does not fit. A one-column tile is 7.3 mm wide and a line such as SUM: bus0 = 0 when ns0·~SUM_EN is about 15 mm at 1 mm letters. The 265 single transistors and the 60 constant diodes are one column. On the page the text shrinks to three quarters and is then cut with an ellipsis; on the real silkscreen the KiCad tile must either run the text up the 8 mm side of the tile or abbreviate it to the base node, ns0·~SUM_EN, with the collector obvious from where the track goes. This is decided when the first tile is drawn in KiCad.

Tracks never cross a part, 22 Nov 2026, evening. Reading the close-up, the base track of bp4's transistor ran into a 47k with no way to tell which end it met, and SUM's 10k seemed not to reach the base at all: the chained L-routes ran their horizontal legs at pad height, which is along a resistor's own axis and under the transistor bodies. New rule: every pin first escapes straight out of its slot into the channel between slot rows (0.35 mm below the row line; a resistor, diode, LED or capacitor pin goes up, a transistor's pins, which are below its body, go down), and from there every run is horizontal along a channel or vertical down the gap between slot columns, the spine or a rail lane. A track therefore meets a part only at its pad, and taps are made away from the bodies, which is what a readable board needs. web/test.js now checks it: no track segment through a part body or over another net's pad, no two tiles overlapping. The overlap check found an older fault: on the control board, groups that share a block (the clock with the generator, the 29 line stages, the host pins with the host model) were each packed from the block's corner and lay on top of each other, and one gate of 33 parts was wider than its block. Both fixed; blocks are now at least as wide as their widest tile. Segments went from 12,186 to 27,754 for the escapes and the longer paths; the panel still draws in a frame.

Lanes, and the column pitch, 22 Nov 2026, later. With tracks kept out of the parts, the next thing seen in the close-up was two nets drawn on top of each other: at SUM's transistor the collector, base and emitter all escaped to the same channel and ran along it together, so base, emitter and collector looked wired together. Now a channel has three lanes 0.55 mm apart (the base lane 0.35 mm below the row line, the other two above it, between the transistor pins of the row above and the body of the row below) and two nets never take the same lane where they overlap; a net with pins in several rows is routed as a comb, one trunk along the channel with a free lane (its own, or one row beyond its pins) and a short branch from each pin down the nearest free column gap; the nets with most pins are planned first. A column gap between 1.6 mm pads is 0.62 mm wide at the 7.3 mm pitch and holds one track; three lanes need 1.15 mm, so the column pitch is 7.85 mm from today: a slice is 63 mm wide instead of 60, the panel 1,088 mm instead of 1,040, 4.6 per cent. At 7.3 the two outer lanes clip the pads, which the test counts (5,100 segments); at 7.85, none.

What is left is the honest measure of a one-layer top side at this density: the test reports 2,773 horizontal and 1,726 vertical pairs of track segments of different nets still drawn over each other, four fifths of them on the control board. Its blocks need two to three vertical tracks per column gap across a cut and the decode and line-stage blocks more, because a control line reaches sixteen cells. That is not a drawing problem; it is the statement that the control board's wiring needs its bottom layer (or a wider panel), and the slices mostly do not. The KiCad tile takes it from here; the page shows the rule, not a routed board.

Iterate on the page, not the boards, 22 Nov 2026, evening. Tony: the web view is better than seemed possible when we started and gives a real feel for what the machine will look like; it changes in minutes where a board changes in weeks, so the boards are decided on the page first, against a TODO list whose first item is to feel the difference between the 7.3 and 7.85 mm pitch. For that the page has a pitch selector (7.3, 7.85, 8.4: the model re-lays the panel in under 100 ms), a 1:1 button that draws the close-up life size on a 96 dpi screen, a scale bar in the close-up at every zoom, and the panel's and a slice's size in the boards panel's title. The pitch stays at 7.85 on the page until item 1 is decided.

Reading the tracks, and the close-up. Three colours, now in a key under the boards: a bright yellow track is a node that is low, which is the condition that lights its LED, so an active control line and the 0 side of every flip-flop are bright; a pale yellow track is a bus bit at 1; a khaki track is at rest. The glow on lit tracks is dropped at whole-panel scale, where it smeared one-pixel tracks together. The close-up now zooms from the wheel over the main display too, since that is where the pointer is when aiming it. Later the same day, the usual magnifier conventions: it follows the pointer over the boards; a click on the boards pins it there and a second click releases it; dragging the close-up moves it (and pins it); the wheel zooms about the pointer; and where the pointer rested is remembered, so going to a button does not drag an unpinned close-up to the edge.

Transistors face their resistors, and a pin escapes either way, 22 Nov 2026, late evening. The user read the flip-flop tile and saw its cross-coupling go up a column gap, across the channel above the resistors and down again, where a straight run would do. The cause was two fixed rules of the page's router: every TO-92 had its pins below its body, and every pin escaped into the channel above its row. A transistor in the row under its resistors therefore had to send its collector down, round its own body and up. Now each transistor is turned to face the row that most of its connections are in (795 of the 887 face up, towards resistors above them), a resistor, diode, LED or capacitor pin may escape into the channel above or below, and a net's trunk is the channel most of its pins can reach directly. The flip-flop's cross-coupling is one run in the channel between its two rows. The channel lanes are 0.35 and 0.9 mm below the row line and 0.2 and 0.75 mm above it; the outer two are closed where a transistor body is beside them, a run whose pins come from below takes the lower lanes first, and the lane choice counts the other nets its escapes would cut across. On the whole panel: track length 127 m to 114 m, different-net horizontals drawn over each other 2,773 to 338, verticals 1,726 to 976, runs inside a function strip 1,421 to 121. The user's note, that the lower the tracks stay at a tile's top the more room there is for the description, moved the strip's words to the top of the strip and made the lanes under a strip the last choice. The crossing count, now in the test, says what one layer cannot do: 46,000 places where two nets cross, most of them a channel run over a column-gap vertical and the known rail and backplane fans, and one per flip-flop that is inherent, the crossing every cross-coupled pair has on paper. Those go on the bottom layer with two vias, or wait for a real router. Two rules recorded in todo.md: the user is the first tester, and a longer track than necessary or an unreadable label is a defect. The list of candidate software, from Pong to Doom, is software.md.

The strip's words as large as they can be, 23 Nov 2026. The user, reading the new layout: dense tiles such as the flip-flops are very pretty, but a long function such as bp1 = ~(…SUBSEL) hit the tile's top edge, and the words cannot go lower because the lanes under the strip run there. So the tile outline lost its top edge: it is three sides, and the words sit where the edge was, 1.5 mm letters whose caps start 0.4 mm under the box above and whose descenders end above the lanes. Getting this text large is what makes every tile readable, so it takes the room. The bit numbers on the page's slices stay, though the sixteen real boards are identical and cannot carry them; on the machine the number goes on the frame above each slice.

Reading a gate, 23 Nov 2026. The user read the AND tile for bus 13 (two diodes into a 10 k into the transistor's base) and could not see what the diodes connected to: both inputs seemed to come from one line to the left and both outputs went to one line, so on plain reading they were in parallel, and the tracks had a small overshoot above every bend. Three things were wrong with the page's router and are fixed. An escape ran to the channel's base line even when its lane was nearer the pad, which made the overshoot. Two pins of one net in the same column, one above the other (the two cathodes), went out to a column gap and back instead of straight down through their own pads; now they are joined by a straight track when nothing is in the way, 361 such stacks on the panel. And the column gaps were shared: through traffic on its way to the board edge ran down the gaps between a tile's own columns, pushing the tile's own short verticals out to the tile's edge gap, where the inputs come in, so three nets lay 0.55 mm apart in one gap and read as one line. Now a resistor or diode is turned round when its pins then face what they join (1,831 of them), through traffic prefers the outer gaps and the trunk lanes, a tile's own nets prefer the gaps inside it, and an empty gap is preferred to a second lane in a shared one. The test counts verticals with another net alongside within 0.6 mm: 2,421 before, 2,038 after. Checking the clearance of those lanes found an error in the 22 Nov pitch note: three lanes in a 7.85 mm gap had been measured to the pad centre. Measured to the pad edge with 0.15 mm clear, a gap holds one track at 7.3, two at 7.85 and three at 8.4; the page now derives the count from the pitch and the test enforces the clearance, so at 7.85 the slices have two gap lanes and the residue of verticals drawn over each other rose from 724 to 1,457. That is the real trade in TODO item 1: 8.4 buys the third lane, at 67 mm a slice and a 1,152 mm panel.

A CHIP-8 interpreter, 23 Nov 2026

The user picked CHIP-8 from the software list and asked whether there was a C version to port. There are dozens (gsamokovarov/chip8.c is MIT and small), but every one is written round SDL and byte-typed memory, and CHIP-8 is 35 instructions, so it was quicker to write one against Cowgod's reference for this machine's C: emu/chip8.c, 190 lines. A CHIP-8 byte is one word, the 64 by 32 screen is 32 rows of four words that the host draws, the game is read from the input a byte a character, and the behaviour is the COSMAC VIP's (VF cleared by the logic ops, shifts from VY, I moved by the register save and load, sprites clipped at the edges). The host grew four calls for it (emu/os.h): ticks (1/60 s since the start, for the two timers), keys (a sixteen-bit mask of the hex pad), disp (register a one-bit frame buffer for the host to draw) and beep. On the emulator the frame buffer is printed as text at exit, BC_KEYS scripts the keypad and BC_STATS prints the instruction count.

It was checked against Timendus' test suite (GPL-3, kept with its licence in emu/chip8-tests/): the CHIP-8 logo, the IBM logo, corax+ (every opcode group) and flags (every arithmetic result and VF) and quirks (the six VIP behaviours, each checked on or off) all match the suite's pictures pixel for pixel, compared by cmp.py; emu/chip8test.sh runs them, with the emulator's clock set to one tick every 30,000 machine instructions (BC_TICK) so that a run is the same every time, and a sprite draw waiting for the next tick as the VIP waited for the next frame, which the quirks test checks for. The keypad test needs a person at the keys and is not run. Two bugs on the way, neither in the interpreter: the runtime's rnd writes through an uninitialised state pointer unless rndSeed has run first, which took the machine back to its cold start (so rand() needs srand(), now in bc.h), and a failed make emu deleted the old emulator binary, rebuilt with gcc -O2 -o emu emu.c -lm and the three suites rerun.

The cost, which is the answer to the user's doubt about the clock speed. The emulator counts machine instructions (measured before the frame wait was added, which on the real machine would never wait, the machine being far below sixty draws a second): the flags test runs 960 CHIP-8 instructions in 1.35 million of ours, 1,400 each; corax+ 1,900 each; the logos, which are all sprite drawing, 5,000 to 7,000 each. Start-up (the font, loading the game a byte at a time, one printf) is 18,000 plus about 60 a byte. A COSMAC VIP ran about 500 to 700 CHIP-8 instructions a second; this machine at the top of its oscillator, 3,000 to 6,000 instructions a second, would run two to four, so a game would run at a two-hundredth of its speed. The threaded-code layer that C compiles to is where the time goes: every C operation is a word of six or more machine instructions, and step() is some two hundred words. A CHIP-8 interpreter hand-written in the machine's assembler would be perhaps 150 to 300 instructions an operation, ten to forty a second, still twenty times slow. So the user is right: the machine has not the speed for CHIP-8 to be played, and Super-CHIP (the HP48's 128 by 64 extension, which has its own games, Blinky and Joust among them) is further off still. What CHIP-8 is good for here is the lesson, a virtual machine inside the machine with every register on the lights, and the test suite's ticks appearing on the screen one by one over a few minutes. The measurement also prices the compiler: a native-code back end for chibicc, or a word-level optimiser, would be worth five to ten times, which is the next thing to do if compiled programs are to run at a useful speed.

Is anything CHIP-8 close to playable? The user asked, pointing at Snek in John Earnest's chip8Archive (CC0). Measured on the interpreter with a scripted keypad, 23 Nov 2026, counting CHIP-8 instructions that are not idle waits for a key: Snek does about 30 instructions a snake step (two sprite draws and a timer wait), Mini Lights Out about 120 a move, Rock Paper Scissors about 280, Mastermind about 1,300 including its board drawing, and Br8kout, which is real time, runs 7 instructions a frame, 420 a second, with no waiting at all. At this machine's two to four CHIP-8 instructions a second in compiled C, a Lights Out move is half a minute and a Snek step ten seconds; nothing is playable. In hand assembler at ten to forty a second the turn-based games, Lights Out, Rock Paper Scissors and Mastermind, come down to three to thirty seconds a move, which is the pace of a slow chess computer and could be called playable; Snek would step every one to three seconds; anything real time stays out of reach. The same games written for the machine directly take fifty to a few hundred of its own instructions a move and are instant, which is the real answer: the virtual machine costs a factor of two hundred in assembler and fifteen hundred in C, and a game that is to be played goes straight on the machine.

Would translating CHIP-8 into the machine's own instructions beat a factor of two? The user asked, 23 Nov 2026. Costed rather than guessed, by writing the hot path of an interpreter in the assembler's notation and counting (emu/chip8cost.py holds the per-opcode costs and applies them to a trace). The interpreter's fetch, decode and dispatch is eleven instructions: two byte reads with the CHIP-8 counter in C, the two bytes saved in the scratch cells at addresses 1 and 2 (the constant registers 0 to 3 double as four absolute addresses, so *1 and *2 cost nothing), four LSRs for the top nibble, an add to the table and P = *A. A plain opcode then costs three to twelve more, so ADD VX, KK is sixteen instructions interpreted and three translated, a skip is eighteen against four, a jump twenty-five against one, a register-to-register op about thirty against six to twelve. Translation wins five to ten times on those. But the sprite draw is native code in both cases, about thirty-five instructions a row (load the byte, shift it into a sixteen-bit window by x mod 16, address the word, XOR, test the collision, spill into the next word, loop), and translation saves only the dispatch and the loop control. Over the five archive traces the draws are fifteen to sixty per cent of the interpreted time and up to eighty-six per cent of the translated, so the factor for whole games is 1.7 (Mini Lights Out, Rock Paper Scissors), 2.5 (Snek), 2.8 (Mastermind) and 3.9 (Br8kout, which is mostly control ops). So: more than two for most games, never ten, and the draw routine is what to work on either way. The costing also corrects the guess in the previous paragraphs: a hand-written interpreter comes to 25 to 50 of our instructions a CHIP-8 op, not 150 to 300, which is 60 to 240 ops a second at the oscillator's top. At that rate Snek steps three to seven times a second and Lights Out answers in a second or two, both playable; Mastermind takes six to twelve seconds a move; Br8kout needs 420 ops a second and is two to four times too slow interpreted, and runs at full speed translated at the top clock. These are counts of written-out code, not a run: the check is to write the interpreter in assembler, a few hundred lines, and run the archive games on the emulator.

A CHIP-8 interpreter in the machine's own instructions, 23 Nov 2026, evening

Decision: write it. The user: "These games are clearly basic, clearly old, yet clearly games that are running on transistors, and that's impressive." The result is emu/chip8.asm, about 330 lines of hand-written assembler, with emu/chip8tbl.py generating its tables, its unrolled routines and the CHIP-8 memory image with the game in it, emu/chip8asm.sh to build and run, and emu/chip8asmtest.sh as the test. It passes the same Timendus suite as the C version, pixel for pixel on the logo, IBM, corax+ and flags tests; the quirks test differs on its DISP.WAIT line only, because this interpreter does not wait for the frame (the machine never reaches sixty draws a second, so the wait would only cost). The five archive games play with a scripted keypad.

How it is written. C holds the CHIP-8 program counter as a machine address and B the low byte of the instruction; A is scratch. The constant registers 0 to 3 double as addresses, so *1, *2 and *3 are cells the handlers reach without loading a pointer: *1 is X, the register number, from the moment of dispatch. CHIP-8 memory is a byte a word at 0x1000, the sixteen V registers are the machine's words 16 to 31 so the address of VX is X OR 16, and the frame buffer is 32 rows of 4 words, the layout the host draws. Fetch, decode and dispatch is seven instructions: two byte reads, X masked into *1, and a jump through a 256-entry table indexed by the whole high byte, which saves the four shifts a nibble would cost. The same trade is made everywhere the machine would have to shift: ytbl[lo] gives the address of VY, hi8[x] gives NNN's top nibble already shifted and with the memory base added, and for sprites thi[s][byte] holds every byte already shifted into a 16-bit word for each of the sixteen positions it can start at, with tlo for the part that spills into the next word. So a sprite row is seven instructions when it stays in one word and thirteen when it spills, where the C version spent a few hundred: look the byte up, AND it with what is there and count a collision with a conditional add, XOR it in, step. The rows are not a loop but fifteen unrolled copies entered at the copy that leaves the right number to do, which spares the counter the machine has no register for. The timers are deadlines rather than counters: setting the delay timer records the tick at which it will reach zero, reading it is one host call and a subtract clamped at zero, and the sound is turned off when the program next reads the timer or the keys after its time. The random generator is a 16-bit shift register stepped left, with the taps applied through an all-ones mask made by a conditional subtract. In all, 613 words of handlers, 258 for the unrolled clear, 315 for the sprite rows, and 6,900 words of tables: the machine has 64K words and few instructions a second, so memory buys time.

Toolchain changes. asm.py now accepts a comment after a constant (A = CM+0x200 # ...), which the Forth path never needed because forth2asm.py strips them first; emu.c gained BC_MAXINST=n, which stops after n machine instructions and prints the frame buffer, so a program with no exit can be tested, and BC_COUNTPC=hex,hex,..., which counts how often each address is executed, so the number of dispatches is the number of CHIP-8 instructions run.

Measured. chip8asmtest.sh runs each game for a million or two machine instructions with a scripted keypad, counts the dispatch loop, and leaves out the idle polls in FX0A, which are the program waiting for a key:

Game Machine instructions a CHIP-8 instruction The game's own cost At 3,000 to 6,000 instructions a second
Snek 18.5 30 a step 5 to 11 steps a second: its own timer is the limit
Mini Lights Out 28.9 120 a move under a second a move
Rock Paper Scissors 25.3 280 a move one to two seconds
Mastermind 17.2 1,300 a move four to eight seconds
Br8kout 15.7 420 a second, real time 6,600 a second needed: half speed to nearly full

Against the compiled-C interpreter's 1,400 to 1,900 a CHIP-8 instruction that is sixty to a hundred times faster, and against the morning's costing of 25 to 50 it is better still, mostly because the shift tables took the sprite row from the estimated thirty-five instructions to seven. So the earlier conclusion reverses: four of the five games are playable on this machine at the top of its oscillator, and the real-time one nearly so. The games are kept in emu/chip8-games/ with their authors and the CC0 licence. What CHIP-8 now gives the project is a shelf of fifty-year-old games that run on 887 transistors, with the interpreter's own registers on the lights while they do, and the lesson in two interpreters for the same machine: the one written for the machine runs seventy times faster than the one compiled to it.

What remains for the games to be played rather than scripted: a keypad and a screen on the host, which is item 13 to 15 of the to-do list, and the page's twin showing the frame buffer.

A Raspberry Pi Zero instead of the Pico

The board that provides memory, clock and display need not be a microcontroller. A Raspberry Pi Zero 2 W costs the same as the RP2350-PiZero (about £15 in the UK, Nov 2026), has a real HDMI output and runs Linux. Both are kept as options; the 23 wires of the bus protocol are the same either way.

Physical form

BASIC, 25 Nov 2026

The user asked whether MatrixBrandy, the best BBC BASIC written in C, would compile under this machine's C, and whether the machine could boot into it with the BBC's screen: "Blinking Computer 64K", "BASIC", a > prompt. Brandy will not: it is 47,000 lines of C and 4,900 of headers, and this compiler makes about 18 words of code from a line of C (emu/chip8.c, 134 lines of code, is 2,400 words), so Brandy's code alone would be some 850,000 words against a 64K-word machine with about 53K free below the display. It also leans on everything the compiler lacks: doubles and 64-bit integers through the evaluator, variadic functions, setjmp, malloc with a default workspace of 64 MB, and a libc with stdio, termios and SDL under it; ours has ten functions. The small interpreters that would compile, ubasic and its kind, are Tiny BASIC, not BBC BASIC.

So the machine has its own: Blink BASIC, emu/basic.c, 770 lines of C, BBC-flavoured and integer only. Line numbers, PRINT with ; , ' TAB and SPC and the BBC's ten-column fields, INPUT, LET, IF THEN ELSE, FOR TO STEP NEXT, REPEAT UNTIL, WHILE ENDWHILE, GOTO, GOSUB RETURN, DEF PROC with parameters and ENDPROC, one-line DEF FN, DIM, REM, END, STOP, LIST, RUN, NEW, CLS, VDU; operators with the BBC's precedence including DIV, MOD, AND, OR, EOR, NOT, TRUE and FALSE as -1 and 0, &FF hex; functions RND, ABS, SGN, LEN, ASC, VAL, INSTR, TIME, GET, POS and the string functions CHR$, STR$, LEFT$, RIGHT$, MID$, STRING$, GET$; strings of up to 80 characters; and the BBC's error messages, "No such variable", "No FOR", "Subscript", "Missing )", with "at line n". Every variable is a 16-bit integer, so A, A% and count are the same kind of thing and 30000+30000 is -5536; there are no reals, which is the one departure from the BBC a schoolchild will meet. As on the BBC a line is tokenised as it is typed: a keyword, upper case and not run into a letter (TOTAL is a name), becomes one word of the stored program, an abbreviation with a full stop (P. for PRINT, L. for LIST) expands then, and LIST turns the tokens back into words. The program is text otherwise, kept in order with [number][text][0] records. The test emu/basictest.sh feeds basictest.bas (a program using every statement, RUN, two INPUT answers, LIST, then twenty immediate lines each ending in a different error) and compares with basictest.expected.

Booting into it is the host loading basic.bin, 25,800 words with the runtime, at reset; the emulator does exactly that, ./emu basic.bin, and the banner costs 10,000 machine instructions, under two seconds at the oscillator's top. The screen then reads as the user drew it. The speed, measured with BC_STATS: an empty FOR NEXT iteration is 3,300 machine instructions, S=1 4,700, S=S+I*2 10,500, PRINT I 11,600, so at 6,000 instructions a second a BASIC statement takes half a second to two seconds. That is the compiled-C cost measured on CHIP-8 again, and it is fine for the lesson (a FOR loop you can watch) and too slow for anything else; the way to a usable BASIC is the same as for CHIP-8, the interpreter in the machine's assembler, which there ran sixty times faster.

The compiler got three times faster on the way. The emulator gained BC_PROFILE=file, a count of how often every address runs, and matching the counts to the assembler listing showed where a BASIC loop's 1.5 million instructions went: pushing a literal 45,000 times (15%), loading a frame variable 27,000 times at ten instructions each (18%), conditional jumps 11%; a threaded word averages 5.7 instructions and the compiled loop ran 2,600 words an iteration. The generated code for pc++ was fload 1 1 * + dup fstore -1 1 * + drop: the pointer scale of one multiplied in software, and the post-increment's correction computed and dropped, because the code generator's checks for both missed the casts the parser wraps round every operand. Fixed in chibicc/codegen.c: constant subexpressions are folded, the unused correction is dropped, and x + 1, x - 1, x & m, x | m, x == c, x != c with a constant right side use the runtime's inline-operand words add(n), sub(n), and(n), or(n) and the new ==(n) and !=(n) in emu/clib.4th (four instructions instead of ten). S=S+I*2 went from 32,000 instructions to 10,500 with no change to the BASIC; the three test suites and chip8test.sh still pass. The next step on this road is the one the CHIP-8 measurement named: a back end that keeps values in registers or compiles to native instructions, worth another five to ten times.

The host as a RAM, and where the phases go, 27 Nov 2026

The user asked for a speaker on the machine, then for an analysis of what each of the 13 phases does. Those led to one decision about the host, two changes to the clock that are wanted but not yet designed, and a rule for the compiler.

The host is a RAM. Until today the host knew the phase table. It counted SET2 strobes from PHASE0 to know that F1 is fetch data, F5 and F7 are operand data and F10 is write data, which is a small emulation of the CPU inside the memory, and the user's test for the host is that it must do nothing a static RAM chip could not. Decided 27 Nov 2026: the fetch phases F0 and F1 raise MEMREQ like every other memory phase (they did not before), and a new line WRITE, F10 AND idst AND EXEC, goes to the host on GPIO 27, the Pi's last spare pin. The host's whole rule is then: MEMREQ phases come in pairs; in the first it latches the bus as the address; in the second it drives the word at that address, or if WRITE is high it samples the bus and stores it. It counts nothing and knows nothing about instructions, so a ring that took a different path through its phases would not disturb it. PHASE0 stays for the probe, which labels the analyser's samples and the program pane after the fact: interpretation is allowed, timing is not. Cost: the WRITE gate and its open collector, two transistors on the control board, 889 in all, and a 24th wire on ribbon A. The twin's host in web/twin.js follows the rule, and web/twintest.js runs the ten C test programs on the twin to completion, 107 thousand instructions, with the expected output; the SPICE host model in sim/cpu.py, host/pins.h and the GPIO code are changed to match. The replacement memory promised on 15 Nov, two SRAM chips and an address latch, is now literal wiring: latch on the first MEMREQ phase, output enable on the second, write enable from WRITE.

What the phases do. BC_PHASES=1 makes the emulator count, for every instruction executed, which phases had work. Blink BASIC running its test battery (8.2 million instructions), the CHIP-8 interpreter on a test ROM (2.4 million) and a small C test agree within a few points; the BASIC column:

F phase works when how often
0, 1 FETCH-A, FETCH-D always 100%
2, 3 INC-LD, INC-WB always 100%
4 OP0-A src0 in memory 60%
5 OP0-D always latches IN0 100%
6 OP1-A src1 in memory 9.5%
7 OP1-D latches IN1; 97% of the time a constant 0 or 1 100%
8 CIN bookkeeping, nothing on the bus 0%
9 WB-A dst in memory 28%
10 WB-D instruction executed 98.5%
11, 12 INC2-LD, INC2-WB operand word read through P 5.3%

Nine useful phases of thirteen: nearly four phases an instruction are the token walking through stages with nothing on the bus. The mix is the compiler's as much as the machine's. A move is ADD 0 because the Forth back end chose that, and 56% of all instructions are moves and 41% add 1; the memory figures (one operand read 60%, two 9%, result written 28%, operand word through P 5%) are properties of threaded code and a native back end would change them. The user's older idea of a single indirect operand with the sources swapped for commutative ops was costed against the same counts: 8.6% of instructions read two memory operands and 2.5% have only src0 indirect under SUB or SBC, so the program grows 11% while the ring loses two phases, a net 6%, and it spends a bit of the instruction word; not taken.

Phases are not equal. The timing of 19 Nov gave a ripple phase (F3, F10, F12) 12 µs and the other ten 7 µs, and the decided design waits 12 µs in every phase because the host cannot tell them apart. The user's point: the processor can. A diode OR of F3, F12 and F10·SUM_EN into one more RC delay stage in the strobe generator, holding the D to A transition for the carry and lighting an LED while it waits, says in hardware "the carry is rippling"; the host never knows. SUM_EN already distinguishes ADD, SUB, ADC and SBC from the logic ops and shifts, which settle in a gate or two, so F10 can wait only when it must. Skipping the idle phases is the other lever: at F4, F6, F9 and F11-F12, slave k-1 sets master k+1 instead of master k when the phase has nothing to do (not isrc0, not isrc1, not idst·EXEC, not INC2), a diode AND into each of two set transistors and both polarities of each condition. With the BASIC mix:

µs per instruction
13 phases at 12 µs, as decided 19 Nov 156
ripple phases 12 µs, the other ten 7 µs, timed in the generator 106
the same, with moves spelled OR 0 so F10 waits only for real additions 104
the same, with the four-bit lookahead carry (9 µs ripple phases) 97
skipping idle phases, all phases 12 µs 109
kind-timed and skipping together 74

The op-dependent wait buys little because F3, the increment of P, is an addition every instruction pays and its carry can run sixteen bits when P ends in ones; the lookahead carry is the way at that. A self-timed carry is not available in this family: the majority gates give both polarities of every carry, which a completion detector wants, but static logic cannot tell a finished carry from the stale one it started with without a precharge. The user wants both the kind-timed phases and the skipping (27 Nov 2026); their cost is small, about two transistors with a resistor, a capacitor and four diodes for the timer, and perhaps eight transistors, thirty diodes and sixteen resistors for the four bypasses, under 1% of the machine and a few tiles on the control board. Neither is designed or simulated yet; the order is the timer first, then the bypasses, which reopen the 19 Nov decision that the phase count is fixed.

A rule for the compiler. Once the generator times F10 by op, the back end should spell a move as OR 0 rather than ADD 0: same result, same flags, carry untouched, and the fast path through F10 for 56% of instructions. One line in the back end, and the first time the machine's timing feeds back into the code generator.

Sound, two channels. Decided 27 Nov 2026 after the user separated two things that had been one. Channel 1 is listening to the machine: tick AND MEMREQ, two diodes, through a panel potentiometer into a small class-D amplifier such as the PAM8403 and a speaker on the control board. Pitch is the speed knob, rhythm is the code, and it works with the Pi unplugged. The tick alone would be a tone, since every instruction walks all 13 phases; MEMREQ gives each instruction its rhythm and a loop its riff, in the tradition of the Elliott 803, whose console loudspeaker was pulsed by the top bit of the instruction register so the operator could hear a run. Channel 2 is the beep a program asks for, and the host makes it, so volume is software for free: the OS call beep (10, from CHIP-8) grows into the BBC's SOUND with channel, amplitude 0 to 15, pitch and duration; VDU 7 is the bell; the boot banner gets the Beeb's two-tone chirp. On the Pi Zero the hardware PWM pins (12, 13, 18, 19) are under the bus and I2S wants 18 to 21, so the beep comes out over HDMI audio or an I2C DAC on GPIO 2 and 3; on the RP2350 board any pin. The amplifier's shutdown pin is a master mute, which needs a pin of its own now that 27 is WRITE, so it waits for the I2C expander or the RP2350. Nothing in the CPU changes for either channel.

The slice in KiCad, and resistors upright, 24 Nov 2026

The user asked whether anything more could be done for the area of the board, and whether the routing was done. The answer, from the model: at the 7.85 mm pitch the panel is 1,088 × 526 mm, 0.57 m², against a brief of a metre square; the parts' slots are 46 per cent of it, the tiles 63 per cent of a slice board with their slots 95 per cent full, and the control board's tiles 63 per cent of its board with slots 84 per cent full. The levers left were the pitch (4.6 per cent of the width, if two lanes go to the bottom layer), resistors upright (guessed at a tenth), the control board's height (its parts need 130 of its 187 mm, its wiring needs the room), part of the rail on the bottom (two or three per cent) and the rows' slack (under three per cent). The page's router is at the end of what rules do: what it cannot route is the statement of what one layer cannot do. Then: "can we layout in kicad and see exactly what it would look like", and "an upright resistor toggle would be good". Both done the same evening.

The slice in KiCad. web/export.js writes one board of the page's layout as JSON, every part with its pads, every track segment, every tile with its words, and kicad/mkpcb.py (rewritten; the 19 Nov placer is mkpcb.py-19Nov26) builds the board with KiCad's pcbnew module: a library footprint for each part, placed by matching each of its pads' nets to the page's pads and trying the four turns until every pad lands, so no pad order is assumed; the page's tracks as 0.25 mm top-layer tracks; the function strips, the LED names (an overbar as ~{name}), the three-sided tile outlines, the row lines and names and the rail's net names on the silkscreen; references on the fab layer; a ground zone on the bottom; the four headers; then KiCad's own DRC. Slice 5: 206 footprints, every pad matched, 690 tracks, 63 × 303 mm. The plot is kicad-slice5.svg, the upright one kicad-slice5-upright.svg; the boards and 3D renders are in kicad/. What the real footprints said, which is what the first KiCad tile was for:

Upright. The page's header has an R, D selector, flat or upright. Upright, a resistor or diode stands on end on 2.54 mm (KiCad's P2.54mm_Vertical footprints), its body over pin 1, and two share a slot, 1.3 mm above and below its centre as a transistor's pins are, the upper one's pins escaping upwards and the lower one's down; a part pairs with the next unpaired resistor or diode in its tile's order. The rows of a slice are now packed by the model rather than fixed (flat, 295 mm against the floor plan's 299). Measured: the register rows do not change, since each is one shelf either way (the cell goes from four columns to three); the ALU goes from 169 to 106 mm; the slice from 295 to 232; the panel from 1,088 × 522 to 1,088 × 459 mm, 0.57 to 0.50 m², twelve per cent. The control board's blocks need five of its eight shelves instead of seven. Five columns to a slice were tried and rejected: the register rows then need two shelves and the panel grows. The cost: the colour bands are hidden (the value goes on the silkscreen), and the tracks are denser, the page's overlaps 377 and 1,457 becoming 1,468 and 2,796, KiCad's crossings 396 and shorts 25. The choice is item 4 of the list.

What is left. More routing on the page would not change the counts: the next step in routing is KiCad's, a bottom layer for the control board's verticals and for the crossings, from these boards.

Decided 25 Nov 2026: pitch 7.85 mm, parts flat, the size as it stands. Tony asked what the 7.3 mm pitch would have put on the bottom layer. Nothing thick: every signal track is 0.25 mm and the only wide copper, the supplies, is on the bottom at any pitch. The gap between the 1.6 mm pads of neighbouring columns is the pitch less 6.68 mm, 0.62 mm at 7.3 and 1.17 at 7.85, and a 0.25 mm track with 0.15 mm clear needs 0.4, so 7.3 gives one lane a gap and 7.85 two. The test, run at both pitches, counts pairs of different nets drawn through each other in a column gap: on the slices 1,018 at 7.3 against 240 at 7.85, on the control board 2,231 against 981. On slice 5 they are 65 at 7.3, none in the register rows, all in IN0, IN1 and the ALU, and they are the ALU's long verticals, the selected operand bp5 and nbp5, the XOR x5 and nx5, the carry nc5 and ns5, SUBSEL and nSUBSEL and the IN0 and IN1 cell outputs, running 40 to 150 mm down a column gap from the gate that makes them to the input diodes of the gates that use them, past gates whose own short verticals, a diode cathode to its AND resistor, need the same gap. At 7.3 one of each pair would be a signal on the bottom layer; the second lane at 7.85 clears the gate-internal ones. Not a duplicate of anything on top: each net is drawn once, and the count is two nets wanting one lane. Seven of those nets also share the slice's left edge gap at 7.85 (six still collide there), because every ALU gate's input diodes are in its left column; that gap wants a lane or two of its own whatever the pitch, and is for the KiCad routing. Tony's decisions, in his words: "All signals on the top means pitch 7.3 is out." Upright resistors and diodes: "the numbers look good, but it loses readability and looks a lot less solid than flat", so out; the diode question is now a 7.62 mm diode slot or a short-body part. "Overall size is fine as it stands. 1 m × 1 m was not a maximum … slightly greater than 1 m wide and less high is just fine." The part count cannot come down in the parallel machine; the bit-serial version is worth publishing as an option, in time. Cost and ease of construction remain the concern, and the serial option is the answer to it if one is needed.

Three more from reading the KiCad plot, 25 Nov 2026. Tony: the supplies are not on the silkscreen (they are on the page, and are needed for the same reason); the resistor values are not printed, and the board must be beginner-friendly, printing what it can, even where the part will cover it; and the 40-way headers lie across the slice, where the ribbon has to run along the row of slices, so they should stand along it, at the cost of board under the cable. All three done the same morning in kicad/mkpcb.py and the page's model. The silkscreen now carries the page's supply symbols at every pad on 5 V, 3.3 V or ground (bar above, 3V3 on the bar for the 3.3 V rail, the three-line ground below) and the value of every resistor (10k, 0.8 mm letters, between the pads under the body), diode (4148 at 0.7 mm, clear of the cathode bands), transistor (2N3904 at 0.7 mm inside the TO-92 outline on the curved side) and capacitor (above its body): 182 values on a slice. The values at 0.7 mm are below KiCad's 0.8 mm default and the fab's stated minimum, which DRC reports as 146 text-height warnings; the LED's value is LED and is not printed, its name is. The headers: a slice now has a 7 mm connector column at its right edge, beyond the rail, with ribbon A's header at the top and ribbon B's at the foot, pins along the slice, so the cables run along the row; the spine reaches JA by a stub and the rail lanes turn into JB's pins in order as they reach them, which is a cleaner fan-out than the horizontal header had, and the rail's 0.12 mm overrun of the edge is gone. The headers are meant to be mounted on the back of the board, pins soldered from the front, so the two 51 mm wide ribbons lie behind the panel and cover nothing; what the front shows is the header's 80 solder joints. The foot strip shrinks from 15 to 8 mm and holds only the two 2 × 3 links. A slice is 70 × 288 mm (63 × 295 before), the panel 1,200 × 515 mm, 0.62 m² (1,088 × 522 before): 7 mm of width a slice for 7 mm of length, 112 mm of panel width. The page draws the headers from the same list the KiCad builder places them from (model.conns), and the slice's KiCad plot is kicad-slice5.svg. DRC on the rebuilt slice: 375 crossings, 34 shorts, 5 clearance errors, the same one-layer residue as before within a few; the page's test, 577 horizontal and 1,297 vertical overlaps (377 and 1,457 before: the control board's blocks are packed again at the new panel width).

The rail turns into the pins, 25 Nov 2026, later. Tony asked how the ribbon reaches the rail with the header on the back, and whether any pin but power needed a silkscreen stand-in. None: a through-hole pad is on both faces, so every signal pin is joined on top, and he asked to see "all the rails turn one by one into the pins". Done on the page and in KiCad. The rail's lanes now end at their ribbon B pins: a lane runs from its one consumer (every control line has exactly one on a slice, a transistor emitter) down to its pin's row and turns right into the pad; an even pin, in the outer column, is reached between two inner pads, 1.27 mm below its row, then up into its pad. For that to cross nothing the pin order is fixed by the geometry, and the generator's RIBBONB now carries it (it had been alphabetical, which cost 206 crossings in the fan-out): the lane nearest the column takes pin 1 at the top and must turn in highest, so pins 1 to 23 are the lines whose consumer is above the header, ordered by the height of their runs, P_er first (it reaches the top of the slice) down to SHIFT_EN; AND_EN and OR_EN feed the two bus drivers at the very foot, below the header, so they take pins 24 and 25 on the two outermost lanes and run on past them; nSUBSEL and SUBSEL, with no rail lane, take 26 and 27 and leave the header down its middle and beside it, round the foot strip above the links, to the ALU's left edge. The three lines of one register share a channel at three lane heights, so their pin order follows the page's lane choice (we, re, er as planned; the design doc's pinout is this list). The bus bit reaches ribbon A the same way: the spine runs up to 1 mm from the top edge, over the top of the rail, down the middle of the header and into its Pi pin (pin 21 for bit 5), crossing nothing. Every header pin's net is printed beside its pad. The page draws all of it (machine.json carries both ribbons' pinouts; model.js orders the rail by them and checks consumer against pin), and KiCad's DRC finds no copper error right of the spine; the panel's crossing count fell from 44,433 to 39,727, the slice's from 375 to 342, and the slice has 92 unconnected pads left, the header's power pins and the Pi's lines.

Layout

Decided 19 Nov 2026: lay the boards out so that a person can read the circuit from the top surface and map it onto the schematic without turning the board over. The rules, then the floor plan, then the pipeline that produces the boards from the generator.

Rules

Floor plan

floor plan of the panel, generated by tools/floorplan.py

Sixteen slice boards side by side, bit 15 on the left, and one control board along the bottom. Each slice reads top to bottom: the bus indicator with its tap on ribbon A, then P, A, B, C, IN0 and IN1 as the rows of the register file, the constant diodes, and the ALU slice with its five drivers at the foot next to the control board, so the carry and the enables have the shortest path. The control board reads left to right: clock and generator, the ring as a row of thirteen lights, the instruction register as a row of sixteen, decode, the flags and CIN, the 29 line stages, the ALU enables, and the host with the Pi Zero at the right end. The bus is then a horizontal row of sixteen lights across the top of the panel, each register a row below it, and the ring a row along the bottom, which is the picture the architecture section asked for.

The sizes come from the generator's part counts and one assumption, that a readable through-hole part with its silkscreen takes 0.8 cm² on average, which the first tile laid out in KiCad will calibrate:

Board Parts Size Note
slice, each of 16 202 60 × 283 mm bus 8, register bits 16 each, latch bits 13 each, constants 5, ALU 165, ribbon header 15 mm
control about 2,130 1,020 × 187 mm one header each for ribbon A and ribbon B, two link cables
panel 1,040 × 510 mm 4 mm between slices, 10 mm margins, 20 mm between slices and control

Revised 24 Nov 2026: the page packs the rows itself and the pitch is 7.85 mm, so a slice is 63 × 295 mm flat or 63 × 232 upright and the panel 1,088 × 522 or 459; the figures above are the 19 Nov estimate (see "The slice in KiCad, and resistors upright"). Decided 25 Nov 2026: 7.85 mm and flat, so the slice is 63 × 295 mm and the panel 1,088 × 522 mm, 0.57 m²; with the headers stood along the slice, later that day, 70 × 288 and 1,200 × 515 mm, 0.62 m².

So the metre was right for the width, and the panel is about half a metre tall rather than a metre. The hinge falls between bit 8 and bit 7, splitting the control board into two boards of 510 mm; the lines that serve all sixteen slices cross the hinge on one ribbon. The ALU is more than half of a slice because of its diodes, 61 of the slice's 65, which is the honest cost of the AND-OR-invert family and the reason the lookahead carry was set aside.

Decided 19 Nov 2026. Two standard 40-way ribbon cables run along the row of slices, each with an IDC connector pressed on at every slice, and a 2 × 3 link joins each slice to its neighbours.

This moved the instruction register to the control board. Its outputs feed only the decoder, which is there, and its input is the bus, which ribbon A brings; on the slice it would have cost two lines per bit to the decoder, 32 in all, which no ribbon has room for. The slice is then one bit of P, A, B, C, IN0 and IN1, the constant diodes, the ALU slice and the bus indicator: 35 transistors, 65 diodes, 20 LEDs, 81 resistors and one capacitor, 202 parts, about 400 solder joints, with no clock and no strobe on it at all, since the strobes are folded into the lift and write lines on the control board. The hidden layer of a slice carries nothing but power. The control board is 329 transistors, with IR as a row of sixteen lights beside the decoder it feeds.

From generator to boards

KiCad 9.0.2 runs on the Pi Zero 2 W itself (installed 19 Nov 2026 without the 3D models, 0.7 GB), so the board files can be made on the same machine as the simulation and the host program. The first run proved the pipeline: kicad/mkpcb.py read the slice netlist with KiCad's Python API, found every one of the 213 footprints in the Debian libraries, placed them in block rows and saved a board, in 175 s; kicad-cli plotted it to SVG in 9 s. It needed 1.2 GB, which is why the Pi now boots to the command line with a 1 GB swap file and zswap; the control board, with eight times the parts, will want the footprints loaded once each rather than once a part. sim/cpu.py --kicad DIR writes two KiCad netlists from the same part list that is simulated: slice.net, slice 5 as the template for all sixteen, and control.net, with J0 to J15 for the slices in a canonical pin order so every slice's connector means the same thing, and J16 for the host. Every part has its footprint assigned. --boards prints the parts of a slice by block, which is where the floor plan's row heights come from. The next steps, in order:

  1. Lay out one register-bit tile in KiCad by the rules above and measure it. That calibrates the 0.8 cm² and the 60 mm, and is the first thing to build and light up.
  2. Lay out the latch-bit, ALU-slice and bus-indicator tiles; stack them along the spine and the rail, with the ribbon A header at the top, the ribbon B header at the foot and a link header on each side; that is the slice board. Order sixteen.
  3. Lay out the ring stage, the generator stage, the line stage and the AOI gate as tiles; the control board is those tiles placed by the generator's block order.
  4. Have the generator place the tiles, so the PCB is regenerated when the netlist changes, and so the host's simulated panel knows where every LED is.

Budget

The target is £100 for everything, so a school can build one. Revised 19 Nov 2026 with the generator's part counts, the two-ribbon interconnect and the board sizes from the floor plan. Rough UK prices, quantities for one machine with a small surplus:

Item Quantity About
NPN transistors, 2N3904 class, with 2N2222 for the 29 line drivers 1000 (889 used) £6
LEDs, 3 mm diffused, four colours 600 (548 used) £5
resistors, 470, 1k, 2.2k, 10k, 47k 2500 (2,090 used) £5
diodes, 1N4148 2000 (1,816 used) £6
capacitors 30 £1
Raspberry Pi Zero 2 W (or RP2350-PiZero) 1 £15
5 V 3 A supply 1 £8
boards: 16 slices, 60 × 283 mm, one design 20 (minimum run) £40 to £55
boards: control, 1,020 × 187 mm, as four boards of 255 × 187 mm 4 designs × 5 (minimum run) £60 to £90
ribbon cable, 40 way 4 m £8
IDC sockets, 2 × 20, and box headers 34 of each £10 to £45
link headers, 2 × 3, and leads 32 and 15 £5
panel, hinges, fixings, wire £15
total £185 to £265

So the machine is about twice the target, and the boards are the whole of the difference: the parts, host and supply together are under £50. Two corrections to earlier figures: the diode count is 1,816, not 1,000, because the AND-OR-invert gates are diode logic; and ribbon and connectors were missing altogether.

Why the boards cost what they do. At the prototype fabs the price is area times quantity with a small engineering charge, not a set-up fee: JLCPCB makes a 2-layer board up to 480 × 320 mm, charges extra above 650 cm² a board, and the minimum order is five of any design. The sixteen slices are one design and so cost almost nothing more than a run of five; it is the control board that hurts, because it is four designs, each ordered in fives, of which one set is used. Prices above are estimates from the fabs' published rates; the online quote is the authority once the boards exist.

Decision, 19 Nov 2026: budget £500 for five. The minimum run of the control boards is five sets, so the natural unit of cost is five machines, not one: build two or three, keep one, give one or two to museums, and give the rest away as parts. Parts bought in five-machine quantities, on eBay where that is cheapest:

Item For five About
transistors, LEDs, resistors, diodes, capacitors 5,000 / 3,000 / 12,000 / 10,000 / 150 £90
boards: slices, one design, 80 needed, order 100 £120 to £150
boards: control, four designs, five of each £60 to £90
ribbon, IDC sockets, headers, links ×5 £60 to £80
Pi Zero 2 W and 5 V supply, for the three built ×3 £70
panel, hinges, fixings, for the three built ×3 £45
total £445 to £525

About £100 a machine, by paying for five. That is the price point that matters: the Sinclair ZX80 of 1980 was sold as the first personal computer for under £100, £79.95 as a kit and £99.95 built, and a machine meant to teach what a computer is should cost what the machine that taught a generation cost. Unlike the ZX80, this one is built from parts you can see.

Decision, 19 Nov 2026: the £100 is a kit price, bought in bulk. The target is for schools, not for the builder or the museums; those are paid for from the five above. If the design is good enough for schools, the plan is that someone else sells it: the site carries build instructions far longer than an Instructable, every KiCad and source file and a bill of materials, and a kit seller buys for twenty or fifty at a time, adds a small margin and posts the box. So the £100 must cover everything that goes in the box, host included, at bulk prices and at today's board sizes:

In the box At twenty kits About
transistors, LEDs, resistors, diodes, capacitors, bagged by value £18 to £25
16 slice boards, 60 × 283 mm, 27 dm² 70 to 90p a dm² landed, with VAT and freight £25 to £32
control boards, 19 dm² same rate £17 to £22
ribbon 4 m, 34 IDC sockets, 34 box headers, link headers and leads far-eastern prices £12 to £16
Pi Zero, SD card, mini-HDMI adapter a Pi Zero 2 W is £10 more, an RP2350-PiZero about the same £11
supply not in the box: any 3 A USB-C charger £0
hinges, screws, standoffs; the panel is any 1 m × 0.6 m board from a DIY shop £4
bags, box, UK postage £10
total £97 to £120

On the line as the boards stand, with no margin for the seller, and the shape of the table says where to look. The boards are nearly half of it; everything else is a few pounds each and already at bulk prices. The fab is not the lever: the far-eastern prototype fabs price alike, by area, and a UK or European run costs five to ten times as much. Board area is the lever, and the area is set by the layout rules, so the layout decides the price:

With standing diodes in the arrays and 1.2 mm boards the table reads about £87 to £110, and a tile that comes in under 0.8 cm² a part puts it under £100 with a margin for the seller. The two board lines are the ones to replace with quotes, once the slice has an outline.

The levers, in the order they are worth pulling, for anyone building one rather than five:

  1. Fewer control board designs. The control board is 13 identical ring stages, 29 identical line stages and a few blocks of logic. If it were, say, two designs instead of four, the run is £30 to £45 cheaper; if the ring and the line stages were themselves small identical boards it would be cheaper still, at the cost of more connectors, which is the same trade the slices already make.
  2. Build five. Every minimum-run spare is a whole machine's boards. A group of five builders, or a museum build plus four school kits, brings the boards to about £25 a machine and the total under £120.
  3. Cheap connectors. The IDC sockets are £1 each from a catalogue distributor and 20p from the usual far-eastern sources, which is the £35 spread in the table.
  4. The control board on stripboard or on the laminated-sheet method of the earlier plan, which keeps the slices as boards. It loses the "read it from the top" rule on the one board that most needs it, so it is the last resort.
  5. A slice alone is about £6 in parts and £3 in board, so a school can build one bit as a kit and see the whole register file and ALU of one bit light up, which is a complete lesson in itself.

Simulation

The design is simulated in ngspice before anything is built or a PCB is ordered (SPICE; the netlists are in sim/, run with ngspice -b and reporting named measurements rather than plots, so parameter sweeps are shell loops). Started 17 Nov 2026 with the register bit exactly as described under Storage cells: 2N3904 cells, 2N2222 line drivers, red LEDs at about 2 V, a bus line with a 1 kΩ pull-up to 3.3 V and 100 pF of wiring. The host writes a 1, reads it, writes a 0 and reads it, with 2 µs strobes.

Measurement Result
high node 2.9 V, not 5 V: the LED and 1 kΩ in the load drop 2.1 V at the 0.2 mA of base current
low node 0.09 V
cell current 3.1 mA, in the LED that is lit
forced beta in the cell 14, so any 2N3904 is fine
set: WE active to NA below 1 V 0.03 µs
clear: lift active to NA above 2 V 0.6 µs, set by the lift transistor turning off
read of 0: RE active to bus below 0.8 V 0.02 µs
bus recovery after a read, to 2.4 V 0.65 µs with 100 pF
read of 1 bus never drops below 3.2 V
WE and RE lines when inactive float to 2.7 to 2.9 V through the base-emitter junctions on them, harmless

Strobe width sweep: set works down to 0.1 µs, clear needs between 0.5 and 1 µs, and at 0.05 µs neither works. So the lift is the slow edge in the machine, a phase can be a few microseconds, and with 13 phases the electrical ceiling is of the order of 20 to 50 thousand instructions a second, far above where LEDs can be followed. The strobe generator's CLR pulses should be 2 µs or more; the SET pulses can be as short as the generator likes.

Lesson from the first day: use the published 2N3904 and 2N2222 models. A BC337 model typed from memory passed base current with its base grounded, which held every line driver on and made the cell appear to refuse a 0.

Ring stage and ALU slice, 17 Nov 2026

A three-stage ring of master-slave latch bits, reset to stage 0 and stepped by the four strobes, carries the token 0, 1, 2, 0, 1 as it should. A master or slave settles 0.4 µs after its SET edge. Shrinking the strobes, with CLR width, SET width and the gap between strobes in µs:

CLR SET gap phase period result
2 2 1 12 µs pass
1 1 0.5 6 µs pass
1 0.5 0.2 3.8 µs pass
0.7 0.5 0.1 2.8 µs pass
0.5 0.3 0.1 2.0 µs fail

So the ring itself can run a phase in 3 µs, and the strobe generator should make CLR pulses of about 2 µs and SET pulses of about 1 µs for a safe margin of two to three.

The ALU slice found two things. First, the AND-OR-invert gate as first drawn, one OR diode cancelling one AND diode, left the off-state base at 0.4 to 0.5 V, and two half-true terms together turned the gate on; a second series diode in the base path fixes it, with the off-state base at 0.16 to 0.3 V and the on-state at 0.7 V. Second, the carry: the doc's form ripples at 0.46 to 0.48 µs per bit because cout needs an inverter after the gate, while the majority form gives both polarities in one gate at 0.28 to 0.37 µs per bit. The ALU section now uses majority. A 16-bit ripple is then about 6 µs, and with the b' and sum stages either side the ALU phases need about 7 µs to settle, so the ALU, not the ring, sets the phase period. With every phase the same length, as it is with one oscillator, a 10 µs phase gives 7.7 thousand instructions a second at the top of the knob. That is the design's speed figure until something changes it.

Where the time goes, and what a clamp buys, 19 Nov 2026

A phase is CLR1, SET1 held until the host answers, CLR2, then SET2 held until the host answers again and the oscillator ticks, about 12 µs at the top of the knob. The two CLR pulses are 2 µs each because the register clear needed 0.5 to 1 µs and wanted a margin; the SET2 hold has to cover the ALU, 7 µs when a carry ripples through all sixteen bits; the rest is the host. The question was whether the usual bipolar speed-ups, a Baker or Schottky clamp, a lower bleed resistor, an active turn-off or a speed-up capacitor, buy anything on those paths, given that parts are cheap and board area is not. sim/speed.py runs the variants against the 16-bit carry ripple and the 16-bit register clear.

Path As designed Best variant Result
register clear, 2N2222 lifter at 50 mA lifter off 0.50 µs, all bits clear 0.57 µs BAT54 clamp base to collector off in 0.01 µs, clear in 0.07 µs
same 1 nF across the 470 Ω base resistor 0.08 µs
16-bit carry ripple, majority gates 4.94 µs 47 kΩ bleed changed to 10 kΩ, nothing else 2.87 µs
same 4.7 kΩ pull-ups and base resistor, 10 kΩ bleed 3.17 µs, and the output low is still 0.11 V with a 2.6 V input at 60 °C
same 2.2 kΩ and 4.7 kΩ bleed 2.72 µs
same 4.7 kΩ throughout 2.14 µs
same 3.3 kΩ throughout 1.92 µs in this test; fails in the whole machine, see the ALU section
same 220 pF speed-up capacitor alone 3.44 µs
same BAT54 clamp on the gate 5.80 µs, slower

Two different mechanisms. The lifters and line drivers are storage-limited: a 2N2222 driven hard into saturation holds its charge for half a microsecond after its base is pulled low, and a Schottky clamp from base to collector (Baker clamp) keeps it out of deep saturation and removes the whole delay. The logic gates are not: a DTL gate turns off by bleeding its base charge through the 47 kΩ resistor to ground, with the series diodes blocking any faster path, so its turn-off is an RC of the bleed, and a clamp only raises the output low from 0.1 to 0.4 V and takes drive from the base, which is why it is slower. Changing the bleed to 10 kΩ is a resistor value, no parts and no area, and takes 40 per cent off the carry; the lower pull-ups keep the base drive comfortable at the same time. The speed-up capacitor adds a little on top of that and is not worth its 32 footprints.

What is worth doing, then, and all of it on the control board or in resistor values:

  1. Clamp the heavy drivers: the six lifters, the 29 line drivers and the generator's pull-downs, about forty through-hole Schottky diodes (BAT42 or 1N5819) on the control board, none on a slice. The clear is then set by the cell and not the lifter, and both CLR pulses can shrink from 2 µs to about 0.7 µs, which the ring has already passed; 2.5 µs off every phase. It also makes the clear independent of how hard the lifter happens to be driven, which is a robustness gain on its own.
  2. A 10 kΩ bleed in the two carry gates of each slice, the only gates on the long path; the other five gates in the slice keep 47 kΩ. Two microseconds off the ALU settle, no parts. Adopted 19 Nov 2026 and in the generator; the whole machine runs the test program exactly as before with it. The 3.3 kΩ version that the table shows faster was tried first and failed in the whole machine, for the reason given in the ALU section: it loads the latch nodes it reads.
  3. Not worth it: clamps on logic transistors, speed-up capacitors, a negative supply for the bleed, or active pull-downs in the gates. The bus recovery of 0.65 µs is the 1 kΩ pull-up charging 100 pF and is already in the host's settle time.

Together a phase goes from about 12 µs to about 8, an instruction from 156 µs to about 100, six thousand instructions a second to ten. Half as much again for a program at level 4, and nothing for the lesson. The carry change is in the generator. The clamps are proposed and not yet in it, because they change the clear timing the whole-machine run was checked at, and that run is the place to confirm them.

Clock and strobe generator, 17 Nov 2026

The generator as described in its own section, with the host modelled as READY following the SET2 state after a delay, does what the handshake rule says in all three cases tried:

Case Result
host answers in 5 µs tick to CLR1 in 0.4 µs; CLR1 2 µs; SET1 held until READY drops; CLR2 0.7 µs after that, 2 µs wide; SET2 held until READY rises; one phase in about 9 µs
host answers in 50 µs a tick before READY is ignored; the generator sits in SET1 for the whole 48 µs the host takes, then completes the phase
ticks every 8 µs ticks that land while a phase is running are dropped and the next one is taken; no double trigger, no lock-up

CLR width against the timer capacitor: 330 pF 1.1 µs, 680 pF 1.9 µs, 1 nF 2.6 µs. 680 pF is the value.

Two faults were found and fixed on the way. The first reset pulled the B side of stages A, B and C low with three transistors on one shared 10 kΩ base resistor; A's transistor got 15 µA of the 260 µA and sat in the active region at 1 V, which left D's reset transistor half on and D never set. Separate base resistors fix it, and lifting A, B and C through one lifter, the way the registers are cleared, is cleaner and one transistor fewer, so that is the design. The second was the clock. An asymmetric astable, long side on the pot and short side fixed, cannot make a 1.5 µs pulse with LED loads: the big timing capacitor has to recharge through the 1 kΩ load during the short half and cannot. A symmetric astable oscillates cleanly from 65 µs to 34 ms with the pot and two range capacitors. Its rising edges are slow for the same reason, so a differentiator on them gives only 0.4 V; the falling edges are fast, and a normally-on transistor knocked off by the falling edge gives a 1.2 µs active-high tick at every setting. The host pulsing that transistor's base gives 1.4 µs.

Full register and 16-bit ALU, 18 Nov 2026

A 16-bit register on a bus carrying everything the real bus carries per line: the 1 kΩ pull-up to 3.3 V, 100 pF of wiring, the seven other set transistors and the indicator through 47 kΩ, nine open collectors and the host's open-drain pin, with 2N2222 line drivers on WE, RE and the lift. The host writes 0xA5A5, the register reads it back, then 0x5A5A.

Measurement Result
bus high with all loads 2.88 to 2.92 V
bus low during a read 0.14 V
read valid after RE under 0.1 µs
bus back above 2.4 V after a read 0.66 µs
RE driver peak 72 mA, line at 0.05 V
WE driver peak 23 mA, line at 0.02 V

The 16-bit ALU, majority carry, inputs from latch-like stages, SUM drivers onto the loaded bus:

Case Bus settles after the inputs change
0x7FFF + 0x0001, carry ripples to bit 15 5.3 µs
0xFFFF + 0x0001, carry ripples through all bits 5.0 µs
0xFFFF + 0x0000, no ripple 0.9 µs
0x0000 - 0x0001 without borrow in 1.0 µs

So the WB-D phase needs about 6 µs from IN0 and IN1 being latched to the bus being valid, and the result in the design's speed figure stands: a 10 µs phase is safe and 7.7 thousand instructions a second is the top of the knob.

The whole timing chain, 18 Nov 2026

Astable at 4.7 kΩ and 15 nF, tick shaper, generator and the thirteen-stage ring in one netlist, about 110 transistors, with the host modelled as before. After reset the token goes 1, 2, 3 and so on to 12, then 0, 1, one slave at a time, at the astable's 65 µs period. Within a phase the dump shows the intended order: masters lifted for 2 µs and cleared, SET1 active and the next master set, slaves lifted for 2 µs and cleared, SET2 active and the next slave set. A master or slave forced to 1 at power-up is cleared by RESET. The SET lines sink thirteen set transistors at 0.1 V. A lifted line floats to about 2 V through the base-emitter paths, which is what lifting means. The SET drivers release 0.3 µs after their stage because of storage time, so SET2 overlaps the start of CLR1 by that much and SET1 the start of CLR2; both are harmless, because the latch concerned has already latched and the master-slave arrangement stops the token rippling.

This run found three faults in the generator that its own simulation had hidden, because only the state bits had been inspected and not the lines they drive. The pull-downs had their LED between collector and node, so the node stopped at 2 V and still drove the lifter or driver base; the reset diodes into the lifter controls pointed the wrong way, so the ring was never lifted and only looked clean because the simulation powers up at zero; and the ring's reset-set ended on the same edge as the reset lift, so slave 0 was lost. All three are fixed in the generator section. Lessons: watch the outputs, not the states, and start some cells at 1 before trusting a reset.

Next: a netlist of the whole machine, generated from one script that is also the schematic, with the host modelled as memory, running a short program.

The whole machine as one netlist, 18 Nov 2026

sim/cpu.py emits the whole machine, every transistor through one function, so the count by block is exact rather than estimated (887 transistors on 18 Nov 2026, after the EXEC latch). It is also the schematic: the PCB netlist will be derived from it.

Block Transistors LEDs Diodes What is in it
P, A, B, C 72 each, 288 37 each 53, 34, 34, 34 16 cells with set and read transistors, lift stage, WE and RE line stages
IR, IN0, IN1 53 each, 159 35 each 8, 22, 15 16 cells with set transistors, lift stage, WE line stage
constants 12 8 140 four select lines, each a line stage and the diodes of the constant
ALU 195 115 1167 per bit b', x, lookahead carry, not-sum and five bus drivers; bit 15 shift input
ALU enables 15 10 41 five line stages SUM AND OR XOR SHIFT
flags and CIN 32 22 64 eq0, lt0, carry, CIN latches with their lift and write stages, the zero detector
decode 53 52 186 24 select lines, 8 op lines, ADD SUB, 3 condition lines, exec and its EXEC latch, SUBSEL, CARRYOP, SHIFTOP, INC2, MEMREQ, WRITE
ring 80 52 1 13 master-slave stages, slave 0 set, reset driver
generator 30 16 19 four stages, conditions, lifters, drivers, reset
clock 3 3 2 astable and tick shaper
bus indicators 16 16
host pins 6 1 open collectors for SET1, SET2, PHASE0, MEMREQ, WRITE and the MEMREQ inverter
total 889 548 1647 as the generator counts them on 27 Nov 2026; 887, 547 and 1816 on 18 Nov

Where the earlier estimate of 800 went: each line that must sink tens of milliamps costs three transistors, a gate, a pull-down and a 2N2222 driver, because a gate's own collector cannot source the driver's base current; there are 29 such lines. The LED count is lower than the transistor count because set, read and driver transistors have none; 546 LEDs is still an LED on every state bit, every gate and every strobe.

The host is modelled behaviourally: READY follows the SET2 state after a delay, the address is sampled while SET2 holds, ROM data is driven until the SET1 pin falls, and writes are recorded. A 1.3 ms run of the netlist takes ngspice twelve minutes. The first runs found, one after another, the faults below. Each is a design rule that is now written down in its own section, and the generator is the record of all of them.

Found Rule
P started at a random value RESET lifts P, the flags, carry and CIN
P latched a half-formed sum the host raises READY no sooner than the bus has settled, about 4 µs with the lookahead carry
IR latched all ones the host drops READY first and releases the bus only after SET1 has fallen; a latch is transparent for the whole SET1 hold and a set transistor can only write a 1
bus highs sagged to 1.9 V, a fetch lost a bit every enable line has a 1 kΩ pull-up; a floating line is a path between bus bits through one transistor forward and another reverse-active
carries into bits 1 to 3 lost node names are case-insensitive in ngspice, and the decode's condition lines C1 C2 C3 were the carries c1 c2 c3; a generator fault, not a design one, but it cost an afternoon
a conditional jump that cleared its own condition wrote nothing exec is latched at F8 into EXEC

With these the program of seven instructions in cpu.py runs on the netlist exactly as it runs on emu.c: A = 2; B = A plus the word at address 2; C = B minus A; C xor 1 written to address 3; C minus A compared, setting N; the jump on N back to 0.

Diode carry and carry lookahead, 18 Nov 2026

The old sketches (diodeCarry.jpg, carryDiode1.jpg) show a Manchester-style chain: the carry runs along series diodes, each bit has a generate pull-up through a diode and a kill transistor to ground, and only the kill transistors are in the chain. Simulated as sim/dcarry.py, a 16-bit carry crossed in 1.2 µs with a restoring inverter every four bits, and the first checks passed. Then the whole machine failed to increment P, and the reason is a flaw in the chain itself: a kill at bit i+1 pulls bit i's node down through the propagate diode, so a carry that stops at bit i+1 is destroyed at bit i as well. The first checks had only looked at bit 16. The pure diode form, carry = generate or propagate-and-carry as a diode AND-OR per bit with no transistor in the chain, fails for the complementary reason: a node held down only by a resistor is not a stiff low, and the next stage's AND pull-up and the sum gate's input diode lift it to 1.8 V. A stiff low needs a transistor on the node, and a transistor on the node is the kill transistor with its short. So a diode carry chain does not work in this logic family, in either form. A voltage doubler for the chain was considered at the same time and does not help: the level on a diode chain is set by the carry's source, not by any rail, so every source would need a high-side switch, two transistors per bit, for a gain in a phase the ring already limits.

The same bug was found nine years earlier. The chain is in the project log Fast carry propagation for a new ALU of 23 Feb 2017, and in the comments roelh pointed out that "if K3 is active it would also pull the earlier carries C2 and C1 low", suggested a second kill transistor that pulls the upstream side of a series resistor high so the propagate diode blocks, and suggested grouping the bits into units of three or four with a fast carry out of each unit. The second kill transistor was tried in sim/dcarry3.py on 19 Nov 2026: it cures the short, a kill at bit 1 leaves c1 at 2.6 V, and a carry propagates along a segment through 220 Ω series resistors. It fails at the next step for the reason given above: a propagated low rests on a resistor, and the next sum gate's diode input lifts it to 1.8 V. A node is stiff only while a kill transistor is on it; making every node stiff costs two inverters per bit on top of the two kill transistors, four per bit against two, with nothing gained in speed. The grouping suggestion is what the lookahead below does.

What the diode AND-OR fan-in does give, for nothing in transistors, is lookahead. With x = a xor b', a and b' all stiff collector outputs, every carry in a four-bit group is one AND-OR-invert gate of flat terms from the group's input carry: for bit j in a group starting at m, c[j+1] is the OR over t of x[j]..x[t+1].a[t].b'[t], together with x[j]..x[m].c[m]; and not-c[j+1] is the same with not-a, not-b' and not-c[m] in place of a, b' and c[m]. The gate computing the first gives not-c, the gate computing the second gives c, so both polarities cost the two transistors per bit the majority form cost. The four group carries chain one gate each, so the carry reaches bit 16 in about five gate delays. Simulated as sim/cla.py with every sum bit checked against Python in ten cases, all correct:

Measurement Result
16-bit carry, cin rising 1.7 µs
cin falling 1.2 µs
transistors in the carry 32, as majority
diodes in the carry 528, against 288 for majority

The lookahead was adopted on 18 Nov 2026 and set aside on 19 Nov 2026 for the ripple majority carry, which keeps every bit identical and local so that the machine is sixteen copies of one slice board. The lookahead is kept, simulated and working, under Future extensions.

Where an instruction's time goes, 19 Nov 2026

With the generator's host answering instantly, one phase from tick to the next SET2 hold measures 4.5 µs with the 680 pF timer (1.9 µs CLR pulses) and 3.0 µs with 330 pF (1.1 µs). That fixed part is two CLR pulses and seven latch transitions. On top of it each phase needs its bus to settle before the host raises READY, and the host's own response, about 1 µs on the Pi.

Phase kind fixed settle host phase
ALU result on the bus, F3 F10 F12 4.5 µs 6.5 µs (b', x, ripple carry 5.0, sum, driver) 1 µs 12 µs
register, constant or host on the bus, the other ten 4.5 µs 1.5 µs (a line stage and the bus) 1 µs 7 µs

The design, decided 19 Nov 2026 for simplicity, is the ripple carry and a host that waits the same 12 µs in every phase: 13 × 12 = 156 µs an instruction, about 6 thousand a second, a hundred times faster than anyone can watch. The levers that are not taken, each a Future extension: a host that times each phase by its kind, 3 × 12 + 10 × 7 = 106 µs; the lookahead carry, which takes the ALU phase to 9 µs; and 330 pF in the generator for 1.1 µs CLR pulses, where the ring cleared reliably at 0.7 µs, which takes 1.5 µs off every phase. All three together give about 77 µs, 13 thousand a second. The number of phases is the architecture and is not for changing. (Reopened 27 Nov 2026 after the phases were measured; see "The host as a RAM, and where the phases go".)

Bit serial

Under serious consideration from 19 Nov 2026, at the user's request: fewer parts to solder means more schools finish the machine, and a serial ALU shows the sub-instruction step working bit by bit. The question is how much a bit-serial machine saves, and there are two very different answers depending on how far the serial idea is taken. Counts below are estimates in this logic family, good to perhaps 15 per cent; the generator is the way to make them exact.

Half way: serial ALU, parallel everything else. Keep the bus, the registers, the operand latches IN0 and IN1 and the phase table. Replace the sixteen ALU slices by one 1-bit ALU on the control board, fed by a 16-stage bit ring that selects bit i of IN0 and IN1 onto four serial lines (a, not-a, b, not-b) through select transistors with their emitters on the bit's select line, the same idiom as a register read. The result bit goes into a new 16-bit result latch R, one bit per slot, through a set transistor with its emitter on the same select line, and R drives the bus for the write-back. Phases 3, 10 and 12 become sixteen generator cycles long, with R filling from bit 0 upwards on the bus LEDs, and the dst register is written at the last SET1, so the phase table does not change. Shifts need bit i+1 while writing bit i: one more select transistor per slice, picking IN0 of the slice above, which the link already carries, so the ring runs one way and nothing is reversed. The slice loses 124 ALU parts and gains about 20: it is about 100 parts, 60 × 150 mm. The control board gains the bit ring (320 parts), its sixteen select drivers, the 1-bit ALU, a carry flip-flop and an eq0 accumulator, about 470 parts. Net: about 4,200 parts instead of 5,362, the same number of transistors (the ALU was diode-heavy, the ring is transistor-heavy), half the diodes, 35 dm² of board instead of 46, and an instruction of about 700 µs instead of 156. A fifth off; not the step change wanted.

All the way: shift registers and no bus. The classic serial machine (bit-serial architecture; the EDSAC, the LGP-30 and the PDP-8/S were serial for exactly the reason a kit is: hardware was dear). P, A, B and C become 16-bit shift registers that rotate, each bit a master and a slave latch, 6 transistors and 20 parts, stepped by the same four strobes that step the ring counter today; the 13-stage ring counter is already a shift register of this kind, simulated and working at 3 µs a step, so the riskiest element is proven. An operation is a rotation of sixteen slots: the two source registers rotate, their bit 0 outputs stream to a single 1-bit ALU on the control board, and the result streams into bit 15 of the destination as its old bits leave, in place; registers not involved hold still; every register is back where it started after sixteen slots except the destination, which holds the result. Memory is the host behaving as one more serial register: an address rotates out to it on one wire, data streams back on another, bit i in slot i, so a memory operand needs no latch at all and the host can supply both operands at once on two wires. Constants are serial patterns from the bit ring, two diodes each instead of sixty. P is incremented in the same sixteen slots that send it out as the fetch address. Flags fall out: carry is the carry flip-flop, eq0 is an OR accumulated over the slots, lt0 is the last bit. A right shift is the stream written one slot late, so the shifts take a seventeenth slot and the ring has seventeen stages; nothing runs backwards, which answers the earlier worry about needing both directions.

What the second design costs and saves, against the parallel machine as laid out:

Parallel, as laid out Serial ALU only Shift registers, no bus
parts 5,362 about 4,200 about 2,900
transistors 887 about 950 about 800
diodes 1,816 about 900 about 400
slice 202 parts, 60 × 283 mm about 100, 60 × 150 about 80, 60 × 110: four shift-register bits
control board 2,130 parts about 2,600 about 1,600
board area 46 dm² about 35 about 19
ribbons along the slices 2 2 1, control and power; the host plugs into the control board alone
host wires 23 23 about 8: two serial in, one serial out, tick, READY, strobes
one instruction 156 µs about 700 µs 0.5 to 1.1 ms, 48 to 113 slots
kit, from the Budget table £97 to £120 about £87 to £110 about £72 to £95

The slice in the third column is four bits of shift register with sixteen LEDs, two links and one header: 80 parts, about forty minutes of soldering, and a school that builds one slice has built a working 4-bit shift register it can clock by hand. The panel still shows P, A, B and C as sixteen lights each, and at one slot a second a rotation is a visible procession of bits with the ALU's single LED row deciding each one as it passes, which is the "see the ALU work bit by bit" the user wants. The control board shrinks because the 29 register line stages become 16, the operand latches, the ALU enables and the constant decoder vanish, and the phase ring gets shorter; it grows by a second ring of seventeen stages and by IR as a shift register.

What is lost: the parallel bus and its lesson, "the word on the bus"; four to six times the instruction time, which the levels a C program runs at already make acceptable; and the work. The ISA, the emulator, the compiler and the whole software stack are untouched, as are the host boards, whose interface gets simpler. The generator would need a new datapath and a new phase table, and the register section, the bus section and the phase table of this document would be rewritten; the simulation campaign of 17 to 19 Nov would be repeated for the serial datapath, two to three days of the same kind of work.

Rotating or addressed

The user's question of 19 Nov 2026: must the registers rotate, or can they sit still and be addressed by the bit ring, since the ring is wanted anyway and it points at the bit being changed? Both work; the counts are close.

Rotating registers Addressed registers
register bit 6 T, 20 parts 5 T, 14 parts
slice 80 parts, 24 T, no jumpers 56 parts, 20 T, three jumpers to pick its bit
ribbons along the slices 1, plus neighbour links 2, no links: 16 select lines, 32 result lines
slot counter 4-bit counter, 24 T, or a ring for the display 16-stage ring, 96 T, plus 16 select drivers
result distribution into bit 15 of the destination, one wire a register 32 result-line gates, about 32 T
in-place A = A + B free the second set transistor
right shift seventeenth slot write pointer trails by one
total, estimate about 2,800 parts, 760 T about 2,600 parts, 730 T

The difference is inside the error of the estimates. Rotating has one ribbon, no jumpers and the simpler control board; addressed has the smaller slice and registers that sit still while a pointer walks along the word. It is a choice of what to watch: bits marching through a register, or a cursor passing over one. Undecided.

Slots per instruction, and the increment

The user asked, 19 Nov 2026, where the sixteen slots of P = P + 1 had gone. They are inside the fetch: P streams out to the host as the address, the 1-bit ALU adds one to the same stream, and the sum streams back into P, so the increment costs no slots and is not a hidden instruction. The same rule covers INC2, the increment that skips an immediate operand: an immediate is fetched by sending P as the operand address, and whenever P goes out as a read address it comes back incremented, which is the emulator's INC2 rule by construction. So there is no INC2 phase either.

Phase Slots What moves
fetch 16 P out as the address, P+1 back in
IR 16 the host streams the word into IR
operand 0 address, if memory 16 the address register out; if it is P, P+1 back
operand 1 address, if memory 16 same
destination address, if memory 16 out
execute 16, 17 for shifts sources stream, host data arrives bit i in slot i, result into dst or out to the host
total 48 to 97 at 10 to 12 µs a slot, 0.5 to 1.2 ms

To check against the emulator before this is final: an instruction that reads through P for both operands would see two different words under this rule, and a write through P must not increment, which the control gates. In the addressed design the increment could also stop early, since once the carry is zero the rest of the walk changes nothing; a typical increment would then take two or three slots. Noted, not adopted.

Stepping a serial machine

One more rung in the ladder of the levels section, decided 19 Nov 2026, for whichever serial design is chosen: step instruction; step word, one phase with all its slots in one go, so every bit of a word changes at once and the panel behaves exactly as the parallel machine would, P going from old to new in one step as if the incrementer were its own hardware; step bit, one slot, the ALU deciding one bit as the pointer or the bits move one place; and step bit with the oscilloscope. All of it is the host counting ticks, a mode-line choice and no hardware. The oscilloscope rung is cheaper than before, because the sub-netlist is one 1-bit ALU and one register rather than sixteen slices.

An SRAM-like host

Principle restated by the user, 19 Nov 2026: the host must be as close to a static RAM chip as the pins allow. Presenting address and data in separate phases on one bus is a compromise the pin count forces; delivering a word bit by bit is one that nothing forces, and RAM does not work like that. So the serial machine keeps a 16-bit parallel bus at the memory boundary, and that changes the counts above in three ways.

Parallel, as laid out Serial, serial host Serial, SRAM-like host, addressed Serial, SRAM-like host, rotating
parts 5,362 about 2,700 about 2,800 about 3,400
transistors 887 about 740 about 850 about 950
slice 202 parts, 35 T 56 to 80 parts about 80 parts, 28 T, no links about 120 parts, 36 T
board area 46 dm² about 19 about 22 about 27
one instruction 13 cycles, 156 µs 48 to 97 slots 35 to 40 cycles, about 0.4 ms same
host wires 23 about 8 23, unchanged 23

The transistor count stops falling once the host is a RAM, and it was never the serial design's saving: what goes is the diode and resistor mass of sixteen ALU slices, and that survives intact. Parts and board fall by about half, and an instruction takes about a third of a millisecond, three times the parallel machine rather than six. The slice is four register bits with their taps, MD and the bus indicator, about 80 parts and no links. Phases, roughly: fetch address 1, fetch data with the increment walk 2 to 16, operand addresses 1 each, operand 0 data into MD 1, execute 16 or 17 with operand 1 held on the bus, result to dst 1 or write data from MD 1.

Solder joints

The user's proxy for whether a school finishes the build is the number of joints, "legs" in the earlier documents: too much soldering and the job never gets done. A transistor is three joints and everything else two. The parallel figures are from the generator's exact part counts; the serial figures are from the bill of parts sketched above and carry its 15 per cent uncertainty. Connector pins are separate, since a header is quick and the count follows the interconnect, not the design.

Joints Parallel, as laid out Serial, addressed, SRAM-like host
one slice, components 439 about 190
sixteen slices 7,024 about 3,000
control board 4,587 about 3,960
whole machine, components 11,611 about 6,970
connector pins, all boards 1,564 about 1,360

A slice is what a pair of pupils builds. At a beginner's ten to fifteen seconds a joint the parallel slice is one and a half to two hours and the serial slice about forty minutes, so sixteen pairs finish the slices of a serial machine in a session. The control board is the problem in both designs: 40 per cent of the joints in the parallel machine and 57 per cent in the serial one. The serial design takes only about 600 joints off it, because the bit ring it adds is about as much soldering as the operand latches, constant diodes and line stages it removes. Of its roughly 4,000 joints, about 1,800 are repeated tiles that pairs can build like slices, 16 bit-ring stages, about 10 phase-ring stages and 17 line stages; the remaining 2,100 or so, IR, the 1-bit ALU, the decoder, the flags and the generator, are the one-off logic for the teacher or the keen few, and the place the next saving has to come from.

Three registers?

Asked 19 Nov 2026: since three times slower has been accepted for serial, would P, A and B alone, with constants 0 to 4, make the machine easier to build, and what does dropping C cost? Measured on the code rather than guessed. Static: 16 per cent of the runtime's instructions mention C. Dynamic, from emu -debug traces of the twelve compiled C test programs, 1,990,131 executed instructions of which 190,144 use C, 9.6 per cent, ranging from 2.6 to 18 per cent by program. Every one is a call, a return or a frame save: the Forth VM owns the registers, A as instruction pointer, B as data stack and C as call stack, and the compiler compiles to Forth words, so nothing uses C as a working register.

Not a clear win either way, and the four-register symmetry is a lesson in itself. Leaning to keep C.

Does the single instruction format cost transistors?

Asked 20 Nov 2026: the one format was chosen so that every instruction takes the same path, but would an accumulator machine with separate load, store and conditional jump instructions be smaller? Answered from the block table in the Simulation section, which is exact.

Where the 887 transistors are, by what they do rather than by block:

What Transistors Share
architectural state: P A B C, IR, IN0, IN1, flags and CIN 479 54 %
arithmetic: ALU, its enables, the constants 222 25 %
control: decode, ring, generator, clock 165 19 %
bus indicators and host pins 21 2 %

The format can only move the third row, and only part of it. What the three-field format costs over an accumulator machine: the src1 select lines, 8 transistors; the two OP0 phases of the ring, 12; and a few diodes in the read-enable terms. The dst select stays, because P, B and C must still be loadable, and the condition gate stays, because a conditional jump needs it whichever instruction carries it. IN0 is not a cost of the format: an accumulator fed straight into the ALU would have its result written back into itself through a transparent latch, so an accumulator machine needs a 16-bit output latch or master-slave registers, which is IN0 by another name. What the accumulator machine adds back: an opcode decoder for its instruction classes, about 8, and the logic to make load, store, jump and ALU instructions walk different phases, 5 to 10, which the ring now does not have at all because every instruction walks every phase. Net, the single format costs 10 to 20 transistors, under 2 per cent, and in exchange the sequencer is a bare ring, decode is 52 transistors of diode ANDs, and the sub-instruction step shows the same thirteen phases for every instruction, which is what makes it teachable. Writing the program counter as an ordinary register is the ARM convention, R15, and the PDP-11's, R7; it is only unusual at the small end.

What the three-address form buys back in software matters more than what it costs in hardware: A = B ADD C is one instruction and one memory cycle where an accumulator machine takes three, and the Forth inner interpreter is two instructions. At a 0.4 ms serial instruction that density is the speed.

The architectural lever is the first row, not the third. Every 16-bit register is 72 transistors and every latch 53, so a two-register machine, P and an accumulator with IR and one data latch, would be about 250 transistors of state instead of 479 and the machine about 650; that is the PDP-8 shape, and it puts the Forth stacks in memory, which triples the cost of every stack operation. Keeping C costs 72 transistors, dealt with above. The serial machine attacks the second row instead, 222 to about 30, and leaves the first alone, which is why its transistor count hardly falls while its parts and area halve.

Other machines, for scale. No hobby discrete-transistor 16-bit CPU is anywhere near 800: Dieter Müller's MT15, 16-bit data and address, four registers, four-bit parallel carry, about 3,000 transistors at 500 kHz; the Megaprocessor, 16-bit, 42,300 transistors with 10,548 LEDs, of which about 6,800 are processor logic. Eight- and twelve-bit machines: Joe Wingbermuehle's Q1, 8-bit data with a 16-bit address, 3,105 transistors, 208 of them in the 16-bit program counter alone; his Q2, 12-bit, bit-serial, PDP-8 style accumulator with eight instructions, about 1,000 to 1,100 MOSFETs on one board at 80 to 150 kHz, the closest modern relative of the serial design here; TraNOR, 8-bit, a single NOR as its ALU, 1,897 MOSFETs in the CPU. The machines that did beat 800 are the 1960s serial machines, and they did it the same way this design does, with diodes for the gates and transistors only where gain is needed: the LGP-21, 31-bit, 460 transistors and 375 diodes; the RPC-4000, 32-bit, 500 transistors and 4,500 diodes; the Packard Bell PB-250, 22-bit, under 350 transistors and 32 flip-flops; the PDP-8/S, 12-bit, about 1,000 transistors. Each of them kept its accumulator, instruction and counter as a recirculating track on the drum or delay line, so the registers cost nothing but a read head and a write head. That is the bit-serial memory rejected above, and it is the only known way below the state row. With 115 bits of visible state, each in a flip-flop with its own light, 887 transistors is 7.7 a bit; the PDP-8/S, with about 61 bits, was 16 a bit.

Conclusion: the single format is not where the transistors are, and it is the cheapest control there is. Keep it.

Recommendation, revised 19 Nov 2026 after the SRAM principle: the serial machine with addressed registers, a parallel bus to the host and a memory data register; the half-way design keeps most of the parts, and the rotating design loses its advantage once a bus exists. The decision is the user's, and it is the right time for it, before any tile is laid out.

Future extensions

Things that are designed, simulated or priced, and deliberately not in the machine, so that it gets built. Each is a change to one block.

Build order

  1. One register bit on a breadboard with the Pico driving CLR and SET directly. Confirm the 47k base from a 3.3 V bus sets the bit, that lift clears it, and that it holds for a day.
  2. One full register of 16 bits with its three line drivers. Pico writes random words and reads them back.
  3. The astable and the strobe generator, ticked by the Pico, then by the oscillator. Check the strobe order and non-overlap on a scope at the fastest range and that the READY handshake stalls cleanly.
  4. One ring stage pair, then the whole ring, driven by the strobe generator.
  5. One ALU bit slice, then 16, fed from IN0 and IN1.
  6. Decode, then run the Forth system with the compare mode on.

Open questions