Actually, these basic operations are also the basic components that the physical circuits on a chip are built out of -- and in digital electronic terms, they are called gates. Well, actually the lowest level on a chip are transistors -- essentially electronic switches, but then these are used to build gates. So, all of the CPU operations that we can program at assembly level are basically designed into the hardware in terms of gates. And it takes alot of gates -- CPU's like the Pentium have millions of gates.
These basic boolean operations form a discrete mathematical system called boolean algebra. It obeys many of the properties that we are used to seeing in math, and more:
We can write down formulas in boolean math.
Their meaning can be verified by using a truth table.
There are many equivalent experssions and logic networks for any particular
truth table. Two logic expressions and logic netword are equivalent
if they have identical truth tables.
It is often important to perform logic minimization (simplification)
to reduce the cost of implementation. To simplify logic expressions,
we perform algebraic manipulations using the identities above.
We'll measure cost as the count of the total number of gates and gate inputs.
f1 = not x1 not x2 not x3 + not x1 not x2 x3 + not x1 x2 x3 + x1 x2 x3. Cost is 21. (picture in lecture)
= (not x1 not x2)(not x3 + x3) + (not x1 +
x1) x2 x3
= not x1 not x2 + x2 x3. Cost is 9. (picture
in lecture)
Example application: a memory consisting of eight chips, each containing 8K bytes. Chip 0 has addresses 0 -8191, chip1 has addresses 8192-16,383, and so on. The top three bits of the address but select one of the eight memory chips. They are the three inputs to a 3-to-8 bit decoder; the outputs of the decoder are chip-enable control lines of the memory chips. (See diagram in lecture.)
A demultiplexer: routes its single input to one of 2^N
outputs, depending on the values of the N control lines.
The OCx timing systems.
A B Sum Carry
0 0 0
0
0 1 1
0
1 0 1
0
1 1 0
1
A circuit for computing both the sum and the carry is called a half
adder.
The sum?
A EX-OR B.
The Carry?
An AND gate.
(Picture in lecture).
This is ok for adding the lowest order bits, but for all others, we
need to handle a carry from the right.
A full adder handles carry in, carry out, and the sum.
The truth table:
A B Carry in Sum
Carry out
0 0 0
0
0
0 0 1
1
0
0 1 0
1
0
0 1 1
0
1
1 0 0
1
0
1 0 1
0
1
1 1 0
0
1
1 1 1
1
1
A full adder is built from two half adders (picture in lecture).
sum = (A EX-OR B) EX-OR Carry in; (the number of 1s is odd)
carry out = ((A and B) or ( (A EX-OR B) and Carry in).
To build an adder for, say, two 16-bit words, just replicate the full-adder
16 times. The carry out of a bit is used as the carry into its left
neighbor. The carry into the irghtmost bit is wired to 0. This
type of adder is called a ripple carry adder, because any carries
have to ripple all the way through before the addition is complete.
We need memory circuits, which remembers the last value they were
set to.
A sequential circuit is one in which the outputs depend on the input and the current state.
Well, what happens if we connect some logic gates in a special circular fashion?
(picture in lecture of an SR flip-flop).
In an SR (set reset) flip-flop, the outputs will remain set according to the last high input. If the last high input was set (S), the output will be Q high and not Q low, but if the last high input was reset (R) the output will be Q low and not Q high.
Suppose: R=0, S=0, which they are most of the time.
For argument's sake, let us assume that Q=1, not Q=0 (which means that
S, not R, was last 1).
Now, suppose R becomes 1: Q becomes 0 not Q becomes1.
Then: R goes to 0 --> nothing changes! not Q is still
1, remembering that R was high.
S goes to 1 --> Q goes to 1, not Q goes to 0.
S goes to 0 --> nothing changes!
So far, we've seen two stable states with R=S=0: Q=1 and not Q=0 or vice versa.
With R=S=0, consider the outputs Q=0; not Q=0.
The state R=S=1; Q= notQ = 0 is consistent; however, it becomes nondeterministic
when the inputs return to 0. (If one drops to 0 before the other,
the one remaining 1 longest wins. ) But R=S=1 is not used in most applications.