Bit switches, lamps and number parts

Switches, lamps, number parts, a constant bit and a step clock: ideal logic parts for building circuits out of gates, with no supply pins.

Like the ideal gate, a canvas of them needs no breadboard, resistor or ground. They are also a chip's pins: see Making chips.

Bit switch (bitin)

One output, Q, holding a 0 or a 1. Click it while the circuit runs to flip it; value says where it starts. It drives through a pull resistor rather than as a push-pull output, so a real output wired to the same net overrides it. Two switches on one net that disagree read unknown.

Property What it does
label The name shown on it, and the pin name it becomes in a chip.
value 0 or 1, where it starts.

Bit lamp (bitout)

One input, A. Lit for 1, dark for 0, and drawn with a dashed ring when the net is unknown or nothing drives it, because that is a fault and not a 0.

Property What it does
label The name shown on it, and the pin name it becomes in a chip.
color Green, red, amber or blue.

Number switch (bytein)

Up to eight outputs, D0 to D7, D0 the lowest bit, holding one value. Click it while the circuit runs to count up by one; it wraps at its width. Pins above the width drive nothing at all.

Property What it does
label The name shown on it. In a chip, label A with width 4 becomes pins A0 to A3.
value 0 to 255, where it starts, masked to the width.
width 1 to 8, how many pins carry the value.

Number display (byteout)

Up to eight inputs, D0 to D7, read as one value and shown in hex, decimal and binary. An input nothing drives reads as 0. An input that is driven but unknown makes the whole reading unknown, shown as ?.

Property What it does
label The name shown on it, and the stem of its pin names in a chip.
width 1 to 8, how many pins count.

Constant bit (bitconst)

One output, Q, that is always 0 or always 1. It is for an input that must be tied, such as the carry in of an adder that only ever adds one. It drives like a gate output, so it wins over a bit switch on the same net. Unlike a switch it is not a pin: it stays inside a chip when the chip is made.

Property What it does
value 0 or 1.

Step clock (stepclock)

One output, CLK. In step mode it does nothing until you click it while the circuit runs: each click is one tick, a rise and then a fall half a period later, so a counter moves by exactly one. In run mode it ticks by itself at its rate. Changing the mode while the circuit runs does not restart it, so you can run a program, pause it, and step through the next few instructions. Pausing never cuts a pulse short.

Property What it does
hz How fast it ticks in run mode, and how long a step's pulse lasts.
mode step or run.

What the model gets right

Everything a logic lesson needs: clean levels, an unknown that stays unknown, and a floating input told apart from a low one.

What it does not model

These are ideas, not components. There is no voltage worth reading, no current, no contact bounce and no supply. For a switch that bounces and needs a pull-up, use the pushbutton or the slide switch.

Common mistakes

Leaving a label at its default. Two switches both called A cannot both become chip pins, and the Make chip card says so. Label every switch and lamp for what it is.

See it in action

Adder from NAND gates on /templates, and every lesson on the path From gates to a computer, under Learn.