computer logic & logic gates justin champion. iitct contents introduction to logic look at the...

26
Computer Logic & Logic Gates Justin Champion

Upload: neil-biggins

Post on 31-Mar-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

Computer Logic & Logic Gates

Justin Champion

Page 2: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT

ContentsIntroduction to LogicLook at the different Logic GatesSummary

Page 3: 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.

Page 4: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 5: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT

You can only get into the night club if you have a coloured suit

TrueGet into Club

FalseRefused Entry to Club

Page 6: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT Logic

As seen you use this all the time• If (suit coloured) then

• Entry to club

• Else• 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

Page 7: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT You can only get into the club if you have a coloured suit

and a hat on your head!

FalseRefused

TrueAccepted

FalseRefused

FalseRefused

Page 8: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 9: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 10: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 11: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Emitter

Collector

Base

0 Volts

No Flow

Emitter

Collector

Base

1 Volt

Flow

Page 12: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT Processors use large numbers of these transistors to

make decisions AMD 3200+ processor has 54.3 Million transistors!

Page 13: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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 0AND OR NOT NOT (A or B)

Page 14: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 15: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT Try a truth table yourself

Create a truth table for• If man has long hair and not a member entry refused

Page 16: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT Answer

Create a truth table for• If person has long hair and not a member entry refused

Long Hair Member Not Member Long Hair.Member

0 1 0 Accepted

0 0 1 Accepted

1 1 0 Accepted

1 0 1 Refused

Page 17: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT What this logic looks like in electrical circuits

First the truth table

A B X

0 0 0

0 1 0

1 0 0

1 1 1

Page 18: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT What this logic looks like in electrical circuits

X = A.B A = 0, B = 0, X=0 Light is off

AND Gate

Page 19: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT What this logic looks like in electrical circuits

X = A.B A = 1, B = 1, X=1 Light is on

AND Gate

Page 20: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT The logic used can also be drawn out on a diagram

Page 21: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT

And Gate - X = A.B

Page 22: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 23: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT

OR Example X = A + B

Alarm SetA = Window OpenedB = IR Sensor Detects movementX = Alarm Sounding

A B X

0 0 0

0 1 1

1 0 1

1 1 1

Page 24: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 25: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

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

Page 26: Computer Logic & Logic Gates Justin Champion. IITCT Contents Introduction to Logic Look at the different Logic Gates Summary

IITCT Summary of what we have discussed

Boolean Logic