by Justin Champion - Staffordshire University
Download
Report
Transcript by Justin Champion - Staffordshire University
Computer Logic &
Logic Gates
Justin Champion
IITCT
Contents
Introduction to Logic
Look at the different Logic Gates
Summary
IITCT - Logic
George Boole
1815 to 1864
Boole approached logic in a new way reducing it to a simple
algebra, incorporating logic into mathematics. He also worked
on differential equations, the calculus of finite differences and
general methods in probability.
IITCT - Logic
Boolean Logic
Something is either
•
•
•
True or False
1 or 0
Correct or Wrong
Computers use this to make decisions
•
A computer is basically a large number of switches
•
Each of these can be either in the state of on (1) or off (0)
We do use this kind of logic every single day
IITCT
You can only get into the night club if you have a coloured
suit
True
Get into Club
False
Refused Entry to Club
IITCT
Logic
As seen you use this all the time
•
If (suit coloured) then
•
•
Else
•
Entry to club
Refused Entry
You can also put multiple conditions together
Conditional Logic
•
If (Suit Coloured and hat on the head) then
•
•
Entry to club
Else
•
Refused Entry
IITCT
You can only get into the club if you have a coloured suit
and a hat on your head!
False
True
Refused Accepted
False
Refused
False
Refused
IITCT
All of the previous are examples of Boolean Logic
Basic Logic Conditions Available
•
•
•
AND
OR
NOT
Logic Symbols used in diagrams
•
•
•
AND
OR
NOT
.
+
IITCT
Use of The Logic Symbols
If person wearing a Jacket AND a tie then enter
Entry = Jacket.Tie
If person wearing a jacket which is NOT white AND a tie
then enter
Entry = (jacket.white).tie
IITCT
What you have seen is every day examples of Logic
This is exactly what is used inside of computers to make
decisions
The following section will look at the formal method
describing truth tables
•
•
This is no more complicated than the previous examples
It is just a matter of realising this fact
IITCT
Switches
To represent the logic of 1 and 0 we use switches which
turn off (0) and on (1)
These switches are referred to as transistors
Collector
Collector
Base
Base
Flow
No Flow
1 Volt
0 Volts
Emitter
Emitter
IITCT
Processors use large numbers of these transistors to
make decisions
AMD 3200+ processor has 54.3 Million transistors!
IITCT
Example Truth Tables
A
B
A.B A+B A
A+B
0
0
0
0
1
1
0
1
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
0
AND
OR
NOT
NOT (A or B)
IITCT
To create a truth table first of all list all of the conditions
For binary values the number of unique conditions will be
•
•
•
2 number of conditions
So for this example it will 22 giving 4 unique conditions
For 3 conditions it will be 23 giving 8 unique conditions
A
B
0
0
0
1
1
1
1
0
IITCT
Try a truth table yourself
Create a truth table for
•
If man has long hair and not a member entry refused
IITCT
Answer
Create a truth table for
•
If person has long hair and not a member entry refused
Long Hair Member Not Member
0
0
1
1
1
0
1
0
0
1
0
1
Long Hair.Member
Accepted
Accepted
Accepted
Refused
IITCT
What this logic looks like in electrical circuits
First the truth table
A
0
0
1
1
B
0
1
0
1
X
0
0
0
1
IITCT
What this logic looks like in electrical circuits
X = A.B
A = 0, B = 0, X=0 Light is off
AND Gate
IITCT
What this logic looks like in electrical circuits
X = A.B
A = 1, B = 1, X=1 Light is on
AND Gate
IITCT
The logic used can also be drawn out on a diagram
IITCT
And Gate
- X = A.B
IITCT
Alarm System
A = Alarm Set
B = Door Sensor Opened
X = Alarm Sounding
A
B
X (A.B)
0
0
0
0
1
1
1
0
1
1
1
1
IITCT
OR Example
X=A+B
Alarm Set
A = Window Opened
B = IR Sensor Detects
movement
X = Alarm Sounding
A
B
X
0
0
0
0
1
1
1
0
1
1
1
1
IITCT
The Boolean logic gates we have discussed are NOT
exhaustive
There are a lot more gates which can be used with
increasing complexity
Example
•
•
XOR
XAND
Later on in the course these logic gates will be used to
carry out mathematical functions
IITCT
Why we learn this
Boolean logic is used in electronics and computers to
carry out actions
Programming Languages use this logic to test conditions
It is the basis of all computing
IITCT
Summary of what we have discussed
Boolean Logic