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

Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Jul 07, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Chapter 5

Computing Components

Components

Circuits

Gates

Transistors

Yet another layer of

abstraction!

Page 2: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Multipliers

2

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

Page 3: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 4: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 5: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

QUIZ

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

Page 6: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

The Fetch-Execute Cycle

6

According to the CPU’s

machine language

Page 7: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Secondary Storage Devices

Name a few …

Why is it necessary to have secondary storage devices?

7

Page 8: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 9: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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!

Page 10: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 11: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 12: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

QUIZ1: HDD

The spindle of a HDD rotates at 7200 RPM.

Calculate the average latency.

12

Page 13: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 14: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 15: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 16: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 17: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

QUIZ Pipelining

Can you come up with a formula for N stages?

(Assume the # of instructions is large)

17

Page 18: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 19: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 20: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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?

Page 21: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 22: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Some Sample Instructions

22

Page 23: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Sample Instructions

23

What does this instruction mean?

Page 24: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Sample Instructions

24

What does this instruction mean?

Page 25: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Sample Instructions

25

What do these instructions mean?

Page 26: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Sample Instructions

26

What do these instructions mean?

Page 27: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

27

Sample Instructions

What does this instruction mean?

Why is there only one on this page?

Page 28: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

28

Sample Instructions

What do these instructions mean?

Page 29: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 30: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

30

0001 A2

0002 11

0003 00

0004 FF

Instruction

executed:

C1 00 01

Page 31: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

31

Steps for executing a machine-language

program

Loader

Program

in

memory Execute

Page 32: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

32

Steps for executing an assembly-language program

Loader

Program

in

memory Execute

Page 33: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

Pep/8 Assembly Language

33

Page 34: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

QUIZ: Write this program in assembly

34 EoL

Page 35: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

35

What is the difference between

operations and pseudo operations?

Page 36: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

36

QUIZ: Change the program so it adds up four numbers

Page 37: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

37

Page 38: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 39: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 40: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 41: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 42: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 43: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 44: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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

Page 45: Chapter 5 - Tarleton State University · Chapter 5 Computing Components Components Circuits Gates Transistors Yet another layer of abstraction! Multipliers 2 When referring to computer

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