#04-2020-1002-104 lecture2 combinational logical circuits i · what is a logic gate? • a basic...

41
28.05.20 14:48 CSCI 150 Introduction to Digital and Computer System Design Lecture 2: Combinational Logical Circuits I Jetic Gū 2020 Summer Semester (S2)

Upload: others

Post on 22-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

28.05.20 14:48

CSCI 150 Introduction to Digital and Computer

System Design Lecture 2: Combinational Logical Circuits I

Jetic Gū2020 Summer Semester (S2)

Page 2: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Overview• Focus: Boolean Algebra

• Architecture: Combinatory Logical Circuits

• Textbook v4: Ch2 2.1 2.2; v5: Ch2 2.1 2.2

• Core Ideas:

1. Logical Gates

2. Introduction to LogicWorks

Page 3: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Logic Gates

Summary

P1 Logic Gates

And, Or, Not Gates, LogicWorks

Page 4: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

What is a Logic Gate?

• A basic circuit unit implemented using transistors and interconnections

• We when analysing a digital circuit, are not concerned with the internals of a gate, but only it’s external properties

• Performs a single logical operationoperate on one or more binary input signals to produce an output signal

Concep

t

P1 Logic Gates

Page 5: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

What is a Logic Gate?

Concep

t

P1 Logic Gates

• Similar to in electric circuit design, we are not concerned with the design of the lightbulb or battery, but we know what it does.

• A logic gate is like that, we know it’s external logic properties, that’s enough.

Page 6: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

First 3 Gates

Concep

t

P1 Logic Gates

Z = X ⋅ YXY

Z = X + YXY

Z = XX

AND Gate

OR Gate

NOT Gate

Input Output

Page 7: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

AND Operator and Boolean Algebra / Binary Logic

Concep

t

P1 Logic Gates

Z = X ⋅ YXY

• AND: is equal to AND

• Operator: (\cdot)

Z X Y

• Boolean Algebra

• Each variable can only have one of two values:

• TRUE/ON/1

• False/OFF/0

Page 8: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

AND Operator and Boolean Algebra

Concep

t

P1 Logic Gates

Z = X ⋅ YXY

AND Truth Table

0 0 0

0 1 0

1 0 0

1 1 1

Z = X ⋅ YYX

• AND: is equal to AND

• Operator: (\cdot)

Z X Y

• Truth Table

• Left: all combinations of input values

• Right: corresponding output values

Page 9: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

OR Operator

Concep

t

P1 Logic Gates

OR Truth Table

0 0 0

0 1 1

1 0 1

1 1 1

Z = X + YYX• OR: is equal to or

• Operator:

Z X Y

+

Z = X + YXY

Page 10: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

NOT Operator

Concep

t

P1 Logic Gates

OR Truth Table

0 1

1 0

Z = XX

• NOT: is equal to NOT

• Operator: (\overline{X})

• Also called: Complement operation; Inverter gate

Z X

X

Z = XX

Page 11: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Logic Gate and Boolean Algebra

• Logic Gates

• AND Gate, OR Gate, NOT Gate

• Actual physical components

Concep

t

P1 Logic Gates

• Boolean Algebra Operators

• AND ( ), OR ( ), NOT ( )

• Mathematical Representations

⋅ + X

THEY HAVE DIFFERENCES!

Page 12: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Digital Logical Gates• In math, everything happens simultaneously

• An equation like doesn’t change with time/location

• In digital circuits, we have electrons as 'messengers'. They travel at about 2,200 kilometres per second

• Logic gates are tiny circuits, which means they still have internal components: even slower

• This means: there will be tiny delays called Gate Delay

250 + 760 = 1010

Tech

nical

P1 Logic Gates

Page 13: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Digital Logical Gates

Tech

nical

P1 Logic Gates

Timing Diagram

Z = X ⋅ YXY

1

X1

Y1

0 1 2 3 4 5

Z

0 1 0 1 0

0 0 1 1 0

transition transition

Page 14: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Digital Logical Gates

Tech

nical

P1 Logic Gates

Timing Diagram (IDEAL)

Z = X ⋅ YXY

1

X1

Y1

0 1 2 3 4 5

Z

0 1 0 1 0

0 0 1 1 0

1

Page 15: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Digital Logical Gates

Tech

nical

P1 Logic Gates

Timing Diagram (REALITY)

