programming for gcse topic 9.1: logic circuits

20
Programming for GCSE Topic 9.1: Logic Circuits Teaching London Computing William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London

Upload: zahina

Post on 08-Feb-2016

46 views

Category:

Documents


0 download

DESCRIPTION

T eaching L ondon C omputing. Programming for GCSE Topic 9.1: Logic Circuits. William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London. Aims. Show how computers are built from logic gates Logic gates … and truth tables … and boolean algebra … - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Programming for GCSE Topic 9.1: Logic Circuits

Programming for GCSE

Topic 9.1: Logic Circuits

Teaching London Computing

William MarshSchool of Electronic Engineering and Computer Science

Queen Mary University of London

Page 2: Programming for GCSE Topic 9.1: Logic Circuits

Aims

• Show how computers are built from logic gates• Logic gates• … and truth tables• … and boolean algebra• …• Circuit for Adding

Page 3: Programming for GCSE Topic 9.1: Logic Circuits

Teaching Issue• How to provide a coherent, joined up view• Some curricula include logic circuits but it is

not related to operation of a computer

• Logic circuits add binary numbers computer architecture

Page 4: Programming for GCSE Topic 9.1: Logic Circuits

LOGIC GATESAnd, Or, Not

Page 5: Programming for GCSE Topic 9.1: Logic Circuits

Logic Gates• Logic gates are electronic components• Transistors

• Gates behave like switches• Two states• State represented by a boolean variable

open, X = 0 closed, X = 1

Page 6: Programming for GCSE Topic 9.1: Logic Circuits

Basic Logic Gates• OR gate

• AND gate

XY

X

XY

X

Y

Y

Page 7: Programming for GCSE Topic 9.1: Logic Circuits

NOT Gate

• Only 1 input

X not X

X

not X

Page 8: Programming for GCSE Topic 9.1: Logic Circuits

Basic Logic GatesOR gate NOT gate

AND gate

XY

XY

X not X

Page 9: Programming for GCSE Topic 9.1: Logic Circuits

Connecting Gates

• Output of one gate connects to input for next

X0

X1YX2

Page 10: Programming for GCSE Topic 9.1: Logic Circuits

TRUTH TABLES FOR CIRCUITS

Page 11: Programming for GCSE Topic 9.1: Logic Circuits

AND, OR• OR gate

• AND gate

XY

XY

X Y X . Y0 0 00 1 01 0 01 1 1

X Y X + Y0 0 00 1 11 0 11 1 1

True when

either X or Y true

True when both X and Y true

Page 12: Programming for GCSE Topic 9.1: Logic Circuits

Circuit to Truth Table• Test a circuit X0

X1YX2

X2 X1 X0 Y0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

Page 13: Programming for GCSE Topic 9.1: Logic Circuits

Circuit to Truth Table• Test a circuit X0

X1YX2

X2 X1 X0 Y0 0 0 00 0 1 00 1 0 00 1 1 01 0 0 1 0 1 1 1 0 1 1 1

Page 14: Programming for GCSE Topic 9.1: Logic Circuits

Circuit to Truth Table• Test a circuit X0

X1YX2

X2 X1 X0 Y0 0 0 00 0 1 00 1 0 00 1 1 01 0 0 01 0 1 11 1 0 11 1 1 1

Two circuits equivalent if (and only if)

they have the same truth

table

Page 15: Programming for GCSE Topic 9.1: Logic Circuits

TRANSLATING CIRCUITS TO BOOLEAN ALGEBRA

Page 16: Programming for GCSE Topic 9.1: Logic Circuits

Circuit to Formula• Label each point in

turn

X0

X1

X2

X0 or X1

(X0 or X1) and X2

not X1

((X0 or X1) and X2) or not X1

Page 17: Programming for GCSE Topic 9.1: Logic Circuits

De-Morgan’s Laws – Recap • Important law for exchanging AND with

OR

( A . B ) = A + B ‘A and B’ is false when either A is false or B is false

( A + B ) = A . B ‘A or B’ is false when both A is false and B is false

Page 18: Programming for GCSE Topic 9.1: Logic Circuits

De-Morgan’s Law II

• Same with circuits

• Quiz: draw the other law as a circuit

AB

A

B

( A + B ) = A . B

Page 19: Programming for GCSE Topic 9.1: Logic Circuits

De-Morgan’s Law III

• Second law as a circuits

AB

A

B

( A . B ) = A + B

Page 20: Programming for GCSE Topic 9.1: Logic Circuits

Summary

• Logic circuits• Build a computer

• Truth table• Specify a circuit

• Boolean expression (formula)• Algebraic rules

• All express same thing• Translate from one to other