Design of a Simple Computer 2 Schedule Today - - PowerPoint PPT Presentation

design of a simple computer
SMART_READER_LITE
LIVE PREVIEW

Design of a Simple Computer 2 Schedule Today - - PowerPoint PPT Presentation

Computer Systems and Networks ECPE 170 Jeff Shafer University of the Pacific Design of a Simple Computer 2 Schedule Today


slide-1
SLIDE 1

ì ¡

Computer ¡Systems ¡and ¡Networks ¡

ECPE ¡170 ¡– ¡Jeff ¡Shafer ¡– ¡University ¡of ¡the ¡Pacific ¡

Design ¡of ¡a ¡Simple ¡ Computer ¡

slide-2
SLIDE 2

Schedule ¡

ì Today ¡ ¡

ì Simple ¡computer ¡organizaBon ¡(conBnued) ¡ ì Exam ¡review ¡

ì Wednesday ¡8th ¡-­‑ ¡Exam ¡1 ¡

ì Exam ¡covers ¡all ¡of ¡Chapters ¡2 ¡and ¡3 ¡ ì Study: ¡Homework, ¡Quizzes, ¡review ¡slides ¡

ì Friday ¡10th ¡ ¡

ì Introduce ¡new ¡machine ¡architecture ¡– ¡MARIE ¡– ¡and ¡

assembly ¡programming ¡language ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

2 ¡

slide-3
SLIDE 3

Clocks ¡

ì Clock ¡speed ¡does ¡not ¡(directly) ¡equal ¡CPU ¡

performance! ¡

ì CPU ¡Bme ¡required ¡to ¡run ¡a ¡program: ¡ ì How ¡can ¡we ¡decrease ¡CPU ¡Bme? ¡Many ¡ways! ¡

ì

Reduce ¡the ¡number ¡of ¡instrucBons ¡in ¡a ¡program ¡

ì

Reduce ¡the ¡number ¡of ¡cycles ¡per ¡instrucBon ¡

ì

Reduce ¡the ¡number ¡of ¡nanoseconds ¡per ¡clock ¡cycle ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

CPU Time= seconds program = instructions program * avg.cycles instruction *seconds cycle

3 ¡

slide-4
SLIDE 4

The ¡Input/Output ¡Subsystem ¡

ì A ¡computer ¡communicates ¡with ¡the ¡outside ¡world ¡

through ¡its ¡input/output ¡(I/O) ¡subsystem ¡

ì Two ¡different ¡ways ¡I/O ¡devices ¡can ¡funcBon ¡

ì Memory-­‑mapped: ¡the ¡I/O ¡device ¡behaves ¡like ¡main ¡

memory ¡from ¡the ¡CPU’s ¡point ¡of ¡view. ¡

ì InstrucLon-­‑based: ¡the ¡CPU ¡has ¡a ¡specialized ¡I/O ¡

instrucBon ¡set ¡ ì Modern ¡devices ¡are ¡typically ¡memory-­‑mapped ¡

ì But ¡CPUs ¡sBll ¡have ¡legacy ¡I/O ¡instrucBons… ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

4 ¡

slide-5
SLIDE 5

Interrupts ¡

ì

High ¡priority ¡events ¡(requiring ¡immediate ¡handling) ¡can ¡alter ¡ normal ¡program ¡flow ¡

ì

I/O ¡requests ¡

ì

ArithmeBc ¡errors ¡(division ¡by ¡0) ¡

ì

Invalid ¡instrucBons ¡

ì

CPU ¡is ¡noBfied ¡of ¡the ¡high-­‑priority ¡event ¡via ¡an ¡interrupt ¡

ì

Nonmaskable ¡interrupts ¡are ¡high-­‑priority ¡interrupts ¡that ¡ cannot ¡be ¡ignored ¡

ì

Each ¡interrupt ¡is ¡associated ¡with ¡a ¡procedure ¡(subrouBne) ¡ that ¡tells ¡the ¡CPU ¡what ¡to ¡do ¡

ì

Copy ¡data ¡from ¡the ¡NIC? ¡

ì

Give ¡the ¡video ¡card ¡a ¡new ¡frame ¡to ¡display? ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

5 ¡

slide-6
SLIDE 6

ì ¡

Memory ¡Organization ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

6 ¡

slide-7
SLIDE 7

Memory ¡Organization ¡

ì Imagine ¡computer ¡memory ¡as ¡a ¡linear ¡array ¡of ¡

addressable ¡storage ¡cells ¡(i.e. ¡an ¡array ¡of ¡registers) ¡

ì Addressability ¡

ì

What ¡is ¡the ¡smallest ¡amount ¡of ¡memory ¡I ¡can ¡access? ¡

ì

Byte-­‑address ¡or ¡word-­‑addressable ¡ ¡

ì A ¡word ¡might ¡be ¡2, ¡4, ¡or ¡8 ¡bytes… ¡

ì Memory ¡is ¡constructed ¡from ¡RAM ¡chips ¡

ì

