Circuits and Transistors

Relays

Computers are built out of simple switches, such as the telegraph relays described in "Code":

Relays are actually sufficient to build a full computer, but are not really practical:

• They are large.
• They take a lot of power.
• They have moving parts so are relatively slow to switch.

The first Intel CPU, the 4004 circa 1971 had 2,300 switches. Modern Intel CPUs have over 2 billion. One gigabyte of modern RAM has roughly 1 billion.

Transistors

A transistor is identical to a telegraph relay in function. They are both switches that are controlled by an incoming signal. The only difference is that transistors are much smaller, cheaper, faster and take less power.

Below is a diagram of a transistor:

The "collector" is normally attached to a power source, and is like the voltage coming into the relay above. The "emitter" is the output of the transistor. The "base" is the input to the transistor and determines whether or not it is on or not.

There are actually two types of transistors:

• N-type transistors are turned on with a current at the base, and are otherwise off (like the relays described in "Code").
• P-type transistors are turned off with a current at the base, and are otherwise on.

Semi-Conductors

Transistors are normally made of silicon, which is a semi-conductor (a material that conducts some electricity, but not as much as a conductor). The silicon is "doped" with other chemicals which control the conductivity of the material.

The goal of doping is to add chemicals with either more or fewer available electrons into the silicon. If extra electrons are added, then it is called an N-type semi-conductor. If fewer are added, it is a P-type semi-conductor.

Both types of semi-conductor material are used in the creation of transistors. The collector and emitter are either both N-type, or both P-type, with the base being the opposite type.

Below is a "NPN" transistor:

This is also called a "N-type" transistor because when a negative voltage is applied to the base of the transistor, then current is able to flow through the transistor.

A "PNP" or "P-type" transistor is the opposite:

Larger components such as processors, memories and so on are not built out of individual transistors which are wired together manually. Instead, many transistors are "printed" onto a single board along with resistors and capacitors, and outgoing or incoming wires (called pins) which allow it to communicate with other components.

Circuits and Boolean Logic

There are three main operations in boolean logic, and each of them can be realized using a combination of transistors. If we have a boolean statement like the following:


a & b


Then the expression is true only when both a and b are true. This can be computed using two N-type transistors wired in series.

A current flowing through the circuit (which represents the value 1, or true), must flow through both transistors to reach the output of the circuit. If either one of the inputs is off, then the N-type transistor it is attached to will turn off, stopping the current.

Likewise, an expression using or such as:


a | b


Can be wired into a circuit using two N-type transistors in parallel.

Here if either one of the transistors is activated with a current coming into it, then the signal can flow from the energy source to the output of the circuit.

The last major component of boolean logic is the not operation. This can be accomplished with a single P-type transistor. This transistor allows current to pass through when it is turned off and stops when it is turned on, effectively negating its input.

We say that there is an isomorphism between these circuits and boolean logic, or that the two structures are isomorphic. Any boolean logic statement can be translated into an equivalent circuit and for any circuit we can express its behavior with a boolean expression.

Examples

Make circuits using transistors that are equivalent to the following boolean expressions:

• !a & !b
• !(a | b)
• a | b | !c