cmput 229 - computer organization and architecture i1 cmput229 - fall 2002 topic 2: digital logic...

28
CMPUT 229 - Computer Org anization and Architectu re I 1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure José Nelson Amaral

Upload: shon-lawson

Post on 18-Jan-2018

220 views

Category:

Documents


0 download

DESCRIPTION

CMPUT Computer Organization and Architecture I3 The Light Switch

TRANSCRIPT

Page 1: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

1

CMPUT229 - Fall 2002

Topic 2: Digital Logic StructureJosé Nelson Amaral

Page 2: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

2

Reading Material

Patt & Patel, Chapter 3

Page 3: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

3

The Light Switch

Page 4: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

4

A N-MOS transistor

A Metal-Oxide Semiconductor (MOS) transistor has three terminals. The Gate controls the flow of electrons between the two other terminals.

In a N-type MOS transistor, electrons will flow when a voltage of 2.9 Vis applied to the Gate (closed circuit).If 0.0 V is applied to the Gate no electrons will flow (open circuit).

2.9 Voltbattery(powersupply)

Gate GateGate

Page 5: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

5

The NOT GateProblem: Use two MOS transistors to implement the following logic circuit:

NOT

2.9 Volts

0 Volts

In Out

Your NOT circuit should implement the following logic function:

In Out 0 Volts 2.9 Volts

2.9 Volts 0 Volts

Page 6: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

6

P-MOS Transistor

The operation of a P-type MOS transistor, is the opposite of an N-MOS:

- electrons will flow when a voltage of 0.0 V is applied to the Gate (closed circuit).- If 2.9 V is applied to the Gate no electrons will flow (open circuit).

Gate

#1

#2

Page 7: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

7

2.9V0V

0 Volts

2.9 Volts

0V

2.9 Volts

0 Volts

2.9V

The NOT Gate

In

2.9 Volts

0 Volts

Out

In Out 0 Volts 2.9 Volts

2.9 Volts 0 Volts

In Out 0 1 1 0

Page 8: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

8

A= 0V

B=0V

The NOR GateA B C

0 Volts 0 Volts 2.9 Volts

A

C

BC= 2.9V

Page 9: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

9

The NOR GateA B C

0 Volts 0 Volts 2.9 Volts 0 Volts 2.9 Volts 0 Volts

A

C

B

A= 0V

C= 0V

B=2.9V

Page 10: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

10

The NOR Gate

A

C

B

A= 2.9V

C= 0V

B= 0V

A B C 0 Volts 0 Volts 2.9 Volts 0 Volts

2.9 Volts 2.9 Volts 0 Volts

0 Volts 0 Volts

Page 11: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

11

The NOR GateA B C

0 Volts 0 Volts 2.9 Volts 0 Volts

2.9 Volts 2.9 Volts

2.9 Volts 0 Volts

2.9 Volts

0 Volts 0 Volts 0 Volts

A

C

B

A= 2.9V

C= 0V

B= 2.9V

A B C 0 0 1 0 1 1

1 0 1

0 0 0

Page 12: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

12

What Logic Function this Circuit Implements?

A

BC

D

A B C D 0 0 1 0 0 1 1

1 0 1

0 0 0

1 1 1

1

This is an OR gate.

Page 13: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

13

The AND Gate

A

B CD

A B C D 0 0 1 0 0 1 1

1 0 1

1 1 0

0 0 1

1

Page 14: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

14

Logic Functions

INVERTER

X X’

X X’0 11 0

If X=0 then X’=1If X=1 then X’=0

OR

AB C=A+B

A B C0 0 00 1 11 0 11 1 1

If A=1 OR B=1 then C=1 otherwise C=0

AB C=A·B

A B C0 0 00 1 01 0 01 1 1

If A=1 AND B=1 then C=1 otherwise C=0

AND

Page 15: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

15

NOR and NAND

Because these combination of gates are used often, thereare special symbols to represent them:

XY

Z XY

Z

ZXY

XY Z

Page 16: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

16

First DeMorgan’s Law

The complement of the OR is equal the AND of the complements.

(X+Y)’ = X’Y’

XY

Z

X Y X+Y (X+Y)’ X’ Y’ X’Y’0 0 0 1 1 1 10 1 1 0 1 0 01 0 1 0 0 1 01 1 1 0 0 0 0

ZY

X

Page 17: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

17

Decoders General decoder structure

Typically n inputs, 2n outputs 2-to-4, 3-to-8, 4-to-16, etc.

Page 18: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

18

Decoders

3-to-8Line

Decoder

y0 = a’b’c’y1 = a’b’cy2 = a’bc’y3 = a’bcy4 = ab’c’y5 = ab’cy6 = abc’y7 = abc

abc

a b c y0 y1 y2 y3 y4 y5 y6 y7 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1

+

Page 19: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

19

Multiplexers

4-to-1MUX

I0

I1

I2

I3

A B

Z

A B Z 0 0 I0 0 1 I1 1 0 I2 1 1 I3

+

ABI3

AB’I2

A’BI1

A’B’I0

Z

Page 20: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

20

AddersBasic building block is “full adder”

1-bit-wide adder, produces sum and carry outputs X Y Cin S Cout

0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1

Cout is one if two or moreof the inputs are one.

S is one if an odd numberof inputs are one.

Page 21: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

21

Full-adder circuit

Page 22: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

22

Ripple adder

Speed limited by carry chain Faster adders eliminate or limit carry chain

2-level AND-OR logic ==> 2n product terms3 or 4 levels of logic, carry lookahead

Page 23: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

23

A bi-stable circuitHow to control it?

Control inputsS-R latch

Page 24: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

CMPUT 229 - Computer Organization and Architecture I

24

D latch

Page 25: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

DOUT3 DOUT2 DOUT1 DOUT0

3-to-8decoder

2

1

0

A2

A1

A0

0

1

2

3

4

5

6

7

DIN3 DIN0DIN2 DIN1

WE_LCS_L

OE_L

WR_L

IOE_L

0

1

1

Page 26: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

DOUT3 DOUT3 DOUT3 DOUT3

3-to-8decoder

2

1

0

A2

A1

A0

0

1

2

3

4

5

6

7

DIN3 DIN3DIN3 DIN3

WE_LCS_L

OE_L

WR_L

IOE_L

0

1

1

Page 27: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

DOUT3 DOUT3 DOUT3 DOUT3

3-to-8decoder

2

1

0

A2

A1

A0

0

1

2

3

4

5

6

7

DIN3 DIN3DIN3 DIN3

WE_LCS_L

OE_L

WR_L

IOE_L

0

1

1

Page 28: CMPUT 229 - Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic 2: Digital Logic Structure Jos Nelson Amaral

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

IN OUTSELWR

DOUT3 DOUT3 DOUT3 DOUT3

3-to-8decoder

2

1

0

A2

A1

A0

0

1

2

3

4

5

6

7

DIN3 DIN3DIN3 DIN3

WE_LCS_L

OE_L

WR_L

IOE_L

0

1

1