Lecture 6

34
I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 ECE2072/TRC2300/TEC2172: Digital Systems based on textbook Contemporary Logic Design, 2 nd Edition by R. H. Katz and G. Borriello COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act). The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice.

description

Lecture 6

Transcript of Lecture 6

Page 1: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 1

ECE2072/TRC2300/TEC2172: Digital Systems

based on textbook

Contemporary Logic Design, 2nd Editionby R. H. Katz and G. Borriello

COMMONWEALTH OF AUSTRALIACopyright Regulations 1969

WARNING

This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act).

The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act.

Do not remove this notice.

Page 2: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 2

Prescribed Text:

Contemporary Logic Design 2e

By Katz and Borriello

Available from the Campus Bookshop

Other Versions:First EditionInternational Edition

ECE2072/TRC2300/TEC2172: Textbook

Page 3: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 3

ECE2072/TRC2300/TEC2172 Overview: Why study logic design?

Obvious reasonsthis unit is part of the BE/BTE/BCSE requirementsit is the implementation basis for all modern computing devices

building large things from small componentsprovide a model of how a computer works

More important reasonsthe inherent parallelism in hardware is often our first exposure to parallel computationit offers an interesting counterpoint to software design and is therefore useful in furthering our understanding of computation, in general

Page 4: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 4

Applications of logic design

Conventional computer designCPUs, busses, peripherals

Networking and communications

phones, modems, routersEmbedded products

in cars, toys, appliances, entertainment devices

Scientific equipmenttesting, sensing, reporting

The world of computing is much much bigger than just PCs!

Page 5: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 5

What will we learn in this class?

The language of logic designBoolean algebra, logic minimization, state, timing, CAD tools

How to specify/simulate/compile/realize our designsHardware Description Language (HDL) - Verilogtools to simulate the workings of our designslogic compilers to synthesize the hardware blocks of our designsmapping onto programmable hardware – Xilinx FPGA

Contrast with software designsequential and parallel implementationsspecify algorithm as well as computing/storage resources it will use

Page 6: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 6

Digital vs. analog

Convenient to think of digital systems as having onlydiscrete, input/output values - DigitalIn reality, real electronic components exhibitcontinuous behavior - Analog

Why do we make the digital abstraction anyway?switches operate this wayeasier to think about a small number of discrete values

Why does it work?does not propagate small errors in valuesalways resets to 0 or 1

Page 7: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 7

Technology State 0 State 1

Relay logic Circuit Open Circuit ClosedCMOS logic 0.0-1.0 volts 2.0-3.0 voltsTransistor transistor logic (TTL) 0.0-0.8 volts 2.0-5.0 voltsFiber Optics Light off Light onDynamic RAM Discharged capacitor Charged capacitorNonvolatile memory (erasable) Trapped electrons No trapped electronsProgrammable ROM Fuse blown Fuse intactBubble memory No magnetic bubble Bubble presentMagnetic disk No flux reversal Flux reversalCompact disc No pit Pit

Mapping from physical world to binary world

Page 8: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 8

Collection of devices that sense and/or control wires that carry a digital value (i.e., a physical quantity, interpreted as a “0” or “1”, “true” or “false”, etc)

example: digital logic where voltage < 0.8v is a “0” and > 2.0v is a “1”

Primitive digital hardware deviceslogic computation devices (sense and drive)

are two wires both “1” - make another be “1” (AND)is at least one of two wires “1” - make another be “1” (OR)is a wire “1” - then make another be “0” (NOT)

memory devices (store)store a valuerecall a previously stored value

sense

sense

driveAND

What is digital hardware?

Page 9: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 9

What is logic design? (Sec 1.1 Katz 2e)What is design?

given a specification of a problem, come up with a way of solving it choosing appropriately from a collection of available componentswhile meeting some criteria for size, cost, power, beauty, elegance, etc.

What is logic design?determining the collection of digital logic components to perform a specified control and/or data manipulation and/or communication function and the interconnections between themwhich logic components to choose? – there are many implementation technologies (e.g., off-the-shelf fixed-function components, programmable devices, transistors on a chip, etc.)the design may need to be optimized and/or transformed to meet design constraints

Page 10: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 10

A quick history lesson (Sec 1.2 Katz 2e)1850: George Boole invents Boolean algebra

maps logical propositions to symbolspermits manipulation of logic statements using mathematics

1938: Claude Shannon links Boolean algebra to switcheshis Masters’ thesis

1945: John von Neumann develops the first stored program computer

its switching elements are vacuum tubes (a big advance from relays)

1946: ENIAC . . . The world’s first completely electronic computer

18,000 vacuum tubesseveral hundred multiplications per minute

1947: Shockley, Brittain, and Bardeen invent the transistor

replaces vacuum tubesintegration of multiple devices into one packagegateway to modern electronics

