5. Logic Gates and Circuits


The functionality of even the most complex computer is achieved by connecting simple logic gates into operational circuits.


Basic Gates

There are four basic logic gates. The symbols used for these gates and their "truth tables" are given below (note that these are not the "standard" electrical engineering symbols for these gates).

INPUT

OUTPUT

0

1

1

0





INPUTS

OUTPUT

Input-1

Input-2

0

0 0
0 1 0
1 0 0
1 1 1


INPUTS

OUTPUT

Input-1

Input-2

0

0 0
0 1 1
1 0 1
1 1 1




INPUTS

OUTPUT

Input-1

Input-2

0

0 0
0 1 1
1 0 1
1 1 0




Basic Binary Encoding









Basic Binary Addition

0+0 = 0

0+1 = 1

1+0 = 1

1+1 = 10 (i.e. the result in this "column" is 0 with a "carry" of 1 that needs to be added to the next position to the left)

Logic Gate Application for Binary Addition

Truth Table for Single Bit Addition:

INPUTS

OUTPUTS

A

B

C

R

0

0

0 0
0 1 0 1
1 0 0 1
1 1 1 0


Addition of "words" with multiple "bits" extends this logic.



Selector

A collection of input wires or "bits" is "decoded" to turn on ("select") exactly one (output) circuit. (This is contrary to Englander's definition in "The Architecture of Computer Hardware and Software", page 720).



Multiplexor

A single input wire (at any one time) from a collection of possible inputs, is "encoded" into a pattern on a smaller collection of wires. A multiplexor performs the reverse function of a "selector". (The 2-input to 1-output ciruit described by Englander, as noted above, is a multiplexor).

Memory Circuits

Of course, to be very useful, we need many (millions) of these memory bits. A "Selector" circuit is then required to permit us to access a particular bit (or collection of bits) based on an input "address".

Application of Logic Gates to Basic Binary Encoding


Simple binary logic gates operate on one pair of single bits at a time, but most basic computer operations work on pairs of multiple bits. In general this increases the speed at which the computer operates. For example, comparing two patterns of 16 bits each in parallel should be 16 times faster than performing 16 separate comparisons on pairs of single bits.

Each logic gate takes a certain (small) amount of time to respond to a change in its inputs; this is called the gate switching time. The time required to perform any basic computer instruction depends upon the maximum number of logic gates signals must pass through to complete the instructional operation (plus some other "overhead" factors.

The fastest instructions should therefore be those which involve no operational logic gates: the shifts and rotates, followed by those which involve only one level of operational logic gates: the bit level logical operators, and so on.

In actual practice, computer instructions are organized so as to start on regular internal clock pulses (a 200MHz clock, for example, providing 200 million pulses per second). Even at today's high clock speeds, modern gate switching times in VLSI is fast enough that multiple logic gates can be managed within a single clock pulse "frame"; however, when the instruction becomes complex enough that the number of logic gates on the longest path reaches a certain level, the instruction will require multiple clock pulse "frames" to complete.


Fast Operations That Require No Operational Logic Gates



Bit Manipulation with a Single Layer of Operational Gates

Note that while these computer operations have the same names as the logic gates on which they are based, they operate on two words in parallel and not on a pair of bits.

Unsigned Binary Addition - Multiple Layers of Gates