wednesday, march 2 program #4 program #4 due friday due friday homework #2 homework #2 posted, due...

40
Wednesday, March 2 Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program #5 Program #5 is posted is posted Due Friday, March 11 Due Friday, March 11 Sample recursive program on Sample recursive program on the course the course Resources Resources page page

Upload: judith-amanda-parker

Post on 18-Jan-2016

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Wednesday, March 2Wednesday, March 2 Program #4Program #4

Due FridayDue Friday Homework #2Homework #2

Posted, Due FridayPosted, Due Friday Questions?Questions?

Program #5Program #5 is posted is posted Due Friday, March 11Due Friday, March 11 Sample recursive program on the Sample recursive program on the

course course ResourcesResources page page

Page 2: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Today’s TopicsToday’s Topics

Digital Logic DesignDigital Logic Design Boolean LogicBoolean Logic Digital Logic CircuitsDigital Logic Circuits

Page 3: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

What is Digital Logic?What is Digital Logic?

Discrete circuitry, where the only Discrete circuitry, where the only valid values are a 1 or 0.valid values are a 1 or 0.

Represented by building blocks of Represented by building blocks of defined functionality.defined functionality.

An application of boolean logic.An application of boolean logic.

Page 4: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

VariablesVariables (e.g.: A, B, …)(e.g.: A, B, …) can have value of 0 or 1 (false or true)can have value of 0 or 1 (false or true)

FunctionalFunctional LogicalLogical BooleanBoolean

NOTNOT(A)(A) ~~AA AA

ANDAND(A, B)(A, B) A A ANDAND B B ABAB

OROR(A, B)(A, B) A A OROR B B AA++BB

XORXOR(A, B)(A, B) A A XORXOR B B A A B B

NANDNAND(A, B)(A, B) A A NANDNAND B B ABAB

NORNOR(A, B)(A, B) A A NORNOR B B A A ++ B B

XNORXNOR(A, B)(A, B) A A XNORXNOR B B A BA B

Boolean notationBoolean notation

+

+

Page 5: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Truth tables: 0 = false, 1 = Truth tables: 0 = false, 1 = truetrue

XX YY RR

00 00 00

00 11 00

11 00 11

11 11 00

XX YY ZZ RR

00 00 00 00

00 00 11 00

00 11 00 00

00 11 11 11

11 00 00 11

11 00 11 11

11 11 00 11

11 11 11 11

2 input, 1 output

R = XY

3 input, 1 output

R = X+(YZ)

Page 6: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Using truth tablesUsing truth tables

Define a Boolean functionDefine a Boolean function Specify an output for each possible Specify an output for each possible

combination of inputscombination of inputs Prove that two functions are Prove that two functions are

equivalentequivalent Make a truth table for each functionMake a truth table for each function Identical outputs implies equivalent Identical outputs implies equivalent

functionsfunctions

Page 7: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Internal (electric) Internal (electric) representationrepresentationof binary codesof binary codes

Power sourcePower source GatesGates

Made of one or more transistorsMade of one or more transistors Only 2 voltages are permittedOnly 2 voltages are permitted

Low (e.g., 0.5v) represents binary 0Low (e.g., 0.5v) represents binary 0 High (e.g., 1.0v) represents binary 1High (e.g., 1.0v) represents binary 1

Can "convert" low Can "convert" low high using gates high using gates For any given set of inputs For any given set of inputs (0s and (0s and

1s)1s), gates can be combined to , gates can be combined to produce either output produce either output (0 or 1)(0 or 1)..

These combinations of gates are calledThese combinations of gates are called digitaldigital circuitscircuits

Page 8: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Gates are used to implement Gates are used to implement Boolean algebraBoolean algebra

"inverter"

Page 9: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

AnyAny desired output can be desired output can be produced by combining these produced by combining these three "functions" to create a three "functions" to create a

circuit.circuit.

Page 10: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

These additional gates can These additional gates can simplify and/or reduce simplify and/or reduce costcost of a of a

circuitcircuit

Page 11: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Boolean functionsBoolean functions

A function of A function of nn binary binary variables has 2variables has 2nn possible combinations possible combinations of values for the of values for the variables.variables. e.g., f(A,B,C) has 2e.g., f(A,B,C) has 233 = 8 = 8

combinations of values combinations of values for A, B, and C.for A, B, and C.

So … a So … a functionfunction can be can be completely described by completely described by its its truth tabletruth table..

AA BB CC

00 00 00

00 00 11

00 11 00

00 11 11

11 00 00

11 00 11

11 11 00

11 11 11

Page 12: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Example:Example: Let Let f f (A,B,C) be (A,B,C) be

defined by the truth defined by the truth table at the right.table at the right.

To write this in To write this in Boolean notationBoolean notationn select all rows with R = select all rows with R =

11n ANDAND the values in each the values in each

row, using X for 1, X for row, using X for 1, X for 00

n OROR the resulting terms the resulting termsn Set R = resulting Set R = resulting

expressionexpression

AA BB CC RR

00 00 00 00

00 00 11 11

00 11 00 11

00 11 11 00

11 00 00 11

11 00 11 00

11 11 00 00

11 11 11 11

ABCCBACBACBAR

Page 13: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Connection! We have Connection! We have gatesgates that that can implement this function as a can implement this function as a circuitcircuit..

In its most primitive form:In its most primitive form:

ABCCBACBACBAR

Page 14: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

VerificationVerification

Test all possible Test all possible combinations of combinations of input to verify that input to verify that the circuit the circuit implements the implements the functionfunction

AA BB CC RR

00 00 00 00

00 00 11 11

00 11 00 11

00 11 11 00

11 00 00 11

11 00 11 00

11 11 00 00

11 11 11 11

ABCCBACBACBAR

