floating point representation and digital logic · digital logic lecture 11 cs301. administrative...

39
Floating Point Representation and Digital Logic Lecture 11 CS301

Upload: others

Post on 12-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Floating Point Representation and

Digital Logic

Lecture 11CS301

Page 2: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Administrative

•  Daily Review of today’s lecturew Due tomorrow (10/4) at 8am

•  Lab #3 due Friday (9/7) 1:29pm•  HW #5 assigned

w Due Monday 10/8 at 5pm•  Program #1 assigned

w Due Thursday, 10/18 at 11:59pm•  Read Appendix C.1-C.3, C.5

Page 3: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Digital Logic

(How do we construct a processor?)

Page 4: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Multi-Million Transistor Chips

Intel Core i7 Extreme Edition - 731 million transistors, 263 mm^2 area

Page 5: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

MOS Semiconductor Transistors

P-type silicon: Excess positive charges (electron holes)

N-type silicon: Excess negative charges (electrons)

Oxide: Insulator

Gate: Metal pad In this state, current (electrons) cannot flow between source and drain – switch is OPEN

Silicon Bulk (p-type)

+

+ +

+

+

+

+ +

+

+ +

+

+ + +

+ +

+ +

+ +

+

+

e-

e-

e-

e-

e-

e- e- e-

e-

+ + +

+

+ + + + +

+

+

+ +

+ +

+

+ +

+ + +

+ +

+

+

+ + +

+

+ +

+ + +

+ +

+ + +

+ + +

+

+ +

+

+ +

e- e- e-

e-

e- Source

e- e-

e- e- Drain

Gate n-type Si

n-type Si

Source Wire Gate Wire

Oxide

Drain Wire

Page 6: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

MOS Semiconductor Transistors

Silicon Bulk (p-type)

+

+ +

+

+

+

+ +

+

+ +

+

+ + +

+ +

+ +

+ +

+

+

+ + +

+

+ + + + +

+

+

+ +

+ +

+

+ +

+ + +

+ +

+

+

+ + +

+

+ +

+ + +

+ +

+ + +

+ + +

+

+ +

+

+ +

e- e- e-

e-

e- Source

e- e-

e- e- Drain

Gate n-type Si

n-type Si

Source Wire Gate Wire

Oxide

+5V

+ +

+ +

+ +

+ +

+ e- e-

e-

Place a positive charge on the gate wire (gate = +5V)

The gate’s positive charge attracts negatively-charged electrons

This row of electrons forms a channel connecting the Source and Drain – Current can flow – Switch is CLOSED

Drain Wire

e- e- e- e- e- e- e- e-

Page 7: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Transistors

•  Transistorsw Emits 0 or 1 when on

or offw Can connect

transistors in series or parallel to create larger building blocks called gates

Pull-up pMOS transistor

Pull-down nMOS transistor

GND

+5V

A

Z

CMOS Inverter createdfrom two transistors

Page 8: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Digital Logic

•  Voltages represent valuesw Logically false - 0w Logically true - 1

•  Values are complements or inverses

Page 9: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Gates: Basic Building Blocks:

•  Depending on organization of transistors, different inputs give specific outputs

•  Basic gates equivalent to boolean operatorsw  INVERTER or NOT, !w AND, &&w OR, ||

•  Combinational logicw Outputs based on inputsw No memory

A A

A A • B B

A A + B B

Page 10: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Truth Tables

•  Functionality fully specified by truth table

•  n inputsw n input columnsw 2n input rows

•  m outputsw m output columns

A Z 0 1 1 0

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

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

NOT

AND

OR

Page 11: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic

•  Gates can be combined inw Seriesw Parallel

•  Any combination of both possible A B Y Z

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

A A

A

B

Y

Z

Page 12: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Other Important Gates

•  NAND

•  NOR

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

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

A A B B

A A + B B

Page 13: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Universal Gates

•  Any other gate can be constructed from some arrangement of universal gatesw Examples: NAND / NOR

•  Important because frequently less expensive to design chips with “homogeneous” gates

Page 14: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Universal Gates (NAND)

•  NOTA A AA 0 1 1 1 0 0

A A A

Page 15: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Universal Gates (NAND)

•  NOT

•  AND

A A AA 0 1 1 1 0 0

A A A

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

Page 16: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Universal Gates (NAND)

•  NOT

•  AND

A A AA 0 1 1 1 0 0

A B AB AB

0 0 0 1

0 1 0 1

1 0 0 1

1 1 1 0

A A A

A A B B

Page 17: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Universal Gates (NAND)

•  ORA B A+B

0 0 0

0 1 1

1 0 1

1 1 1

Page 18: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Universal Gates (NAND)

•  ORA B A+B AB

0 0 0 0

0 1 1 1

1 0 1 1

1 1 1 1

A

B AB

Page 19: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

For Fun: XOR

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

Page 20: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

For Fun: XOR

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

Page 21: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Few Final Notes

•  Gates can have more than 2 inputsw Generally keep number small due to

electrical engineering issues•  Circuits that create current computers

are constructed from these basic gates

Page 22: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Equivalent

•  Truth tables•  Circuit•  Boolean algebra expression

Truth tables are great for evaluating when circuit or Boolean expression evaluate to true

Page 23: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinatorial Logic: Multiplexor

23

Really a selector: One of the inputs is selected by the controlC = (A * ~S) + (B * S)

Page 24: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic: Multiplexor

n:1MUX

2n inputs

n control

1 output

n control lines select which of 2n inputs goes to output n possible input lines requires ceiling(log2n) control lines. Equivalently, n control lines with 2n input lines.

Page 25: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due
Page 26: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

1-bit MUX

AS + BS

Page 27: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic: De-Multiplexor

n:1DEMUX 2n outputs

n control

1 input

n control lines select which of 2n outputs input goes to

Page 28: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

1 to 2 De-multiplexor

Page 29: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic: Decoder

n control lines select which of 2n outputs set to 1

2n outputs n control

Page 30: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

1 to 8 De-multiplexor

Page 31: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic: Encoder

One of 2n inputs set to 1. Output encodes which input set to 1.

2n inputs n bit output

Page 32: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

4 to 2 Encoder

Page 33: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

8 to 3 Encoder

33

Page 34: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic

•  Comparatorw Given 2 inputs, sets output to 1 if inputs

match

Page 35: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due
Page 36: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic

•  Half-Adderw No carry in

Page 37: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Combinational Logic

•  Half-Adderw No carry in A B Sum Carry

Out 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1

A⊕B AB

Page 38: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

1-bit Full Adder

•  Three inputs:w Aw Bw Cin

•  Two outputs:w Sum = (A⊕B) ⊕ Cinw Cout = AB + (A⊕B) Cin

Page 39: Floating Point Representation and Digital Logic · Digital Logic Lecture 11 CS301. Administrative • Daily Review of today’s lecture! Due tomorrow (10/4) at 8am • Lab #3 due

Ripple Carry Adder

•  Construct n-bit adder with n 1-bit adders

•  Delay is problem•  Faster alternative:

w Carry-lookahead adder