csc258: computer organization combinational logic · combinational logic 1. clear your desk! ......

Post on 04-Jun-2018

235 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

CSC258: Computer Organization

Combinational Logic

1

Clear your desk!

• Please protect your work.

• Keep your own eyes on your paper or stare up to the sky.

• When you’re done, fold your paper with the answer inside.

• Please write legibly.

• I have awful handwriting, too, but that doesn’t help me read bad handwriting.

2

Week 3 Quiz

The schematic on the left is from Ex.1.88in your textbook.

1. Provide the sum-of-products boolean equation for the function implemented in the schematic.

2. Provide a truth table for the boolean equation: Y = AB + B ̅

3. In one sentence, describe what operation a 2-1 multiplexer performs.

3

4

Week 2 Quiz Notes

1. Add the 6-bit 2’s complement numbers 001011 and 111000. Please show your work but circle your result.

Several students responded “1000011”. You should discard the “1” at the beginning, because the response needs to be in 6-bit 2’s complement.

5

Anonymous: Structure and Questions

• “... you cover the topics that are important rather than us asking about what we don't understand. That way we know what we need to focus on instead of spending a lot of time in class on minor topics that we may have trouble with, but aren't that important.”

• I feel like you’re saying, “Please guide us. We don’t know what’s important.”

• And I agree, knowing what’s important is hard.

• But it’s also a goal of the course:If you can identify what’s important, you can learn on your own.

6

Anonymous: Structure and Questions

• I know that you’ll need some structure. I’m asking for something very difficult.

• The reading guides, including the exercises, tell you what to focus on. Prep those for lecture.

• Don’t worry about “unimportant” material or asking the “wrong” question. I’m filtering and rephrasing questions people ask.

• ... not that any of the material is “unimportant”. :-)

7

Anonymous: Asking Questions

• “People will only ask questions if they actually spent some time on the subject. I ... won't ask any questions other than please be the textbook unless I read it.”

• Exactly! And that’s the key in this course:

I’m asking you to spend some time on reading and exercises before class, so that you’re ready to ask the difficult questions.

• Why focus on questions? It’s an important, hard skill. It reflects that you know what is important and what you don’t understand.

8

Goals of this Course

• Those were great comments. They tie into what this course is about.

• Yes, we’re learning CS material: logic, computer architecture, assembly programming.

• But we’re also learning how to be independent professionals.That means learning ...

• how to read technical material

• how to identify when you’re stumped

• how to ask the questions you need answered.9

No Response to Email?

• Please make sure you’re using my correct email address: andrew.petersen @ utoronto.ca

• Andrew PetersOn is a student who is probably frustrated to be getting so much email for me.

10

11

Why Karnaugh Maps?

• Applying simplification rules to a formula is an awful way to find a minimum circuit

• Simplification takes trial and error.

• There’s no guarantee that you’ve found the minimal circuit.

• Checking your simplification requires enumeration on a truth table.

• The (partial) solution: Karnaugh maps12

Gray Codes

• “Gray codes” were developed for error-prone systems

• Named after Frank Gray, one of the developers of the television

• The idea: encoding in which only one bit changes at a time

2-bit 3-bit

00 000

01 001

11 011

10 010

110

111

101

10013

Karnaugh Maps

• Karnaugh maps represent logic formula

• To optimize a formula, draw the biggest rectangles you can!

• Results in the optimal formula

¬X X

¬Y

Y

1 1

1

¬Y + X

14

What is “Optimal”?

• K-maps don’t necessarily create the smallest circuits.

• Instead, they create small circuits that optimize latency:

“How long must we wait for a circuit to complete its computation?”

• Each transistor adds latency, since it takes a small amount of time to switch.

• Hence, each gate in series adds delay, so deeper circuits are slower.

• 2-level circuits, like those corresponding to sum-of-products or product-of-sums forms, are fast circuits.

15

A 4-variable K-map

16

K-map Example: Reading XY + XB

17

Overlapping

18

Pick the largest rectangles -- even if they

overlap

K-Maps Wrap Around

19

20

An Old Lab Problem ...

Specify the Function on a Truthtable

21

Mapping Minterms to K-Map

22

Extracting (Latency-Minimized) Formula

23

Alternately: Map the 0’s and Negate

24

How does this circuit compare?

Limits to Karnaugh Maps

• Any design with more than 4 variables is difficult to visualize

• Karnaugh maps provide an optimized 2-level circuit, but ...

• If we care about other factors like space efficiency or heat, we need to perform other optimizations.

25

The Grim Bottom Line

• Very few constraints can be optimized automatically

• Many hardware design problems can only be fully solved by enumeration -- by trying every possibility

• Wire and gate layout

• Modularization

26

Summary of Logic Gates

• Circuits are modeled with Boolean logic

• Functions are represented as formulas or truth tables

• Each logical operator has a corresponding gate

• We have two tools for optimizing circuits:

• Algebraic simplification

• Karnaugh Maps

• Logic design at modern scales is a difficult and expensive proposition

27

Boolean Logic Questions

• How are boolean logic and modern circuits related?

• Can you convert a boolean formula into a circuit and vice-versa?

• Can you convert a boolean fomula into a truth table and vice-versa?

• Can you produce a minimum cost circuit (in terms of latency) using simplification or K-maps?

• Now that we have the ability to create circuits, what basic units do we need to build a computer?

28

29

Where are we?

• Our goal, eventually, is to build a simple processor.

• For that, we need:

• The ability execute simple operations (like “add”)

• The ability to choose between values.

• Storage for a small number of values (variables)

• A circuit to process instructions from the user.

30

31

How do we get there?

• We can already do NAND -- and that’s everything right?

• Can you prove that?

• We’ll look at shifters and adders in a couple of weeks, and we’ll use those to create an ALU.

32

Where are we?

• Our goal, eventually, is to build a simple processor.

• For that, we need:

• The ability execute simple operations (like “add”)

• The ability to choose between values.

• Storage for a small number of values (variables)

• A circuit to process instructions from the user.

33

34

Multiplexer (Mux)

• Sometimes, we need “select” or “choose”

• A mux takes multiple inputs and a selector input

MUX

Out

D0

D1

D2

D3

D4

D5

D6

D7

A0A1A2

A1 A0 Out0 0 D0

0 1 D1

1 0 D2

1 1 D3

35

... and the Reverse

• Since we “mux”, we should be able to “demux”

• Take one input and a selector, and produce the input on one of the outputs

• The text also covered encoders and decoders.

• An encoder takes 2N inputs and produces a N-bit (compacted) output

• A decoder takes an N-bit input and produces 2N (extracted) outputs

36

Where are we?

• Our goal, eventually, is to build a simple processor.

• For that, we need:

• The ability execute simple operations (like “add”)

• The ability to choose between values.

• Storage for a small number of values (variables)

• A circuit to process instructions from the user.

37

How do we get there?

• We need some device that can store data.

• We also need some concept of “time”, so we know when to store new data.

• We’ll start putting together these pieces next week.

38

39

Storing Data

• Our circuits so far provide an output given some inputs

• The other half of the equation is storage

• Use feedback to “freeze” a value

• These are SR latches

• They rely on feedback.

S

R

Q

Q’

40

SR Latches

• R is labeled “reset”

• S is labeled “set”

• When R is high, Q becomes 0

• When S is high, Q becomes 1

• Otherwise, Q keeps its previous value.

R S Q ¬Q0 0 Q ¬Q0 1 1 01 0 0 11 1 ? ?

41

top related