silicon atlasTHE HARDWARE REFERENCE
العربية
Reference/First principles
Foundations

Logic gates & Boolean algebra

Simple truth tables become selectors, adders, and control circuits.

A computer can make every logical decision from one kind of gate.
NAND

Universal logic building block.

LIVE EXPERIMENT

Build a decision

Runs on your device
Tap each input to flip it.
A
B
XORA ≠ B
1OUTPUT
Truth table
ABXOR
000
011
101
110

NAND can build any Boolean function. Combining small gates creates selectors, adders, and control.

What this model includes

Ideal Boolean logic. Electrical timing and noise are omitted.

FOLLOW THE MECHANISM

What happens inside

1

Turn inputs into an output

AND is 1 only when both inputs are 1. OR needs at least one 1. XOR detects different inputs. NOT inverts one bit. NAND inverts AND and is functionally complete: networks of NAND gates can express any Boolean function.

2

Select and combine

A multiplexer chooses an input using select bits. A decoder activates a line for an input code. A full adder combines two bits and a carry; chaining carry signals forms a wider adder. Long carry paths can be shortened by more elaborate circuits at an area and power cost.

THE RELATIONSHIPsum = A XOR B XOR carry_in
PUT IT TO WORK

What this means for your code

Low-level engineer

Truth tables describe stable behavior. Propagation delay and glitches still matter. Synthesizers minimize logic under timing, area, and power constraints.

Software developer

Bit masks, flags, and branchless selection follow these same rules. Branchless code is useful when measured, not automatically faster.

GO TO THE SOURCE

Read the actual specifications

These references supply the underlying contracts and implementation details. The diagrams here are simplified teaching models.

Nand2Tetris · Boolean logicHebrew University / Reichman University

Keep following the connection

Understood the idea? Keep a note of your progress.