HOW COMPUTERS WORK

A knowledge of binary notation and binary arithmetic is required.



This write up uses the following logic circuits from the 74LS logic family. There are many more but all are made from 3 functions “and” “or” and ‘invert”. There are also many other logic families.
And 74LS08
Or 74LS32
Nand 74LS00
Nor 74LS02
Invert 74LS04
D type latch 74LS74
and lots more


1) The Power supply

Five volts was the traditional voltage chosen to operate the early circuits used in computers This value
is still used in many cases. It is required for the 74LS logic family .

Two voltages levels have been assigned to represent values of one and zero. Zero to one
half volts was assigned a logic value of zero. Or a logic low. 2.0 to 5 volts was assigned to the
value one or a logic high. Voltage levels between one half volt and 2.0 volts are not allowed.

This is shown in figure one.




Once these levels have been defined we will not need to refer to volts or current again. We can
concern ourselves only with the logic states of 1 ( high) or 0 ( low)



2) GATES

There are three basic gates that others are derived from. They are “and” “or” gate, and “invert” gate. These three circuits can be used to build computers of amazing complexity.


INVERTER GATE
The function of the inverter gate is simply to invert the input and present it to the output.

Thus a signal of 1 or logic high on the input will cause a signal level of 0 or logic low on the output. This
is shown on the following truth table. Also the symbol for an “inverter” is shown.



AND GATE

The “and” gate is a transistor circuit with 2 inputs and one output. The signal levels for the “and” gate
and it’s symbol are shown.




Or gate

The “or” gate also has 2 inputs and one output but the inputs are treated differently as shown here.
The “or” gate symbol is shown also. There is also a variation on the “or” gate called the “exclusive or” this differs from the ordarny “or” in that if A and B are both high the output is low.



In practice it is found useful to combine the “and” and the “invert” functions to create a “Nand” or negative “and”
gate. It is made by inverting the output. It is shown below with it’s truth table.


Likewise the “or” gate is combined with an “invert” function to create “nor” or negative “or” gate. Small circles are
added to the symbols of the “and” and “or” gates to indicate an inverted output. The nor gate is shown below.



There is one more device to look at. it is called a pull up resistor and it is used to keep selected inputs high.

Here is the symbol for a pull up resistor It’s value is 1000 ohms.


One resistor can pull up from 1 to 25 gates. One gate output can drive up to 10 gates with a high
or a low signal





LATCH

Before we start the latch below has a illegal state. This is that both A and B inputs are low. These inputs are normally high and to change the state of the latch low going short pluses are used. These pulses cannot be applied at the same time to both the A and the B inputs. They must be applied at seperate times. A latch is made from 2 “nand” gates. It is shown below.


The normal state of a latch is with both inputs ( A and B ) high. The output however is not yet specified. We
only know that C and D will be opposite but do not know which will be high. It requires a short negative pulse on
one input to set either state.


Let A go low for an instant and then go high. Lets follow the results. If A goes low then C must go
high by the nand truth table. B was already high so with both C and B high D will go low. The low on
D is present on the 2nd input of the upper gate and this preserves the output of the upper gate so C will stay high.


This means the latch detects the momentary low on A and latches on it. The latch remembers this
state and it continues until we place a short low on B. Then the state of the latch will switch and it will
stay switched until the A input goes low again.

We have just built a one bit memory.

THE D TYPE LATCH



Below is a D type flip flop. It is made from 4 Nand gates and one
inverter gate. The shortcut way of defining a 2 input nand gate is that
the output is low if both inputs are high. Also any low input on a nand gate produces a high on the output.

If the D input is high and a clock pulse is placed on C then when the clock pulse goes high A has two high inputs. This produces a low
on the upper gate of Latch X, Y and Q goes high.

Now if the D input is low and a clock pulse is placed on C both inputs
of B go high. Therefore the output of B goes low. The low output of
B produces a low on he lower gate of latch XY so (Q) goes high
and Q is low. Thus we have a gate where whatever state is placed
on D it is transfered to the Q output.








We still have not addressed the preset and clear pins they can be added by replacing the X,Y latch with a latch made from a 3 input nand gate as shown below.









Below is the symbol and a truth table.


From the truth table we can deduce the following.

PR ( preset) should be high most of the time and may pulse low to set a high on Q

