unit 2 –digital circuits...

10
2.1 Unit 2 – Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages to 1's and 0's… 2.3 Signal Types Analog signal Continuous time signal where each voltage level has a unique meaning Most information types are inherently analog Digital signal Continuous signal where voltage levels are mapped into 2 ranges meaning 0 or 1 Possible to convert a single analog signal to a set of digital signals 0 1 0 1 0 volts volts time time Analog Digital Threshold 2.4 Signals and Meaning 0.0 V 0.8 V 2.0 V 5.0 V Each voltage value has unique meaning 0.0 V 5.0 V Logic 1 Logic 0 Illegal Analog Digital Threshold Range Each voltage maps to '0' or '1' (There is a small illegal range where meaning is undefined since threshold can vary based on temperature, small variations in manufacturing, etc.)

Upload: others

Post on 16-Feb-2020

6 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.1

Unit 2 – Digital Circuits (Logic)

2.2

ANALOG VS. DIGITAL

Moving from voltages to 1's and 0's…

2.3

Signal Types• Analog signal

– Continuous time signal where each voltage level has a unique meaning

– Most information types are inherently analog

• Digital signal

– Continuous signal where voltage levels are mapped into 2 ranges

meaning 0 or 1

– Possible to convert a single analog signal to a set of digital signals

0

1

0

1

0

vo

lts

vo

lts

timetime

Analog Digital

Threshold

2.4

Signals and Meaning

0.0 V

0.8 V

2.0 V

5.0 V

Each voltage value

has unique meaning

0.0 V

5.0 V

Lo

gic

1L

og

ic 0

Ille

gal

Analog Digital

Threshold Range

Each voltage maps to '0' or '1'

(There is a small illegal range where meaning is

undefined since threshold can vary based on

temperature, small variations in manufacturing, etc.)

Page 2: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.5

Analog vs. Digital

USC students used to program analog computers!

2.6

Analog vs. Digital

• Analog Advantages

– Can be easier to build simple systems

• AM Radio

• Digital Advantages

– Not affected by small changes (noise) in the signal

– Repeatable

– The above make it easier to build large, complex

systems

2.7

COMPUTERS AND SWITCHING

TECHNOLOGY

A Brief History

2.8

Mechanical Computers• Primarily gear-based

• Two prototypes designed and partially implemented by Charles Babbage

– Used mechanical levers, gears, and ball bearings, etc.

• ______________________

– prototype and not fully programmable

• ______________________

– Never completed

– To be programmed with punch cards

– Designed to perform4 basic arithmeticops. (add, sub, mul, div)

Charles Babbage and his Difference Engine

Page 3: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.9

Electronic Computers• 1945 - ENIAC was first, fully

electronic computer

• Used thousands of _______

______ as fundamental

switching (on/off) technology

• Weighed 30 tons, required

15,000 square feet, and

maximum size number was 10

decimal digits (i.e.

±9,999,999,999)

• Still required some patch panels

(wire plugs) to configure it

2.10

Vacuum Tube Technology• Digital, electronic computers use some sort of

voltage controlled switch (on/off)

• Looks like a light bulb

• Usually 3 nodes

– 1 node serves as the switch value allowing current to flow between the other 2 nodes (on) or preventing current flow between the other 2 nodes (off)

– Example: if the switch input voltage is 5V, then current is allowed to flow between the other nodes

Vacuum Tube

Switch Input

(Hi or Lo Voltage)

A

B

Current can flow based on voltage of input switch

2.11

Vacuum Tube Disadvantages

• ___________________________

– Especially when you need

_____________________________

• ___________________________

– Can

• ___________________________

2.12

Transistor• Another switching device

• Invented by Bell Labs in 1948

• Uses semiconductor materials (silicon)