Each ¡chip ¡referred ¡to ¡in ¡terms ¡of ¡length ¡× ¡width ¡

ì

Example: ¡if ¡the ¡memory ¡word ¡size ¡of ¡the ¡machine ¡is ¡16 ¡ bits, ¡then ¡a ¡4M ¡× ¡16 ¡RAM ¡chip ¡gives ¡us ¡4x220 ¡memory ¡ locaBons, ¡each ¡of ¡which ¡is ¡16 ¡bits ¡wide ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

7 ¡

slide-8
SLIDE 8

Memory ¡Organization ¡

ì How ¡does ¡the ¡computer ¡access ¡a ¡memory ¡locaBon ¡

corresponds ¡to ¡a ¡parBcular ¡address? ¡

ì We ¡observe ¡that ¡4M ¡can ¡be ¡expressed ¡as ¡22 ¡× ¡220 ¡= ¡

222 ¡words ¡

ì The ¡memory ¡locaBons ¡for ¡this ¡memory ¡are ¡

numbered ¡0 ¡through ¡222-­‑1. ¡

ì Thus, ¡the ¡memory ¡bus ¡of ¡this ¡system ¡requires ¡at ¡

least ¡22 ¡address ¡lines ¡

ì Address ¡lines ¡“count” ¡from ¡0 ¡to ¡222 ¡-­‑ ¡1 ¡in ¡binary ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

8 ¡

slide-9
SLIDE 9

Memory ¡Organization ¡

ì How ¡does ¡the ¡number ¡of ¡addresses ¡relate ¡to ¡the ¡

memory ¡width? ¡

ì If ¡memory ¡is ¡word-­‑addressable, ¡then ¡the ¡number ¡of ¡

locaBons ¡directly ¡gives ¡the ¡number ¡of ¡address ¡lines ¡

ì If ¡memory ¡is ¡byte-­‑addressable, ¡we ¡need ¡extra ¡

address ¡lines ¡to ¡specify ¡which ¡byte ¡within ¡each ¡ word ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

9 ¡

slide-10
SLIDE 10

Memory ¡Organization ¡

ì Typically ¡mulBple ¡RAM ¡chips ¡are ¡used ¡

ì Access ¡is ¡more ¡efficient ¡when ¡memory ¡is ¡organized ¡

into ¡banks ¡of ¡chips ¡with ¡the ¡addresses ¡interleaved ¡ across ¡the ¡chips ¡ ì Low-­‑order ¡interleaving ¡

ì Low ¡order ¡bits ¡of ¡the ¡address ¡specify ¡which ¡memory ¡

bank ¡contains ¡the ¡address ¡of ¡interest ¡ ì High-­‑order ¡interleaving ¡

ì High ¡order ¡address ¡bits ¡specify ¡the ¡memory ¡bank ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

10 ¡

slide-11
SLIDE 11

Memory ¡Interleaving ¡

Low-­‑Order ¡Interleaving ¡ High-­‑Order ¡Interleaving ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

11 ¡

slide-12
SLIDE 12

Memory ¡Organization ¡

ì Example: ¡Computer ¡memory ¡composed ¡

  • f ¡16 ¡chips, ¡each ¡of ¡size ¡2K ¡x ¡8 ¡

ì Total ¡memory ¡locaBons? ¡

ì

32K ¡= ¡25 ¡× ¡210 ¡= ¡215 ¡

ì

15 ¡bits ¡are ¡needed ¡for ¡each ¡address ¡ ì Wiring ¡

ì

4 ¡bits ¡will ¡select ¡which ¡chip ¡(out ¡of ¡16) ¡

ì

11 ¡bits ¡will ¡select ¡a ¡parBcular ¡byte ¡inside ¡ the ¡selected ¡chip ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

12 ¡

slide-13
SLIDE 13

Memory ¡Organization ¡

ì In ¡high-­‑order ¡interleaving ¡

the ¡high-­‑order ¡4 ¡bits ¡select ¡ the ¡chip ¡

ì In ¡low-­‑order ¡interleaving ¡

the ¡low-­‑order ¡ ¡4 ¡bits ¡select ¡ the ¡chip ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

13 ¡

slide-14
SLIDE 14

Example ¡– ¡Memory ¡Organization ¡

ì

Example: ¡Suppose ¡we ¡build ¡a ¡8M ¡x ¡32 ¡word-­‑addressable ¡main ¡ memory ¡using ¡512K ¡x ¡8 ¡RAM ¡chips. ¡

ì

How ¡many ¡RAM ¡chips ¡are ¡necessary? ¡

ì

8M/512K ¡* ¡32/8 ¡= ¡16 ¡* ¡4 ¡= ¡64 ¡

ì

How ¡many ¡RAM ¡chips ¡are ¡there ¡per ¡word? ¡

ì

32/8 ¡= ¡4 ¡chips ¡per ¡word ¡

ì

How ¡many ¡address ¡bits ¡are ¡needed ¡per ¡RAM ¡chip? ¡