CLR ( clear) should be high most of the time and may pulse low to set a low on Q

PR and CLR should not be low at the same time.

The (Q) pin is always the inverse of the Q pin.

And most importantly either a high or a low signal may be placed on D and this signal will be clocked through
to Q on the rising edge of the clock pulse.




DIVIDE BY 2

Now lets describe a divide by two circuit made with the D type flip flop.
All that is required is a single wire as shown.





The resistor is a pull up and it’s function is to pull both inputs to a high state. If it were omitted both inputs would normally float high anyway but would be susceptible to noise.


For an input to this circuit we apply a 1000 hertz logic square wave to C as shown. Then lets look at each rising
edge. On every rising edge the D input will be transferred to the Q output. This is shown below.





So now we have built a circuit that will divide the frequency of a square wave input pulse in half.


COUNTER MADE FROM D TYPE FLOP FLOPS

If we connect 4 d type flip-flops together as shown and reset them with a clear pulse we will get a counter circuit.

The schematic is:




Now the A, B, C and D outputs will step from a binary count of zero to a count of 15 and then back to zero. A is the
LSB ( least significant bit) B is next, C is next, and D is the MSB ( most significant bit)

The first three input pulses are numbered. before thsy occur A B C and D are all zero and the output is zero as shown
at the bottom of the drawing. After the first pluse A is high and all others are low so the count is 1 After the second
pluse B is high but A C D are all low B is 2nd bit so the count is 2 ( 2 + 0 + 0 +0 ) C is the 4 bit and D is the 8 bit .
So for example

1 = 1000
2 = 0100

4 = 0010

8 = 0001

15 = 1111 = 1 + 2 + 4+ 8










Although we have only shown counts from 0 to 9 the 4 bit counter counts from 0 to 15. or 2 ^4 -1 If we had used
8 flip flops we could count to 255. If we had used 16 we could count to 64,000 or so and 32 would bring us to
about 4 billion.




The counter is one of the circuits used in a computer.



REGISTER


D type flip flops may be wired to produce a register. A register is a circuit that stores a 4 (or more) bit number.
It is shown below.




Here is a 4 bit register circuit. 4 bit data word is placed on the 4 input lines and a clock pulse locks it in the register.
A pulse on the clear line can be used to clear the register. As before the size of the register can be expanded to
8, 16, 32 or even 64 bits. An accumliater is a special type of register that keeps track of arithmetic sums during
an adding process.

Other registers

other types of registers are shift register where data bits may be shifted either left or right There are
also rotate registers where in the case of a right shift the data at the right end is stored back in the
extreme left register.


If the data in a register represents a binary count then a right shift multiples the number by 2 and a left shift divides the number by two.

There is also a device called a adder. This makes it possible to keep a running total of an addition by adding new numbers one at a time. It is used for b oth data and control functions.

3 MICROPROCESSORS

Counters, registers, shift registers, adders are trhe main circuits used in a microprocessor. They are connected
to two groups of wires. The first is termed a data bus and the second is a address bus. The Z80 microprocessor
has a 8 wire data bus and a 16 wire address bus. The data and address bus connect the microprocessor to the
memory. Timing signals as well as single bit flags used to insure correct data is obtained.




In practice the design of the microprocessor results in a set of instructions to accomplish specific tasks. All these
tasks involve moving words composed of ones and zeros in and out of both memory and the various registers.
Tasks like add to data in the accumulator, jump to a specific address, clear a register, or many others. The
process of writing these instructions may be done in binary code but it is usually done in assembly language.
These instructions are placed in memory. When the program is run the instructions are carried out one at a time.
One of the more interesting aspects is the Von Neuman architecture that is used. This allows both data and
instructions to be mixed in memory. It is up to the instructions to know how many following addresses are data
and to interpret the code following the data as an instruction.


Many times multiplexers are used. One example of a multiplexer is to pass 16 bits of data on a 8 bit bus. It is done
with 2 cycles where the lower 8 bits are transmitted first followed by the upper 8 bits. The multiplexer is sometimes termed a ‘mux”.

For an example of a microprocessor see the Z80 programming manual. Beware it is not simple.

http://www.zilog.com/docs/z80/um0080.pdf

Arydberg@yahoo.com


RETURN
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx