Lecture Circuits 1
Hardware: Gates and Logic

Summarizing our probe into the computer onion: We now look deeper to appreciate:
how one can put together an extremely complex microprocessor using a few simple kinds of components called gates
Analogous to:
how one can put together an extremely complex Lego toy using a few simple kinds of components called blocks
 

To do this, we peel off another layer of the Computer Onion


to see what a microprocessor looks like at the hardware, or gate level.


The computer as a collection of gates (not Bill!!)

Do you remember the boolean operations from JavaScript?
 

or  || 
and  &&
not  !
Believe it or not
 
 
 

understanding the boolean operations
is the key to understanding 
how computers work at the gate level
 

The boolean operations combine boolean values (true, false) according to the following operation table:
 

combination value
true || true
true || false
false || true
false || false
true && true
true && false
false && true
false && false
!true
!false

But wait!  Remember, at this level, our computer can represent only 0's and 1's!  So let's make the identification:

true = 1
false = 0

For the purposes of this investigation, we will also use the actual words AND, OR and NOT instead of the JavaScript operators &&, ||, !.

&& = AND
|| = OR
! = NOT

Now our operation table (it's the same table, we're just using different symbols) looks like:

combination value
1 OR 1
1 OR 0
0 OR 1
0 OR 0
1 AND 1
1 AND 0
0 AND 1
0 AND 0
NOT 1
NOT 0

A neat way to remember this table:

Another neat way to remember this table:
Now What???

Here's the fun part:  it is very easy to create hardware components (called gates) that will combine 0's and 1's according to the above table.  And guess what?  These components are called:

OR gates
AND gates
NOT gates

Our goal is to show you how you how one can "wire together" gates to perform useful mathematical and logical operations.  If we wire together enough of these gates into appropriate patterns (and supply a clock for synchronization purposes), we can build a computer that can do anything that any computer now (or ever) will be able to do.  It doesn't seem possible, but, all we need are the three kinds of gates:
 

AND
OR
NOT
and we can build
 Any
computer 

As a matter of fact, we really only need two kinds: AND and NOT, or OR and NOT.  But we will use these three standard kinds, along with some other standard kinds of gates, to be introduced subsequently, to build our circuits.

We will be drawing circuit diagrams that wire these gates together in various patterns, so we need a way to draw, or represent, them.  The following are the standard way for representing these three kinds of gates.
 
 

Type of gate Its picture
    AND
    OR
    NOT

Referring back to the operation table, we see that AND and OR combine two bits (binary digits, or 0's or 1's)  to get a one-bit result (e.g. 1 AND 1 = 1), whereas NOT uses just one bit to produce a one-bit result.  We will refer to the bit(s) that get "used" as the input bit(s), and the result as the output bit.
 
 

1 AND 0 ==> 0
first input = 1
second input = 0 output = 0
To summarize:
 
AND has 2 inputs 1 output
OR has 2 inputs 1 output
NOT has 1 input 1 output

Fact:  1 AND 0 ==> 0
Schematic depiction:

1

0

0


 Now, let's reoganize our logic table into three separate tables, for future reference:
 
AND
inputs output
0            0 0
0            1 0
1            0 0
1            1 1
 
OR
inputs output
0            0 0
0            1 1
1            0 1
1            1 1
 
NOT
input output
0 1
1 0
 


We now show how Logg-o lets us build circuits using gates.

This demonstration showed how the gate EXOR works.  Here's the logic table for it:

EXOR

inputs output
0         0 0
0         1 1
1         0 1
1         1 0
or, in English:

the EXOR of two numbers is 1                 <==>                 one of the numbers is 1, but not both