ì

512K ¡addresses ¡= ¡210+9 ¡= ¡19 ¡address ¡bits ¡

ì

How ¡many ¡banks ¡will ¡there ¡be? ¡

ì

8M/512K ¡= ¡16 ¡banks ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

14 ¡

slide-15
SLIDE 15

Example ¡– ¡Memory ¡Organization ¡

ì

Example: ¡Suppose ¡we ¡build ¡a ¡8M ¡x ¡32 ¡word-­‑addressable ¡main ¡ memory ¡using ¡512K ¡x ¡8 ¡RAM ¡chips. ¡

ì

How ¡many ¡address ¡bits ¡are ¡needed ¡for ¡all ¡memory? ¡

ì

Word ¡addressable: ¡8M ¡addresses ¡= ¡8*220 ¡= ¡220+3 ¡= ¡23 ¡address ¡bits ¡

ì

Byte-­‑addressable, ¡8M ¡addresses ¡* ¡4 ¡bytes ¡per ¡word ¡= ¡220+3+2 ¡= ¡25 ¡ address ¡bits ¡ ì

If ¡high-­‑order ¡interleaving ¡is ¡used, ¡where ¡would ¡address ¡ 24719316 ¡be ¡located? ¡

ì

Bank ¡4 ¡(24719316 ¡= ¡010 ¡0100 ¡0111 ¡0001 ¡1001 ¡00112) ¡ ì

If ¡low-­‑order ¡interleaving ¡is ¡used, ¡where ¡would ¡address ¡24719316 ¡ be ¡located? ¡

ì

Bank ¡3 ¡(24719316 ¡= ¡010 ¡0100 ¡0111 ¡0001 ¡1001 ¡00112) ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

15 ¡

slide-16
SLIDE 16

Exercise ¡– ¡Memory ¡Organization ¡

ì Exercise: ¡ ¡Build ¡a ¡1M ¡x ¡16 ¡word-­‑addressable ¡main ¡

memory ¡using ¡128K ¡x ¡4 ¡RAM ¡chips. ¡

1.

How ¡many ¡address ¡bits ¡are ¡needed ¡per ¡RAM ¡chip? ¡

2.

How ¡many ¡RAM ¡chips ¡are ¡there ¡per ¡word? ¡

3.

How ¡many ¡RAM ¡chips ¡are ¡necessary? ¡

4.

How ¡many ¡address ¡bits ¡are ¡needed ¡for ¡all ¡memory? ¡

5.

How ¡many ¡address ¡bits ¡would ¡be ¡needed ¡if ¡it ¡were ¡byte ¡ addressable? ¡

6.

How ¡many ¡banks ¡will ¡there ¡be? ¡

7.

What ¡bank ¡would ¡contain ¡address ¡4712916 ¡with ¡(a) ¡high-­‑

  • rder ¡interleaving ¡or ¡(b) ¡low-­‑order ¡interleaving? ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

16 ¡

slide-17
SLIDE 17

Solution ¡to ¡Exercise ¡

1.

Each ¡RAM ¡chip ¡has ¡128K ¡locaBons: ¡ ¡ ¡27 ¡* ¡210 ¡= ¡17 ¡bits ¡

2.

Each ¡RAM ¡chip ¡locaBon ¡stores ¡4 ¡bits, ¡but ¡we ¡need ¡16: ¡ ¡

1.

¡4 ¡chips ¡needed ¡per ¡word ¡ 3.

Each ¡RAM ¡chip ¡has ¡128K ¡locaBons, ¡but ¡we ¡need ¡1M ¡locaBons: ¡ ¡

1.

¡1M/128K ¡= ¡8 ¡(Bmes ¡4 ¡chips ¡per ¡word) ¡= ¡32 ¡RAM ¡chips ¡(8 ¡rows, ¡4 ¡columns) ¡ 4.

Memory ¡is ¡1M: ¡ ¡2^20 ¡= ¡20 ¡bits ¡for ¡all ¡of ¡memory ¡

5.

Byte ¡addressable ¡adds ¡1 ¡more ¡bit ¡here ¡(to ¡select ¡either ¡the ¡lower ¡8 ¡or ¡upper ¡8 ¡of ¡the ¡16 ¡bit ¡long ¡ word): ¡ ¡21 ¡bits ¡

6.

8 ¡banks ¡of ¡memory, ¡where ¡each ¡bank ¡has ¡4 ¡chips ¡

7.

Address ¡is ¡20 ¡bits ¡long, ¡bank ¡is ¡upper ¡3 ¡bits ¡(2^3=8): ¡ 47129(16) ¡= ¡0100 ¡0111 ¡0001 ¡0010 ¡1001 ¡(2) ¡ With ¡high-­‑order ¡interleaving, ¡bank ¡is ¡#2 ¡ With ¡low-­‑order ¡interleaving, ¡bank ¡is ¡#1 ¡

Spring ¡2012 ¡ Computer ¡Systems ¡and ¡Networks ¡

17 ¡