27
1 Digital Design and Digital Design and Computer Architecture Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

  • View
    314

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

1

Digital Design and Computer Digital Design and Computer ArchitectureArchitecture

Lecture 1Digital Design and Computer Architecture

Harris & HarrisMorgan Kaufmann / Elsevier, 2007

Page 2: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

2

LogisticsLogistics

• Handouts:– Syllabus, Lecture Notes

• Lab 1 posted on the website:– www.jlc.tcu.edu.tw

• Reading for next Monday (9/29:點名 )– 1.6-1.7, 1.9, 2.1-2.3

Page 3: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

3

OverviewOverview

• More Logistics:– Course Objectives– Course Requirements– Schedule

• Digital Design– Managing Complexity– Number Systems– Logic Gates

Page 4: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

4

Course ObjectivesCourse Objectives

• To become a competent digital designer• To learn to recognize and apply the principles of

abstraction, modularity, hierarchy, and regularity in digital design

• To hone your debugging skills by designing, building, and testing digital circuits

• To design, build, and test your own clock• To understand what’s under the hood of a

computer• To have fun while you’re doing it!

Page 5: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

5

Course RequirementsCourse Requirements• Class Participation

– If you need to miss class, email me beforehand

• Assignments:– Weekly problem sets (10%), due Monday Morning– Semester labs (電子鐘 15% + 組合語言程式 15%)– Reading

• Exams– Midterm (25%)– Final (35%)

• Team policy for bi-weekly discussion– (75%個人成績 +25%團體成績 ) for Midterm and Final– Number of team member 5~6, – Bonus for participation: +3; – leader +5

Page 6: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

6

SyllabusSyllabus• Read the syllabus!

Page 7: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

7

Digital DesignDigital Design

General engineering principles for complex systems:– Abstraction– Discipline– The three -Y’s

• Hierarchy• Modularity• Regularity

Page 8: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

8

AbstractionAbstraction

• Hiding details when they aren’t important

Physics

Devices

AnalogCircuits

DigitalCircuits

Logic

Micro-architecture

Architecture

OperatingSystems

ApplicationSoftware

electrons

transistorsdiodes

amplifiersfilters

AND gatesNOT gates

addersmemories

datapathscontrollers

instructionsregisters

device drivers

programs

Page 9: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

9

DisciplineDiscipline

• Intentionally restricting your design choices (so that you can work more productively at a higher level of abstraction)

Page 10: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

10

The Three -Y’sThe Three -Y’s

• Hierarchy– Dividing a system into modules and

submodules

• Modularity– Well-defined functions and interfaces

• Regularity– Uniformity, so modules can be easily reused

Page 11: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

11

Digital AbstractionDigital Abstraction

• 1’s and 0’s

• bits: binary digit

Page 12: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

12

• Decimal numbers

• Binary numbers

Number SystemsNumber Systems

537410 = 5 × 103 + 3 × 102 + 7 × 101 + 4 × 100

fivethousands

10's colum

n10

0's column

1000

's colu

mn

threehundreds

seventens

fourones

1's colu

mn

11012 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 1310oneeight

2's colu

mn

4's colu

mn

8's colu

mn

onefour

notwo

oneone

1's colu

mn

Page 13: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

13

• Decimal to binary conversion:– Convert 101012 to decimal

• Decimal to binary conversion:– Convert 4710 to binary

Number ConversionNumber Conversion

Page 14: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

14

Hexadecimal NumbersHexadecimal Numbers

Hex Digit Decimal Equivalent Binary Equivalent0 0 0000

1 1 0001

2 2 0010

3 3 0011

4 4 0100

5 5 0101

6 6 0110

7 7 0111

8 8 1000

9 9 1001

A 10 1010

B 11 1011

C 12 1100

D 13 1101

E 14 1110

F 15 1111

Page 15: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

15

• Hexadecimal to binary conversion:– Convert 4AF16 (0x4AF) to binary

• Hexadecimal to decimal conversion:– Convert 0x4AF to decimal

Number ConversionNumber Conversion

Page 16: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

16

Bits, Bytes, Nibbles…Bits, Bytes, Nibbles…

• Bits

• Bytes & Nibbles

• Bytes• (how they are put in memory?)

10010110nibble

byte

CEBF9AD7least

significantbyte

mostsignificant

byte

10010110least

significantbit

mostsignificant

bit

Page 17: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

17

• Decimal

• Binary

AdditionAddition

37345168+8902

carries 11

10110011+1110

11 carries

Page 18: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

18

• Add the following 4-bit binary numbers

• Add the following 4-bit binary numbers

Binary Addition ExamplesBinary Addition Examples

10010101+

10110110+

Page 19: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

19

Signed Binary NumbersSigned Binary Numbers

• Sign and Magnitude:– 1 sign bit, N-1 magnitude bits

– Example: -5 = 11012

+5 = 01012

• Two’s Complement( why? )– Same as unsigned binary, but most

significant bit (msb) has value of -2N-1

– Most positive 4-bit number: 01112

– Most negative 4-bit number: 10002

Page 20: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

20

““Taking the Two’s Complement”Taking the Two’s Complement”

• Reversing the sign of a two’s complement number

• Method:1. Invert the bits

2. Add 1

• Example: Reverse the sign of 01111. 1000

2. + 1

1001

Page 21: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

21

Two’s Complement ExamplesTwo’s Complement Examples

• Take the two’s complement of 0101.

• Take the two’s complement of 1010.

Page 22: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

22

Two’s Complement AdditionTwo’s Complement Addition

• Add 6 + (-6) using two’s complement numbers.

• Add -2 + 3 using two’s complement numbers.

+01101010

10000

111

Page 23: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

23

Logic GatesLogic Gates

NOT

Y = A

A Y0 11 0

A Y

BUF

Y = A

A Y0 01 1

A Y

Page 24: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

24

Two-Input Logic GatesTwo-Input Logic Gates

AND

Y = AB

A B Y0 0 00 1 01 0 01 1 1

AB

Y

OR

Y = A + B

A B Y0 0 00 1 11 0 11 1 1

AB

Y

Page 25: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

25

More Two-Input Logic GatesMore Two-Input Logic Gates

XNOR

Y = A + B

A B Y0 00 11 01 1

AB

Y

XOR NAND NOR

Y = A + B Y = AB Y = A + B

A B Y0 0 00 1 11 0 11 1 0

A B Y0 0 10 1 11 0 11 1 0

A B Y0 0 10 1 01 0 01 1 0

AB

Y AB

Y AB

Y

Page 26: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

26

Multiple-Input Logic GatesMultiple-Input Logic Gates

NOR3

Y = A+B+C

B C Y0 00 11 01 1

AB YC

A0000

0 00 11 01 1

1111

AND4

Y = ABCD

AB YCD

How about 4-input XOR?

Page 27: 1 Digital Design and Computer Architecture Lecture 1 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

27

Next TimeNext Time

• Beneath the digital abstraction

• Transistors

• Boolean algebra