Skip to content
tkernel
Français GitHub

Open source simulator

Build your computer from a transistor.

A simulator where nothing is given. Two transistors make an inverter, four make a NAND gate. From there: adders, memories, a processor you wire yourself, your own language… and a snake game running on your machine.

Windows · macOS · Linux — free, MIT or Apache-2.0

Click input a to flip it: the signal crosses the two transistors. Pull a wire from a pin, drop a part from the dock. Open the workshop full screen

An interactive mock-up of the workshop, in French like the app. Its simulation is simplified: the real kernel will run here soon.

The staircase

From the transistor to the snake

Each step is built with the one before. What you make becomes a piece of the next level.

  1. TransistorsTwo pieces to start with: NMOS and PMOS.
  2. Logic gatesNOT, NAND, then all the others, made of transistors.
  3. AddersCounting in binary, bit by bit.
  4. MemoryLatches, registers, RAM: keeping a value over time.
  5. ProcessorA CPU you wire yourself, gate by gate.
  6. Instruction setYour own instructions, and an assembler that understands them.
  7. Screen and keyboardSeeing pixels, reading keys.
  8. Virtual machineA stack machine on top of your processor.
  9. Language and compilerA language of your own, and the compiler that translates it.
  10. Operating system…and finally the snake game, running on your machine.

Principles

Yours, from the first transistor

Nothing is given

No ready-made gate, no parts library. Every component is built by you, and can be reused in the next one.

Recognized by its behavior

verify tests what your component does, never how you made it. Everyone builds their own way.

A real simulation

At the transistor level, with real delays: glitches, setup times, oscillations. Each wire has one of four levels.

10ZX

Your processor, your instruction set

The reference processor (TK-16) is only an example. Everything is described in text files you can replace with your own.

A manual comes with the app, in the spirit of Nand2Tetris but starting from the transistor. Every example in it is run on each test. It is in French for now.

Without an interface

The same inverter, as text

Everything the workshop does goes through text commands. The tk notebook, scripts and your own programs drive the same kernel.

input a
output y
pmos a vdd y
nmos a y gnd
set a 0
settle
probe y