Page 11: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 11

What is happening now in digital design?Important hardware design trends in industry

larger and larger designsshorter and shorter time to marketcheaper and cheaper products

Scalepervasive use of computer-aided design tools over hand methodsmultiple levels of design representation (abstraction)

Time emphasis on abstract design representationsprogrammable rather than fixed function componentsautomatic synthesis techniquesimportance of sound design methodologies

Costhigher levels of integrationuse of simulation to debug designssimulate and verify before you build

Page 12: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 12

Computation: abstract vs. implementation (Sec 1.3 Katz 2e)

Up to now, computation has been a mental exercise (paper, programs)This class is about physically implementing computation using physical devices that use voltages to represent logical valuesBasic units of computation are:

representation: "0", "1" on a wireset of wires (e.g., for binary ints)

assignment: x = ydata operations: x + y – 5control:

sequential statements: A; B; Cconditionals: if x == 1 then yloops: for ( i = 1 ; i == 10, i++)procedures: A; proc(...); B;

We will study how each of these are implemented in hardware and composed into computational structures

Page 13: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 13

close switch (if A is “1” or asserted)and turn on light bulb (Z)

A Z

open switch (if A is “0” or unasserted)and turn off light bulb (Z)

Switches: basic element of physical implementations (Sec 1.3.1 Katz 2e)

Implementing a simple circuit (arrow shows action if wire changes to “1”):

Z ≡ A

AZ

Page 14: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 14

Compose switches into more complex ones (Boolean functions):

AND

OR

Z ≡ A and B

Z ≡ A or B

A B

A

B

Switches (cont’d)

AB

Z

ZAB

A

0011

B

0101

Z

0001

A

0011

B

0101

Z

0111

Page 15: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 15

Switch settingsdetermine whether or not a conducting path exists to light the light bulb

To build larger computationsuse a light bulb (output of the network) to set other switches (inputs to another network).

Connect together switching networksto construct larger switching networks, i.e., there is a way toconnect outputs of one network to the inputs of the next.

Switching networks

A

B

Z ≡ A or B

Page 16: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 16

conductingpath composed

of switchescloses circuit

current flowing through coil magnetizes core and causes normally closed (nc) contact to be pulled open

when no current flows, the spring of the contact returns it to its normal position

A simple way to convert between conducting paths and switch settings is to use (electro-mechanical) relays.What is a relay?

What determines the switching speed of a relay network?

Relay networks

Page 17: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 17

Transistor networks (Sec 1.3.2 Katz 2e)

Relays aren't used much anymoresome traffic light controllers are still electro-mechanical

Modern digital systems are designed in CMOS technology

MOS stands for Metal-Oxide on SemiconductorC is for complementary because there are both normally-open and normally-closed switches

MOS transistors act as voltage-controlled switches

similar, though easier to work with than relays. Pentium: 3 million transistors!

Page 18: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 18

n-channelopen when voltage at G is low

closes when:voltage(G) > voltage (S) + ε

p-channelclosed when voltage at G is low

opens when:voltage(G) < voltage (S) – ε

G

S D

MOS transistors

MOS transistors have three terminals: drain, gate, and sourcethey act as switches in the following way:if the voltage on the gate terminal is (some amount) higher/lower than the source terminal then a conducting path will be established between the drain and source terminals

G

S D

Page 19: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 19

3v

X

Y 0 volts

x y

3 volts0v

what is the relationship

between x and y?

MOS networks

0 volts

3 volts

Page 20: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 20

Speed of MOS networks

What influences the speed of CMOS networks?charging and discharging of voltages on wires and gates of transistors

Capacitors hold chargecapacitance is at gates of transistors and wire material

Resistors slow movement of electronsresistance mostly due to transistors

Page 21: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 21

scope of TRC2300

Physical devices (transistors, relays)SwitchesTruth tablesBoolean algebraGatesWaveformsFinite state behaviorRegister-transfer behaviorConcurrent abstract specifications

Representation of digital designs

Page 22: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 22

inputs outputssystem

Combinational vs. sequential digital circuits

A simple model of a digital system is a unit with inputs and outputs:

Combinational means "memory-less"a digital circuit is combinational if its output valuesonly depend on its input values

Page 23: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 23

Common combinational logic systems have standard symbols called logic gates

Buffer, NOT

AND, NAND

OR, NOR

easy to implementwith CMOS transistors(the switches we haveavailable and use most)

Combinational logic symbols

Z

AB

Z

Z

A

AB

Page 24: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 24

Sequential logic

Sequential systemsexhibit behaviors (output values) that depend not only on the current input values, but also on previous input values

In reality, all real circuits are sequentialbecause the outputs do not change instantaneously after an input changewhy not, and why is it then sequential?

A fundamental abstraction of digital design is to reason (mostly) about steady-state behaviors