Page 15: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Simplifications:Simplifications:

Multiple-input gatesMultiple-input gates Equivalent gatesEquivalent gates Use Boolean algebra to simplify the Use Boolean algebra to simplify the

function before implementing the function before implementing the circuit.circuit.

Page 16: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Boolean identitiesBoolean identities

Definition: A B = AB + AB+

Page 17: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

SimplifySimplify

ABCCBACBACBAR )BCCB(A)CBCB(AR

)CB(A)CB(AR

CBAR

Distributive

Definition, distributiveDefinition

Page 18: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Representation of Representation of arithmetic / algebra arithmetic / algebra

circuitscircuits

TruthTruth

tabletable

Boolean Boolean CircuitCircuit

function function diagramdiagram

Page 19: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

ConversionsConversions Circuit diagram to Boolean functionCircuit diagram to Boolean function Circuit diagram to truth tableCircuit diagram to truth table Truth table to diagramTruth table to diagram

Simplification by eliminating the "don't Simplification by eliminating the "don't cares"cares"

Truth table to Boolean functionTruth table to Boolean function Simplification by eliminating the "don't Simplification by eliminating the "don't

cares"cares" Boolean function to truth tableBoolean function to truth table

Simplification by Boolean identitiesSimplification by Boolean identities Boolean function to circuit diagramBoolean function to circuit diagram

Simplification by Boolean identitiesSimplification by Boolean identities

Page 20: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

CMOS Inverter at the CMOS Inverter at the transistor leveltransistor level

Page 21: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Integrated circuitsIntegrated circuits

ScaleScale SSI: 1956-1960’s (10’s of transistors)SSI: 1956-1960’s (10’s of transistors) MSI: 1960’s -1970’s (100’s of transistors)MSI: 1960’s -1970’s (100’s of transistors) LSI: 1970’s – 1980’s (10,000’s of LSI: 1970’s – 1980’s (10,000’s of

transistors)transistors) VLSI: 1980’s – present (100k – billions)VLSI: 1980’s – present (100k – billions)

Gate to I/O ratioGate to I/O ratio I/O take much more space than gatesI/O take much more space than gates

Page 22: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

VLSI: Pentium 3 VLSI: Pentium 3

Page 23: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

MultiplexersMultiplexers

Page 24: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Decoder (demultiplxer)Decoder (demultiplxer) – – select one output lineselect one output line

Page 25: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

MultiplexersMultiplexers ““All-purpose” implementation of a All-purpose” implementation of a

truth table.truth table. 22nn combinations of data inputs, combinations of data inputs, nn

control inputs, one outputcontrol inputs, one output

1

0In B

In A

Select

Output

Page 26: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Show the truth table for this Show the truth table for this multiplexermultiplexer

(“Homework” #3, problem #1)(“Homework” #3, problem #1)4 data bits, 2 control bits4 data bits, 2 control bits

D3

D0

Output

D1

D2

S0 S1

S0 S1 Output

0 0 D0

0 1 D1

1 0 D2

1 1 D3

Page 27: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

What does this circuit do?What does this circuit do?(“Homework” #3, problem (“Homework” #3, problem

#2)#2)

A B S C

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

Page 28: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

What does this circuit do?What does this circuit do?(“Homework” #3, problem (“Homework” #3, problem

#3)#3)

Page 29: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

ComparatorsComparators

Page 30: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Shifters (right/left) controlled Shifters (right/left) controlled by by CC

Page 31: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

AddersAdders

Bitwise addition implements “sum Bitwise addition implements “sum bit” and “carry bit”bit” and “carry bit”

Carry digits “ripple” to next adderCarry digits “ripple” to next adder Half adder: 2 inputs (corresponding Half adder: 2 inputs (corresponding

bits of two numbers), 2 outputs (sum bits of two numbers), 2 outputs (sum bit and carry-out bit)bit and carry-out bit)

Full adder: 3 inputs (same as above, Full adder: 3 inputs (same as above, plus carry-in bit), 2 outputs (same as plus carry-in bit), 2 outputs (same as above)above)

Page 32: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Half adderHalf adder

Page 33: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Full adderFull adder

Page 34: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Ripple carry adderRipple carry adder

Page 35: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Questions on gates, circuits, etc.?Questions on gates, circuits, etc.?

Page 36: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Quiz #4 Tuesday in class Calculator and one notecard permitted

No sharing Short answer, multiple-choice 40 minutes, 25 points Can be dropped as lowest quiz

Coverage: A few repeat questions from Quiz #3 Lectures #15,16,17,18 Program #4 Homeworks #2, 3

Page 37: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Quiz #4 Topics Two of the problems will be very similar to

problems #2 and #4 on Quiz #3 Solutions are posted

System stack How procedure call/return works

call, ret, ret n Stack frame Parameters

Value/Reference Accessing

Arrays Declaration Accessing elements (address calculation) Passing as parameters (reference) Array processing loops Array addressing modes

Page 38: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Quiz #4 Topics

Data-related operators OFFSET, PTR, TYPE, LENGTHOF, SIZEOF

Address calculation (2-D arrays) String operations

lodsb, stosb, std, cld Macros

Parameters Local labels Compared to procedures

NOTE: local variables will NOT be covered

Page 39: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Quiz #4 Topics

Reverse Polish Notation (RPN) Convert in-fix post-fix

Post-fix expression evaluation Boolean logic

Truth tables Gates and circuits

Tracing only

Page 40: Wednesday, March 2 Program #4 Program #4 Due Friday Due Friday Homework #2 Homework #2 Posted, Due Friday Posted, Due Friday Questions? Questions? Program

Questions?Questions?

Quiz #4 TuesdayQuiz #4 Tuesday

Finish Program #5Finish Program #5

Get started on Program #5Get started on Program #5