Z = X ⋅ YXY

1

X1

Y1

0 1 2 3 4 5

Z

0 1 0 1 0

0 0 1 1 0

1 Gate delay tG

Page 16: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Gate Delay

Tech

nical

P1 Logic Gates

• Gate delay are small, but not ignorable in practice

• for simulation, you can ignore it for now

• Gate delay differs for different types and implementations of Gates

Page 17: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Simulation 1

Example

P1 Logic Gates

Truth Table

0 0

0 1

1 0

1 1

XY Z

ZYX = (X ⋅ Y) + (X + Y)

Page 18: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Simulation 1

Example

P1 Logic Gates

Truth Table

0 0 0

0 1 1

1 0 1

1 1 1

XY Z

ZYX = (X ⋅ Y) + (X + Y)

Page 19: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Simulation 2

Example

P1 Logic Gates

Truth Table

0 0 00 1 01 0 01 1 00 0 10 1 11 0 11 1 1

Z

YF

X

FYX = (XY) + (XZ)Z

Page 20: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Simulation 2

Example

P1 Logic Gates

Truth Table

0 0 0 00 1 0 11 0 0 01 1 0 00 0 1 00 1 1 11 0 1 11 1 1 1

Z

YF

X

FYX = (XY) + (XZ)Z

Page 21: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Simulation 3

Example

P1 Logic Gates

Truth Table

0 0 00 1 01 0 01 1 00 0 10 1 11 0 11 1 1

Z

Y

F

X

FYX = XYZ + XYZ + XZZ

Page 22: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Simulation 3

Example

P1 Logic Gates

Truth Table

0 0 0 00 1 0 11 0 0 01 1 0 00 0 1 00 1 1 11 0 1 11 1 1 1

Z

Y

F

X

FYX = XYZ + XYZ + XZZ

Page 23: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Summary

• AND, OR, NOT Operators

• Logic Gates

• Timing diagram

• Truth Table

• Gate Delay

Review

P1 Logic Gates

Page 24: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

LogicWorks

Summary

P2 Tutorial

Fire up your computer please!

Page 25: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Demo

P2 Tutorial

1. Open LogicWorks, Create new circuit diagram

Page 26: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. This is the main interface

Page 27: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Select Simulation IO from the Parts Palette

Page 28: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Pay Attention to Binary Probe and Binary Switch

Page 29: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Double click and place one of each on the main board

Page 30: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Use the 'Draw Signal' tool to connect the two parts

Page 31: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Switch back to the Cursor mode, now click on the switch and you can change the signal value

Page 32: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Select Simulation Gates

Page 33: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Select AND-2, then complete the above diagram

Page 34: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Select Clock from Simulation IO, then replace the lower Binary Switch with it. A Clock is a device that generates a 1 at a certain frequency

Page 35: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Select Clock from Simulation IO, then replace the lower Binary Switch with it

Page 36: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Right click the Red Wire, select Name

Page 37: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Complete the diagram like above, then click Reset Simulation

Page 38: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Tech

nical

P2 Tutorial

1. Use the Simulation Panel to control the speed of simulation, then you will see the Timing Diagram!

Page 39: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Exe 1• Curtain Motor Control

• Button1: 1 when user wants to open the curtain

• Button2: 1 when user wants to close the curtain

• Output1: 1 to make the motor open the curtain

• Output2: 1 to make the motor close the curtain

• Light: motor is active

Exerci

se

P2 Tutorial

• When both buttons are pressed, motors do nothing

Page 40: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Exe 2• Curtain Motor Control

• Sensor1: 1 when curtain is fully closed

• Sensor2: 1 when curtain is fully open

• Button1: 1 when user wants to open the curtain

• Button2: 1 when user wants to close the curtain

• Output1: 1 to make the motor open the curtain

• Output2: 1 to make the motor close the curtain

• Light: motor is active

Exerci

se

P2 Tutorial

• Stop the motor when the curtain is already fully opened/closed

Page 41: #04-2020-1002-104 Lecture2 Combinational Logical Circuits I · What is a Logic Gate? • A basic circuit unit implemented using transistors and interconnections • We when analysing

Summary

• Simulation in LogicWorks

• Binary Probe / Binary Switch in LogicWorks

• Gates in LogicWorks

• Clocks in LogicWorks

• Timing Diagram in LogicWorks

Review

P2 Tutorial