look at the outputs only after sufficient time has elapsed for the system to make its required changes and settle down

Page 25: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 25

Synchronous sequential digital systems

Outputs of a combinational circuit depend only on current inputsafter sufficient time has elapsed

Sequential circuits have memoryeven after waiting for the transient activity to finish

The steady-state abstraction is so useful that most designers use a form of it when constructing sequential circuits:

the memory of a system is represented as its statechanges in system state are only allowed to occur at specific times controlled by an external periodic clockthe clock period is the time that elapses between state changes it must be sufficiently long so that the system reaches a steady-state before the next state change at the end of the period

Page 26: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 26

B

AC

Clock

Example of combinational and sequential logic

Combinational:input A, Bwait for clock edgeobserve Cwait for another clock edgeobserve C again: will stay the same

Sequential:input A, Bwait for clock edgeobserve Cwait for another clock edgeobserve C again: may be different

Page 27: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 27

Abstractions

Some we've seen alreadydigital interpretation of analog valuestransistors as switchesswitches as logic gatesuse of a clock to realize a synchronous sequential circuit

Some others we will seetruth tables and Boolean algebra to represent combinational logicencoding of signals with more than two logical values into binary formstate diagrams to represent sequential logicwaveforms to represent temporal behavior

Page 28: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 28

An example (Ex 1.1 Katz 2e)

Calendar subsystem: number of days in a month (to control watch display)

used in controlling the display of a wrist-watch LCD screen

inputs: month, leap year flagoutputs: number of days

Page 29: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 29

Implementation in software

integer number_of_days ( month, leap_year_flag) {switch (month) {

case 1: return (31);case 2: if (leap_year_flag == 1) then return (29)

else return (28);case 3: return (31);...case 12: return (31);default: return (0);

}

}

Page 30: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 30

leapmonth

d28 d29 d30 d31

month leap d28 d29 d30 d310000 – – – – –0001 – 0 0 0 10010 0 1 0 0 00010 1 0 1 0 00011 – 0 0 0 10100 – 0 0 1 00101 – 0 0 0 10110 – 0 0 1 00111 – 0 0 0 11000 – 0 0 0 11001 – 0 0 1 01010 – 0 0 0 11011 – 0 0 1 01100 – 0 0 0 11101 – – – – –111– – – – – –

Implementation as acombinational digital system

Encoding:how many bits for each input/output?binary number for monthfour wires for 28, 29, 30, and 31

Behavior:combinationaltruth tablespecification

Page 31: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 31

symbol for and

symbol for or

symbol for not

Combinational example (cont’d)

Truth-table to logic to switches to gatesd28 = 1 when month=0010 and leap=0d28 = m8'•m4'•m2•m1'•leap'

d31 = 1 when month=0001 or month=0011 or ... month=1100d31 = (m8'•m4'•m2'•m1) + (m8'•m4'•m2•m1) + ... (m8•m4•m2'•m1')d31 = can we simplify more? month leap d28 d29 d30 d31

0001 – 0 0 0 10010 0 1 0 0 00010 1 0 1 0 00011 – 0 0 0 10100 – 0 0 1 0...1100 – 0 0 0 11101 – – – – –111– – – – – –0000 – – – – –

Page 32: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 32

Combinational example (cont’d)

d28 = m8'•m4'•m2•m1'•leap’d29 = m8'•m4'•m2•m1'•leapd30 = (m8'•m4•m2'•m1') + (m8'•m4•m2•m1') +

(m8•m4'•m2'•m1) + (m8•m4'•m2•m1) = (m8'•m4•m1') + (m8•m4'•m1)

d31 = (m8'•m4'•m2'•m1) + (m8'•m4'•m2•m1) + (m8'•m4•m2'•m1) + (m8'•m4•m2•m1) + (m8•m4'•m2'•m1') + (m8•m4'•m2•m1') + (m8•m4•m2'•m1')

Page 33: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 33

Combinational example (cont’d)

d28 = m8'•m4'•m2•m1'•leap’d29 = m8'•m4'•m2•m1'•leapd30 = (m8'•m4•m2'•m1') + (m8'•m4•m2•m1') +

(m8•m4'•m2'•m1) + (m8•m4'•m2•m1)d31 = (m8'•m4'•m2'•m1) + (m8'•m4'•m2•m1) +

(m8'•m4•m2'•m1) + (m8'•m4•m2•m1) + (m8•m4'•m2'•m4') + (m8•m4'•m2•m1') + (m8•m4•m2'•m1')

Page 34: Lecture 6

I - Introduction © Copyright 2004, Gaetano Borriello and Randy H. Katz 34

Summary

That was what the entire unit is aboutconverting solutions to problems into combinational and sequential networks effectively organizing the design hierarchicallytaking advantage of optimization opportunities

Now lets do it againthis time we'll take eleven weeks instead of one