81
P. 5.1 Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

Embed Size (px)

Citation preview

Page 1: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.1

Digital Technology and Computer Fundamentals

Chapter 5

Computer Organization

Page 2: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.2

Objectives

At the end of this chapter, you should be able to: describe the basic units of a

computer system;

describe the stored program concept in computer system;

describe the functions of each component in a CPU;

Page 3: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.3

Objectives (Cont’d)

describe the instruction execution process: fetch cycle and execution cycle;

distinguish the different categories of memory;

describe the operations of a memory;

describe the organization of a memory; and

Page 4: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.4

Objectives (Cont’d)

describe the principles of operations of the different secondary storage devices.

Page 5: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.5

References

M. Marris Mano, "Computer System Architecture," third edition, Prentice Hall.

V. Carl Hamacher, Zvonko G. Vranesic, Safwat G. Zaky, "Computer Organization," McGraw-Hill, 3rd ed. 1990.

Andrew S. Tanenbaum, "Structured Computer Organization," 3rd ed. Prentice Hall, 1990.

Page 6: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.6

References

Herman Lam, John O'Malley, "Fundamentals of Computer Engineering,” Wiley, 1988.

G. Shelly, T. Cashman, G. Waggoner, W. Waggoner, “Discovering Computers 98, A link to the Future,” International Thomson, 1998.

Page 7: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.7

General Principles

Digital computers are electronic machines capable of performing arithmetic and logical operations.

A typical microcomputer system consists of a Central Processing Unit (CPU), Main Memory, and Input / output devices.

They are connected by different buses.

Page 8: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.8

General Principles (Cont’d)

Address bus

Data bus

Control bus

CPU

I/O

Devices

Main

Memory

Page 9: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.9

General Principles (Cont’d) The physical parts of the computer

system are called hardware. A computer performs different

tasks under the command of programs.

A program is a sequence of instructions.

Page 10: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.10

General Principles (Cont’d) A computer instruction is a binary code

that specifies a sequence of micro-operations for the computer.

The instruction codes together with data are stored in memory.

The CPU reads each instruction from memory, decodes it, and executes it by issuing a sequence of micro-operations to different hardware components.

Page 11: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.11

Instruction

Every computer has its own unique instruction set.

Each instruction will be assigned a binary code, called the machine code, consisting of two parts, opcode and address.

Page 12: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.12

Instruction (Cont’d)

The specification of the operation to be performed by the instruction is called the operation code or the opcode.

The address part specifies the source or the destination of the operand.

Page 13: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.13

Instruction (Cont’d)

Every operation must have the opcode part, the address part is not always needed.

Consequently, it is unavoidable to have instructions of different lengths.

Page 14: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.14

Central Processing Unit

The function of the CPU is to execute programs stored in the main memory by fetching and decoding them, then executing them one after another.

Page 15: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.15

Components of CPU

A simplified CPU

ALU

External buses

Address

buffer

Data

buffer

PC SP Acc

PSR

Timing and

Control Unit

IR

Register

Register

Register

Internal buses

Page 16: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.16

Timing and Control Unit

Responsible for synchronization of the system and generating control signals

Generates the clock signal. Decoding an instruction Providing a reset function to

initialize the CPU along with other components in the microprocessor system.

Page 17: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.17

Arithmetic and Logic Unit (ALU) Perform various arithmetic and

logical operations. Placing the results into the

accumulator. Changes the flags in the Processor

Status Registers.

Page 18: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.18

Accumulator

Used extensively for data manipulations.

It is commonly used to store the operands and results of different operations

Page 19: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.19

Instruction Register (IR)

Controlled only by the Timing and Control Unit

A temporary store for an instruction transferred from the main memory.

When instructed, IR passes the instruction to the Timing and Control Unit for instruction decoding.

Page 20: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.20

Program Counter (PC)

Place to store the address information of the next instruction to be executed.

The content of the Program Counter is updated by the Timing and Control Unit after the instruction decoding.

Page 21: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.21

Stack Pointer (SP)

Stack is a special implementation of memories. (Last In First Out operation).

The Stack pointer (SP) contains the address of next free memory location.

Page 22: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.22

Stack Operations

Push: Data are stored in the location pointed to by the Stack Pointer. After the operation, the content of the SP will be incremented.

Pop: Content of the SP is decremented and the data in the memory location pointed by the SP will be retrieved.

Page 23: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.23

Processor Status Register (PSR) Contains various bits of status

information. Common flags include: zero, carry,

overflow, interrupt, and negative. These flags are set or cleared by

the various components in CPU, after an operation.

Programmers know from these flags the result of an operation.

Page 24: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.24

General Purpose Registers Store temporary data, usually the

result from an operation and will be used again in a later operation.

Fast storage, inside the CPU without selecting external chips.

Sometimes used for indexing purposes.

Page 25: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.25

Instruction fetch-execute cycle The instruction cycle consists of

the fetch cycle and the execute cycle.

The fetch cycle is identical for all instructions.

The execute cycle is different for different instructions.

Page 26: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.26

The fetch cycle

The address of the next instruction is stored in PC.

A Memory Data Register (MDR) resides in the CPU which holds data items for communication.

The address information to the memory is held in the Memory Address Register (MAR).

Page 27: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.27

The fetch cycle (Cont’d)

Fetching: transfer of the address from the PC

to MAR

generation of the READ control signal,

waiting for the memory to transfer the instruction or data into MDR.

Page 28: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.28

The fetch cycle (Cont’d)

The instruction code is then stored temporarily in IR for decoding.

After the instruction is decoded, the content of the program counter will be updated and the fetch cycle completes.

Page 29: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.29

The execute cycle

The CPU performs the different tasks according to the instruction.

Different resources will be required for different types of instructions.

At the end of the execute cycle, the contents of the Processor Status Register will be updated

Page 30: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.30

Semiconductor Memories An integrated circuit capable of

storing a binary number and recalling it when addressed or selected.

One of the storage devices used in computers.

Store either programs or data in a computer.

Page 31: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.31

Categorizing Memories

Based on the way a memory is accessed.

Time required to locate and access a memory is called access time.

Page 32: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.32

Categorizing Memories (Cont’d) Random access devices: in which

any location may be selected at random, equal access time for each location.

Sequential access devices: in which the locations are sequentially arranged, access time varies according to the location.

Page 33: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.33

Categorizing Memories (Cont’d) Volatile devices: in which the data

stored will be lost when power supply is off.

Non-volatile devices: in which the data stored will not be lost when power is off.

Page 34: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.34

Random access memory

Random Access Memory (RAM) is a read / write memory.

Random access and volatile device.

There are two basic types of RAM in use today, dynamic RAM and Static RAM.

Page 35: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.35

Dynamic RAM

Designed for high capacity, moderate speeds, and low power consumption.

Memory cells are charge-storage capacitors with driver transistors.

The presence or absence of charge in a capacitor interpreted as 1 or 0.

Page 36: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.36

Dynamic RAM (Cont’d)

The charge in a capacitor has tendency to discharge itself.

Required periodic charging to maintain the data stored - refreshing.

Page 37: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.37

Static RAM

Made of flip-flops and logic gates. The two stable states in flip-flops

represent binary values. Do not require refreshing. Low capacity, high power

consumption and relatively high cost per unit storage.

Page 38: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.38

Read Only Memory (ROM) Read only refers to the

applications at the end user’s view. Data is permanently programmed

either at the time of manufacture or by the user prior to the memory being installed.

Non-volatile and random access. Several types.

Page 39: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.39

Standard ROMs

Programmed by the manufacturer. Users can only read the data or

execute programs in the ROM. Store certain standard applications

for general user applications.

Page 40: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.40

Programmable ROMs (PROM) Can be programmed permanently

by the user or distributor using special equipment.

Only programmed once.

Page 41: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.41

Erasable Programmable ROMs (EPROM) Can be programmed and erased

by the user for many times. Erasure is carried out by shining

high intensity ultra-violet light through a special transparent window at the top of the memory IC.

Special device called EPROM writer is needed.

Page 42: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.42

Electrically Erasable Programmable ROMs (EEPROM) Similar to EPROM. User can erase a single bit

electrically in one operation. Operations require a special

equipment.

Page 43: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.43

Memory Organization

Usually organized into N locations where N is generally some power of 2.

The content in each location is called a word.

Each word consists of same number of bits, word length.

Each word is assigned an address.

Page 44: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.44

Operations on a memory

Reading from a memory: retrieving data, and writing to a memory: storing data.

Assisted by two external circuits, the memory address register (MAR) and memory data register (MDR)

Page 45: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.45

MDR and MAR

Page 46: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.46

MDR and MAR (Cont’d)

In general, for an n-bit address information, a total of 2n locations can be addressed.

MAR consists of n binary devices, so that a total number of 2n words can be addressed.

The size of the MDR is the same as the word length.

Page 47: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.47

Reading a memory

Reading a memory location will usually not destroy or change the contents in the location - non-destructive read.

The address is placed in the MAR Then a read signal is passed to the

memory. Data in the specified location will be

passed to MDR.

Page 48: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.48

Writing a memory

The data is first placed in the MDR, and the address in the MAR.

Then a write signal is passed to the memory.

The memory will store the data in MDR into the specified location.

After the operation, the data originally stored in the location will be lost.

Page 49: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.49

Locality of Reference

References to memory at any given interval of time confined within a few localized areas in memory.

Over short interval, addresses generated by a typical program refer to a few localized areas of memory repeatedly.

Remainder of memory is accessed relatively infrequently.

Page 50: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.50

Cache Memory

Keeping the most frequently accessed instructions and data in fast small memory.

The average memory access time will be less.

Such a fast small memory is referred to as a cache memory.

Page 51: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.51

Cache Memory (Cont’d)

Because of the locality of reference property of programs, although cache is small, most memory requests will be found in the fast cache memory.

Between CPU and main memory. Access time of cache less by a

factor of 5 to 10.

Page 52: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.52

Cache Memory (Operation) When the CPU needs to access

memory, the cache is examined. If the word is found in the cache, it

is read from the fast memory. If not, main memory is accessed to

read the word. A block (1 - 16) of words containing the one just accessed is then transferred to cache memory.

Page 53: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.53

Virtual Memory

Current active programs and data do not fit into the physical main memory space.

Secondary storage devices hold the overflow.

OS automatically moves programs between the main memory and secondary storage, called virtual memory technique.

Page 54: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.54

Virtual Memory (Cont’d)

The binary addresses issued by the processor are called virtual or logical addresses.

Translation from virtual addresses to physical addresses is implemented by a combination of hardware and software components.

Page 55: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.55

Virtual Memory (Cont’d)

If a virtual address refers to an address in the physical memory, then the contents of the appropriate location in the main memory are accessed immediately.

If not, its contents must be brought into a suitable location in the main memory before they can be used.

Page 56: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.56

Virtual Memory (Cont’d)

The simplest method: arrange files in fixed-length units called pages.

Each page consists of a block of contiguous locations in the main memory or in secondary storage.

When required, a page of information is moved back and forth between the main memory and secondary storage.

Page 57: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.57

Virtual Memory (Cont’d)

Bridging the size gap between the main memory and secondary storage

Usually implemented in part by software techniques.

Page 58: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.58

Secondary Storage

A kind of non-volatile memory. Relative low cost and large

storage. Directly addressed. External to the microprocessor. Contents must be loaded into the

main memory before they can be accessed.

Page 59: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.59

Secondary Storage

Page 60: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.60

Floppy disks

Also called a diskette, consists of a circular piece of thin plastic, coated with magnetic material.

Must be formatted before used. Formatting defines the tracks,

cylinders, and sectors on the disk surface.

Page 61: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.61

Formatting floppy disks

Page 62: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.62

Formatting floppy disks (Cont’d) A sector is a pie-shaped section of

the floppy disk. A track sector is a section of track

within a sector. Each track sector holds 512 bytes.

Page 63: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.63

Formatting floppy disks (Cont’d) A cluster consists of 2 – 8 track

sectors depending on the OS. The smallest unit to store data. One file can be stored in many

clusters.

Page 64: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.64

Formatting floppy disks (Cont’d) Formatting process also

establishes a directory, the file allocation table (FAT).

FAT records information about files stored on the floppy disk.

The file name, size, the time and date changed, and the cluster number where the file begins.

Page 65: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.65

Accessing floppy disks

Through a floppy disk drive. A drive motor rotates the disk. A read/write head can rest on the

top and bottom surface of the rotating floppy disk.

To write data, the read/write head generates electronic impulses to change the magnetic polarity, of magnetic areas along a track

Page 66: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.66

Accessing floppy disks (Cont’d)

Page 67: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.67

Hard disks

Page 68: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.68

Hard disks (Cont’d)

Consist of one or more rigid platters coated with magnetic material on the surface.

The platters, read/write heads, and access arms are all enclosed in an airtight sealed case.

Page 69: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.69

Accessing Hard disks

Much like storing data on floppy disks except hard disks have multiple platters

read/write heads do not touch disk surface.

Access time for a hard disk is faster because it spins faster and spinning constantly.

Page 70: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.70

Accessing Hard disks (Cont’d) Data is stored on both sides A hard disk must be formatted

before it can store data. Before a hard disk is formatted, it

can be divided into separate areas called partitions.

Each partition can function as if it were a separate disk.

Page 71: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.71

Disks cartridges

Disk cartridges, are removable. They provide both the storage

capacity and fast access times of hard disks and the portability of floppy disks.

Page 72: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.72

Magnetic tape

Thin ribbon of plastic, one side of which is coated with magnetic material.

Sequential access storage media. The most common types are

cartridge tape, but some older systems use reel-to-reel tape.

For backup and transferring data between systems.

Page 73: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.73

Accessing Magnetic tape Same as disk drives, tape drives

have an electromagnetic read/write head to access magnetic patterns.

On Quarter-Inch-Cartridge (QIC) tape devices, data is recorded in a single track. When the end is reached, the tape reverses direction and data is recorded in another track in opposite direction.

Page 74: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.74

Accessing Magnetic tape (Cont’d) Digital audio tape (DAT) uses

helical scan technology to record data in tracks at a six-degree angle to the tape.

Older, one-half-inch reel-to-reel tape drives record data in nine channels, eight channels for data bits and one channel for a parity bit.

Page 75: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.75

Accessing Magnetic tape (Cont’d)

Page 76: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.76

PC Cards

Credit card-sized cards that fit into PCMCIA (Personal Computer Memory Card International Association) expansion slots.

Mostly used on portable computers Only 10.5mm thick but can contain

more than 200 MB of data.

Page 77: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.77

Optical Disks

Page 78: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.78

Optical Disks (Cont’d)

To record data on an optical disk, a high-power laser heats the surface and makes a microscopic pit.

A low-power laser light is reflected from the smooth unpitted areas and is interpreted as 1.

The pitted areas do not reflect the laser beam and are interpreted as 0.

Page 79: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.79

Optical Disks (Cont’d)

A CD-ROM can store more than 800 MB data.

CD-ROM drives are often advertised as x-times speed drives.

The original standard established a minimum transfer rate of 150 kbps.

Page 80: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.80

Optical Disks (Cont’d)

Most optical disks are prerecorded and cannot be modified by users.

WORM devices, allow write once, read many on the disks.

Most common erasable optical drives use magneto-optical technology, in which a magnetic field changes the polarity of a spot that has been heated by a laser.

Page 81: P. 5.1 Digital Technology and Computer Fundamentals Chapter 5 Computer Organization

P. 5.81

Smart Card

Same size and thickness of a credit card

Contains a thin microprocessor capable of storing information.

When inserted into compatible equipment, the information on the smart card can be read and if necessary, updated.