Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf ·...

11
1 Chapter 3 Digital Logic Structures Original slides from Gregory Byrd, North Carolina State University Modified by Chris Wilcox, Sanjay Rajopadhye Colorado State University Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2 CS270 - Spring 2012 - Colorado State University Computing Layers Problems Language Instruction Set Architecture Microarchitecture Circuits Devices Algorithms

Transcript of Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf ·...

Page 1: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

1

Chapter 3 Digital Logic Structures

Original slides from Gregory Byrd, North Carolina State University

Modified by Chris Wilcox, Sanjay Rajopadhye Colorado State University

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

2 CS270 - Spring 2012 - Colorado State University

Computing Layers

Problems

Language

Instruction Set Architecture

Microarchitecture

Circuits

Devices

Algorithms

Page 2: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3 CS270 - Spring 2012 - Colorado State University

Transistor: Building Block of Computers ! Microprocessors contain billions of transistors

n  Intel Pentium 4 (2000): 48 million n  IBM PowerPC 750FX (2002): 38 million n  IBM/Apple PowerPC G5 (2003): 58 million

Logically, each transistor acts as a switch ! Combined to implement logic functions (gates)

n  AND, OR, NOT

! Combined to build higher-level structures n  Adder, multiplexer, decoder, register, memory, …

! Combined to build processor n  LC-3

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

4 CS270 - Spring 2012 - Colorado State University

Simple Switch Circuit ! Switch open:

n  Open circuit, no current

n  Light is off n  Vout is +2.9V

! Switch closed: n  Short circuit across

switch, current flows n  Light is on n  Vout is 0V

Switch-based circuits can easily represent two values: on/off, open/closed, voltage/no voltage.

Page 3: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

3

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

5 CS270 - Spring 2012 - Colorado State University

n-type Transistor ! A transistor is an electrically controlled switch ! n-type

n  when Gate has positive voltage, short circuit between #1 and #2 (switch closed)

n  when Gate has zero voltage, open circuit between #1 and #2 (switch open)

Gate = 1

Gate = 0

Terminal #2 is connected to GND (0V).

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

6 CS270 - Spring 2012 - Colorado State University

p-type Transistor ! p-type is complementary to n-type

n  when Gate has positive voltage, open circuit between #1 and #2 (switch open)

n  when Gate has zero voltage, short circuit between #1 and #2 (switch closed)

Gate = 1

Gate = 0

Terminal #1 is connected to +2.9V.

Page 4: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

4

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

7 CS270 - Spring 2012 - Colorado State University

Physical Transistor

http://en.wikipedia.org/wiki/CMOS

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

8 CS270 - Spring 2012 - Colorado State University

Logic Gates ! Use switch behavior of MOS transistors

to implement logical functions: AND, OR, NOT. ! Digital symbols:

n  recall that we assign a range of analog voltages to each digital (logic) symbol

n  assignment of voltage ranges depends on electrical properties of transistors being used ! typical values for "1": +5V, +3.3V, +2.9V ! from now on we'll use +2.9V

Page 5: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

5

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

9 CS270 - Spring 2012 - Colorado State University

CMOS Circuit ! Complementary MOS ! Uses both n-type and p-type MOS transistors

n  p-type ! Attached to + voltage ! Pulls output voltage UP when input is zero

n  n-type ! Attached to GND ! Pulls output voltage DOWN when input is one

! For all inputs, make sure that output is either connected to GND or to +, but not both!

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

10 CS270 - Spring 2012 - Colorado State University

Inverter (NOT Gate)

In Out 0 V 2.9 V

2.9 V 0 V

In Out 0 1 1 0

Truth table

Page 6: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

6

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

11 CS270 - Spring 2012 - Colorado State University

NOR Gate

A B C 0 0 1 0 1 0 1 0 0 1 1 0 Note: Serial structure on top, parallel on bottom.

Truth table

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

12 CS270 - Spring 2012 - Colorado State University

OR Gate

Add inverter to NOR.

A B C 0 0 0 0 1 1 1 0 1 1 1 1

Truth table

Page 7: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

7

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

13 CS270 - Spring 2012 - Colorado State University

NAND Gate (AND-NOT)

A B C 0 0 1 0 1 1 1 0 1 1 1 0

Note: Parallel structure on top, serial on bottom.

Truth table

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

14 CS270 - Spring 2012 - Colorado State University

AND Gate

Add inverter to NAND.

A B C 0 0 0 0 1 0 1 0 0 1 1 1

Truth table

Page 8: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

8

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

15 CS270 - Spring 2012 - Colorado State University

Series Parallel Circuits ! All transistors in an S-P circuit are of the same

type (n or p) ! An SP circuit is constructed with the following

rules n  A wire is an SP circuit n  A transistor is an SP circuit n  Two or more SP circuits connected in series is an SP

circuit n  Two or more SP circuits connected in parallel is an

SP circuit

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

16 CS270 - Spring 2012 - Colorado State University

Complement of an SP Circuit ! Complement of an SP circuit consisting of a

single transistor is the complementary type transistor (n becomes p and vice versa)

! To complement sub-circuits in series n  Complement the sub-circuits n  Connect them in parallel

! To complement sub-circuits in parallel n  Complement the sub-circuits n  Connect them in series

! Similar to De Morgan’s Laws

Page 9: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

9

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

17 CS270 - Spring 2012 - Colorado State University

Basic Logic Gates

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

18 CS270 - Spring 2012 - Colorado State University

DeMorgan's Law ! Converting AND to OR (with some help from NOT) ! Consider the following gate:

A B 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1

BA ⋅BA BA ⋅

Same as A OR B!

To convert AND to OR (or vice versa),

invert inputs and output.

Page 10: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

10

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

19 CS270 - Spring 2012 - Colorado State University

More than 2 Inputs? ! AND/OR can take any number of inputs.

n  AND = 1 if all inputs are 1. n  OR = 1 if any input is 1. n  Similar for NAND/NOR.

! Can implement with multiple two-input gates, or with single CMOS circuit.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

20 CS270 - Spring 2012 - Colorado State University

Summary

! MOS transistors are used as switches to implement logic functions. n  n-type: connect to GND, turn on (1) to pull down to 0 n  p-type: connect to +2.9V, turn on (0) to pull up to 1

! Basic gates: NOT, NOR, NAND n  Logic functions are usually expressed with AND, OR,

and NOT ! DeMorgan's Law

n  Convert AND to OR (and vice versa) by inverting inputs and output

Page 11: Chapter 3 Digital Logic Structures - CS CSU Homepagecs270/.Spring12/Notes/Lecture6(C3).pdf · 2012-02-04 · Digital Logic Structures Original slides from Gregory Byrd, North Carolina

11

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

21 CS270 - Spring 2012 - Colorado State University

Building Functions from Logic Gates ! Combinational Logic Circuit

n  output depends only on the current inputs n  stateless

! Sequential Logic Circuit n  output depends on the sequence of inputs (past and

present) n  stores information (state) from past inputs

! We'll n  first look at some useful combinational circuits, n  then show their limitations, n  and how how to overcome them with sequential circuits

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

22 CS270 - Spring 2012 - Colorado State University

Announcements Perficient will be in the CS building conference room, 2nd floor on Friday February 3 from 9:00 am – 12:00 noon critiquing resumes. Students are welcome to drop by during this time with a hard copy of their resume for review. They are also recruiting for full-time positions in consulting so this is also an opportunity for students to meet with this employer. Many students still have a zero on Quiz 0. The score that you got will not be entered until you see Sanjay during office hours. If you missed doing it, you can still earn full credit. Print it off the schedule page, do it and see Sanjay during office hours.