chapter 5 - tarleton state university · chapter 5 computing components components circuits gates...

45
Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction!

Upload: others

Post on 07-Jul-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 5

Computing Components

Components

Circuits

Gates

Transistors

Yet another layer of

abstraction!

Multipliers

2

When referring to computer memory, mega does not mean one million! (but it’s still close to that)

3

Decimal vs. binary multipliers

1000 = 103 1,000,000 = 106 1,000,000,000 = 109

1024 = 210 1024*1024 = 220 1024*1024*1024 = 230

Rule:

For memory capacities, the multipliers are binary, for

everything else (speed, frequency, pixels, etc.) they

are decimal

k vs. K

4

Decimal vs. binary multipliers

examples

What is the meaning of:

• 500 GB hard-disk

• 54 Mbps wireless Ethernet

• 3 GB of RAM

• 8 Mega-pixel camera

• 3.2 GHz CPU

QUIZ

1. How many bytes are in the memory pictured? 2. Express the result using the appropriate multiplier.

The Fetch-Execute Cycle

6

According to the CPU’s

machine language

Secondary Storage Devices

Name a few …

Why is it necessary to have secondary storage devices?

7

Secondary Storage Devices Why is it necessary to have them?

• Saving data when computer is off

• Volume …

– “Mass storage”

• Portability …

• Reliability (backups) …

• Modularity (add as you go) …

8

QUIZ: HDD

A HDD has 512 Bytes/sector, 256 sectors/track, and 10 platters. The diameter of each platter is 10 cm, and each track is 1 mm wide. Calculate the total capacity of the drive in MB.

Use binary Mega!

QUIZ: HDD

A HDD has 512 Bytes/sector, 256 sectors/track, and 10 platters. The diameter of each platter is 10 cm, and each track is 1 mm wide. Calculate the total capacity of the drive in MB.

Use binary Mega! 250 MB

Seek time

Time it takes for read/write head to be over right track

Latency

Time it takes for sector to be in position

Access time = Seek time + latency

Transfer rate (e.g. 100 MB/s)

11

QUIZ1: HDD

The spindle of a HDD rotates at 7200 RPM.

Calculate the average latency.

12

QUIZ1: HDD

The spindle of a HDD rotates at 7200 RPM.

Calculate the average latency.

4.16 ms

What are the minimum and maximum possible latencies?

13

QUIZ2: HDD

A file is on the HDD, on 15 consecutive blocks of the same track. Each block stores 4 KB.

The average seek time is 10 ms, and the average latency is 5 ms.

Once the first block is under the head, data is transferred at a rate of 50 MB/s.

Calculate the total time needed to transfer the file.

14

QUIZ2: HDD

A file is on the HDD, on 15 consecutive blocks of the same track. Each block stores 4 KB.

The average seek time is 10 ms, and the average latency is 5 ms.

Once the first block is under the head, data is transferred at a rate of 50 MB/s.

Calculate the total time needed to transfer the file. 17.9 ms 15

QUIZ Pipelining

A computer pipeline has 3 stages, as shown above.

Each stage takes 10 ms to execute, and each instruction must go sequentially through all 3 stages.

A program has 1000 instructions. Calculate how long it takes to run it:

• without pipelining

• with pipelining 16

QUIZ Pipelining

Can you come up with a formula for N stages?

(Assume the # of instructions is large)

17

Chapter review questions

• Read an ad for a computer and understand the jargon

• List the components and their function in a von Neumann machine

• Describe the fetch-decode-execute cycle of the von Neumann machine

18

Chapter review questions

• Describe how computer memory is organized and accessed

• Name and describe different auxiliary storage devices

• Define three alternative parallel computer configurations

19

20

Ethical Issues

Computer Hoaxes and Scams:

What is the principal difference between a hoax and a scam?

What are the most common complaints of Internet users about computer scams and hoaxes?

What are the most serious crimes perpetrated on the Web?

Why is it so difficult to police these schemes?

QUIZ

The previous version of PEP, PEP/7, could use only 12 bits for memory addresses.

How many Bytes of memory could PEP/7 address?

21

Some Sample Instructions

22

Sample Instructions

23

What does this instruction mean?

Sample Instructions

24

What does this instruction mean?

Sample Instructions

25

What do these instructions mean?

Sample Instructions

26

What do these instructions mean?

27

Sample Instructions

What does this instruction mean?

Why is there only one on this page?

28

Sample Instructions

What do these instructions mean?

Problem 16 / 189

29

The PEP/8 memory has the following contents:

0001 A2

0002 11

0003 00

0004 FF

What are the contents of reg. A after this instruction

is executed:

C1 00 01

30

0001 A2

0002 11

0003 00

0004 FF

Instruction

executed:

C1 00 01

31

Steps for executing a machine-language

program

Loader

Program

in

memory Execute

32

Steps for executing an assembly-language program

Loader

Program

in

memory Execute

Pep/8 Assembly Language

33

QUIZ: Write this program in assembly

34 EoL

Assembler directives, a.k.a. pseudo-ops

35

What is the difference between

operations and pseudo operations?

36

QUIZ: Change the program so it adds up four numbers

Food for thought: What to do it we need to add up 100 numbers? 1000?

37

Decision Making

38

BR Set PC to operand unconditionally

BRLT i Set PC to operand if A < 0

BREQ I Set PC to operand if A = 0

QUIZ: Would the program still work if the negMsg block were placed after the main program instead of before?

39

main: LDA sum,d

BRLT negMsg

STA sum,d

DECO sum,d

finish: STOP

negMsg: CHARO 0x0045,i

BR finish

QUIZ: Change the program so it prints 'Z' (for zero) if the sum is zero, and prints the actual sum if nonzero.

40

main: LDA sum,d

BRLT negMsg

STA sum,d

DECO sum,d

finish: STOP

negMsg: CHARO 0x0045,i

BR finish

QUIZ on Decision Making

Write a PEP assembly program that reads in a character, and then outputs ‘A’ if the character was A, or ‘not A’ otherwise.

(ASCII code for A is 41 hex)

41

Chapter Review Questions

• List the operations that a computer can perform

• Describe the important features of the Pep/8 virtual machine

• Distinguish between immediate addressing mode and direct addressing mode

• Write a simple machine-language program

• Distinguish between machine language and assembly language

42

Chapter Review Questions

• Describe the steps in creating and running an assembly-language program

• Write a simple program in assembly program

• Distinguish between instructions to the assembler and instructions to be translated

• Distinguish between following an algorithm and developing one

• Describe the pseudocode constructs used in expressing an algorithm

43

Chapter Review Questions

• Use pseudocode to express and algorithm

• Describe two approaches to testing

• Design and implement a test plan for a simple assembly-language program

44

Review problems for Ch.6: --Rewrite the loop program with the decision part at the beginning of the loop (use the red flowchart) --End of chapter 15, 22, 23, 37

45