Elements of computing systems: Logic gates

Posted on Oct 6th 2025 / tech 💻

Boolean logic can be implemented as physical devices which are called gates.

In digital circuits, gates are internally composed of a transistors that in composition, form the boolean function desired**.**

Transistors are semiconductor devices, which control the flow of current (electrons) from one terminal to another.

Operationally, a transistor is like a switch. It serves a single purpose which is to either allow or block an electrical current. The switch is controlled by a secondary electrical signal which is programatic.

A transistor is composed of three parts: source (where the current comes from), drain (where the current flows to), gate (which controls the flow of electricity).

transistor

When an electrical signal is applied to the transistor gate, the state of the transistor changes between on (allow electricity to flow) and off (block electric current).


For example, an AND gate takes two currents (x, y) and outputs a single state. The expected behaviour of the AND operator is return 1 when both inputs are 1, otherwise return 0.

A simplified implementation of an AND gate is:


We can compose Composite gates from Elementary gates. For example, if we want an AND gate with 3 inputs, we can compose it from two elementary AND gates.

Practically, transistor gates are designed and tested using Hardware Design Languages (HDL) before construction by fabrication companies.

In Nand2Tetris, a hardware simulator is provided to design and test your own gates.

The goal is to design and build a 16-bit system, therefore 16-bit composite gates will be required.

This means there are 16 input pins for each parameter of the function.