• Much smaller, faster, more reliable (doesn't burn out), and dissipated less power

Individual Transistors (About the size of your fingertip)

Transistor is 'on'

Transistor is 'off'

Gate

+5V

Source Drain

- - - -

--

High voltage at gate allows current to flow from source to

drain

Gate0V

Drain

-

Low voltage at gate prevents current from flowing from

source to drain

-

Silicon

Silicon

Source

Page 4: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.13

Moore's Law & Transistors

• Moore's Law = Number of transistors able to

be fabricated on a chip will

_____________________________

• Transistors are the fundamental building block

of computer HW

– Switching devices: Can conduct [on = 1] or not-

conduct [off = 0] based on an input voltage

2.14

How Does a Transistor Work

• Transistor inner workings

– http://www.youtube.com/watch?v=IcrBqCFLHIY

2.15

NMOS Transistor Physics

• Transistor is started by implanting two n-type silicon

areas, separated by p-type

n-type silicon (extra negative charges)

p-type silicon ("extra" positive charges)

-

+

+

+

-

-

-Source Input

Drain Input

2.16

NMOS Transistor Physics

• A thin, insulator layer (silicon dioxide or just "oxide") is placed over the silicon between source and drain

n-type silicon (extra negative charges)

Insulator Layer (oxide)

p-type silicon ("extra" positive charges)

-

+

+

+

-

-

-

Source Input Drain Output

Page 5: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.17

NMOS Transistor Physics

• A thin, insulator layer (silicon dioxide or just "oxide") is placed over the silicon between source and drain

• Conductive polysilicon material is layered over the oxide to form the gate input

n-type silicon (extra negative charges)

Insulator Layer (oxide)

p-type silicon ("extra" positive charges)

conductive polysilicon

-

+

+

+

-

-

-

Gate InputSource Input Drain Output

2.18

NMOS Transistor Physics• Positive voltage

(charge) at the gate input _________

the extra positive charges in the p-type silicon

• Result is a negative-charge channel between the source input and drain

p-type

Gate Input

Source Input Drain Output

n-type

+

+

+

+

+

+ + + +

+ + + +

- - -

negatively-charge channel

--

positive charge "repelled"

2.19

NMOS Transistor Physics

• Electrons can flow through the negative channel from the source input to the drain output

• The transistor is "on"

p-type

Gate Input

Source Input Drain Output

n-type

+

+

+

+

+

+ + + +

+ + +

-

-

-

- - - --

-

-

+

- -

Negative channel between source and drain =

Current flow

- -

2.20

NMOS Transistor Physics

• If a low voltage (negative charge) is placed on the gate, no channel will develop and no current will flow

• The transistor is "off"

p-type

Gate Input

Source Input Drain Output

n-type

-

-

-

-

-

- - - -

+

+

+

No negative channel between source and drain

= No current flow

-

-

- --

-

-

+ + +

Page 6: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.21

View of a Transistor

• Cross-section of transistors

on an IC

• Moore's Law is founded on

our ability to keep

shrinking transistor sizes

– Gate/channel width shrinks

– Gate oxide shrinks

• Transistor feature size is

referred to as the

implementation

"technology node"Electron Microscope View of Transistor Cross-Section

2.22

DIGITAL LOGIC GATES

2.23

Transistors and Logic

• Transistors act as

switches (on or off)

• Logic operations (AND /

OR) formed by

connecting them in

specific patterns

– Series Connection

– Parallel Connection

Series Connection

S1 AND S2 must be

on for A to be

connected to B

Parallel Connection

S1 OR S2 must be

on for A to be

connected to B

A BS2S1

A BS1

S2

2.24

Digital Logic• Forms the basic processing circuits for digital signals (i.e. 1's and 0's)

• Digital Logic still abstracts many of the physical issues (voltage, current,

parasitics, etc.) dealt with in the study of integrated circuits

– An alarm should sound if the key is in the ignition AND your seatbelt is NOT

fastened

– If the voltage threshold sensor rises above 3 volts create a conductive

channel to excite the ignition sensor…

Integrated Circuits(Transistors)

Computer Architecture(Functional Blocks)

Digital LogicOR

Page 7: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.25

Gates

• Each logical operation (AND, OR, NOT) can be

implemented in circuit form using the

corresponding logic gate

AND Gate OR Gate NOT Gate

2.26

AND Gates• An AND gate outputs a '1' (true) if ALL inputs are '1' (true)

• Gates can have several inputs

• Behavior can be shown in a truth table (listing all possible input

combinations and the corresponding output)

Y

XF

X Y F

0 0 0

0 1 0

1 0 0

1 1 1

2-input AND

X Y Z F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

3-input AND

F

X

Y

Z

F=X•Y F=X•Y•Z

2.27

OR Gates

• An OR gate outputs a '1' (true) if ANY input is '1' (true)

• Gates can also have several inputs

X Y F

0 0 0

0 1 1

1 0 1

1 1 1

2-input OR

X Y Z F

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

3-input OR

F

X

Y

Z

F=X+Y F=X+Y+Z

2.28

NOT Gate• A NOT gate outputs a '1' (true) if the input is '0' (false)

• Also called an "Inverter"

X F

1 0

0 1

F = X

Page 8: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.29

NAND and NOR Gates

NAND NOR

ZX

YZ

X Y Z

0 0 1

0 1 0

1 0 0

1 1 0

X

Y

X Y Z

0 0 1

0 1 1

1 0 1

1 1 0

YXZ ⋅= YXZ +=

X Y Z

0 0 0

0 1 0

1 0 0

1 1 1

X Y Z

0 0 0

0 1 1

1 0 1

1 1 1

AND NAND OR NOR

True if NOT ANY

input is true

True if NOT ALL

inputs are true

� Inverted versions of the AND and OR gate

2.30

XOR and XNOR Gates

XOR

ZX

Y

X Y Z

0 0 0

0 1 1

1 0 1

1 1 0

XNOR

ZX

Y

X Y Z

0 0 1

0 1 0

1 0 0

1 1 1

YXZ ⊕= YXZ ⊕=

True if an odd # of inputs are true

= True if inputs are different

True if an even # of inputs are true

= True if inputs are same

� Exclusive OR gate. Outputs a '1' if either input is a

'1', but not both.

2.31

Logic Example

0

0

1

0

2.32

Logic Example

0

1

0

0

Page 9: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.33

Delay Example

00

1

0

0 11

1

1

1 00

0

1

4 Levels of Logic

Change in D, C, or A must propagate

through 4 levels of gates

2.34

Logical Operations Summary

• All digital circuits can be described using AND, OR,

and NOT

– Note: You'll learn in future courses that digital circuits

can be described with any of the other sets:

• {AND, NOT}, {OR, NOT}, {NAND only}, or {NOR only}

• Normal convention: 1 = true / 0 = false

• A logic circuit takes some digital inputs and

transforms each possible input combination to a

desired output values

Logic

CircuitI0

I1

I2

O0

O1

Inputs Outputs

Trivia-of-the-day: The Apollo Guidance Computer that

controlled the lunar spacecraft in 1969 was built out of 8,400

3-input NOR gates.

2.35

Sequential Devices (Registers)

• AND, OR, NOT, NAND, and other gates are known as ____________

_____________________

– Outputs only depend on what the inputs are _________, not one second ago

– This implies they have no "memory" (can't remember a value)

• Sequential logic devices provide the ability to retain or

_______________ a value by itself (even after the input is changed

or removed)

– Outputs can depend on the current inputs, and previous states of the circuit

(stored values.)

– Usually have a controlling signal that indicates when the device should

update the value it is remembering vs. when it should simply remember that

value

– This controlling signal is usually the _________ signal

2.36

Registers

• Registers are the most common sequential

device

• Registers sample the data input (D) on the

edge of a clock pulse (CP) and stores that

value at the output (Q)

• Analogy: Taking a picture with your _____

____________ when you press a button

(clock pulse) the camera samples the scene

(input) and ______________________ it as

a snapshot (output)

Block Diagram of a Register

The clock pulse (positive edge)

here…

…causes q(t) to sample and hold the current d(t)

value

Page 10: Unit 2 –Digital Circuits (Logic)bits.usc.edu/files/ee109/slides/EE109Unit2_DigitalCircuits_Notes.pdfUnit 2 –Digital Circuits (Logic) 2.2 ANALOG VS. DIGITAL Moving from voltages

2.37

Flip-Flops

• Flip-flops are the building blocks of ____________

– 1 Flip-flop PER ______ of input/output

– There are many kinds of flip-flops but the most common is the

D- (________) Flip-flop (a.k.a. D-FF)

• D Flip-flop triggers on the clock edge and captures the D-value at

that instant and causes Q to remember it until the next edge

– _____________ Edge: instant the clock transition from low to high (0 to 1)

Positive-Edge Triggered D-FF

D Q

CLK

D-FFClock Signal

d(t) q(t)

2.38

Registers and Flip-flops

• A register is simply a _____

of D flip-flops that all

trigger on a single clock

pulse

D Q

D Q

D Q

D Q

CP

D3

D2

D1

D0

Q3

Q2

Q1

Q0

D-FF

D-FF

D-FF

D-FF

4-bit Register

CLK Qt+1

0 Qt

1 Qt

↑ Dt

Steady level of 0 or 1

Positive Edge

2.39

Pulses and Clocks

• Registers need an edge to trigger

• We can generate pulses at specific times

(creating an ______________ pattern) when we

know the data we want has arrived

• Other registers in our hardware should trigger at

a ___________ interval

• For that we use a clock signal…

– Alternating high/low voltage pulse train

– Controls the ordering and timing of operations

performed in the processor

– 1 ________ is usually measured from

rising/positive edge to rising/positive edge

• Clock frequency (F) = # of cycles per second

• Clock Period (T) = ______________

Processor

Clock Signal

0 (0V)

1 (5V)

1 cycle

2.8 GHz = 2.8*109 cycles per second

= 0.357 ns/cycle

Op. 1 Op. 2 Op. 3

Clock Pulses

2.40

Combinational vs. Sequential

• Sequential logic (i.e. registers) is used to store

values

– Each register is analogous to a ___________ in

your software program (a variable stores a

number until you need it)

• Combinational logic is used to process bits (i.e.

perform operations on values

– Analogous to operators (+,-,*) in your software

program