Digital Technology and Computer Fundamentals Chapter 5 Computer

  • Slides: 81
Download presentation
Digital Technology and Computer Fundamentals Chapter 5 Computer Organization P. 5. 1

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

Objectives n At the end of this chapter, you should be able to: u

Objectives n At the end of this chapter, you should be able to: u describe the basic units of a computer system; u describe the stored program concept in computer system; u describe the functions of each component in a CPU; 2

Objectives (Cont’d) u describe the instruction execution process: fetch cycle and execution cycle; u

Objectives (Cont’d) u describe the instruction execution process: fetch cycle and execution cycle; u distinguish the different categories of memory; u describe the operations of a memory; u describe the organization of a memory; and 3

Objectives (Cont’d) u describe the principles of operations of the different secondary storage devices.

Objectives (Cont’d) u describe the principles of operations of the different secondary storage devices. 4

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

References u M. Marris Mano, "Computer System Architecture, " third edition, Prentice Hall. u V. Carl Hamacher, Zvonko G. Vranesic, Safwat G. Zaky, "Computer Organization, " Mc. Graw. Hill, 3 rd ed. 1990. u Andrew S. Tanenbaum, "Structured Computer Organization, " 3 rd ed. Prentice Hall, 1990. 5

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

References u Herman Lam, John O'Malley, "Fundamentals of Computer Engineering, ” Wiley, 1988. u G. Shelly, T. Cashman, G. Waggoner, W. Waggoner, “Discovering Computers 98, A link to the Future, ” International Thomson, 1998. 6

General Principles n n n Digital computers are electronic machines capable of performing arithmetic

General Principles n n n 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. 7

General Principles (Cont’d) 8

General Principles (Cont’d) 8

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

General Principles (Cont’d) n n n 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. 9

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

General Principles (Cont’d) n n n 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. 10

Instruction n n Every computer has its own unique instruction set. Each instruction will

Instruction n n 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. 11

Instruction (Cont’d) § § The specification of the operation to be performed by the

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. 12

Instruction (Cont’d) § n Every operation must have the opcode part, the address part

Instruction (Cont’d) § n Every operation must have the opcode part, the address part is not always needed. Consequently, it is unavoidable to have instructions of different lengths. 13

Central Processing Unit n The function of the CPU is to execute programs stored

Central Processing Unit n 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. 14

Components of CPU n A simplified CPU 15

Components of CPU n A simplified CPU 15

Timing and Control Unit n Responsible for synchronization of the system and generating control

Timing and Control Unit n Responsible for synchronization of the system and generating control signals n Generates the clock signal. n Decoding an instruction n Providing a reset function to initialize the CPU along with other components in the microprocessor system. 16

Arithmetic and Logic Unit (ALU) n n n Perform various arithmetic and logical operations.

Arithmetic and Logic Unit (ALU) n n n Perform various arithmetic and logical operations. Placing the accumulator. results into the Changes the flags in the Processor Status Registers. 17

Accumulator n n Used extensively manipulations. for data It is commonly used to store

Accumulator n n Used extensively manipulations. for data It is commonly used to store the operands and results of different operations 18

Instruction Register (IR) n n n Controlled only by the Timing and Control Unit

Instruction Register (IR) n n n 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. 19

Program Counter (PC) n n Place to store the address information of the next

Program Counter (PC) n n 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. 20

Stack Pointer (SP) n n Stack is a special implementation of memories. (Last In

Stack Pointer (SP) n n Stack is a special implementation of memories. (Last In First Out operation). The Stack pointer (SP) contains the address of next free memory location. 21

Stack Operations n n Push: Data are stored in the location pointed to by

Stack Operations n n 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. 22

Processor Status Register (PSR) n n Contains various bits of status information. Common flags

Processor Status Register (PSR) n n 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. 23

General Purpose Registers n n n Store temporary data, usually the result from an

General Purpose Registers n n n 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 purposes. used for indexing 24

Instruction fetchexecute cycle n n n The instruction cycle consists of the fetch cycle

Instruction fetchexecute cycle n n n 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. 25

The fetch cycle n n n The address of the next instruction is stored

The fetch cycle n n n 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). 26

The fetch cycle (Cont’d) n Fetching: u transfer of the address from the PC

The fetch cycle (Cont’d) n Fetching: u transfer of the address from the PC to MAR u generation of the READ control signal, u waiting for the memory to transfer the instruction or data into MDR. 27

The fetch cycle (Cont’d) n n The instruction code is then stored temporarily in

The fetch cycle (Cont’d) n n 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. 28

The execute cycle n n n The CPU performs the different tasks according to

The execute cycle n n n 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 29

Semiconductor Memories n n n An integrated circuit capable of storing a binary number

Semiconductor Memories n n n 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. 30

Categorizing Memories n n Based on the way a memory is accessed. Time required

Categorizing Memories n n Based on the way a memory is accessed. Time required to locate and access a memory is called access time. 31

Categorizing Memories (Cont’d) n n Random access devices: in which any location may be

Categorizing Memories (Cont’d) n n 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. 32

Categorizing Memories (Cont’d) n n Volatile devices: in which the data stored will be

Categorizing Memories (Cont’d) n n 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. 33

Random access memory n n n Random Access Memory (RAM) is a read /

Random access memory n n n 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. 34

Dynamic RAM n n n Designed for high capacity, moderate speeds, and low power

Dynamic RAM n n n 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. 35

Dynamic RAM (Cont’d) n n The charge in a capacitor has tendency to discharge

Dynamic RAM (Cont’d) n n The charge in a capacitor has tendency to discharge itself. Required periodic charging to maintain the data stored refreshing. 36

Static RAM n n Made of flip-flops and logic gates. The two stable states

Static RAM n n 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. 37

Read Only Memory (ROM) n n Read only refers to the applications at the

Read Only Memory (ROM) n n 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. n Non-volatile and random access. n Several types. 38

Standard ROMs n n n Programmed by the manufacturer. Users can only read the

Standard ROMs n n n Programmed by the manufacturer. Users can only read the data or execute programs in the ROM. Store certain standard applications for general user applications. 39

Programmable ROMs (PROM) n n Can be programmed permanently by the user or distributor

Programmable ROMs (PROM) n n Can be programmed permanently by the user or distributor using special equipment. Only programmed once. 40

Erasable Programmable ROMs (EPROM) n n n Can be programmed and erased by the

Erasable Programmable ROMs (EPROM) n n n 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. 41

Electrically Erasable Programmable ROMs (EEPROM) n n n Similar to EPROM. User can erase

Electrically Erasable Programmable ROMs (EEPROM) n n n Similar to EPROM. User can erase a single bit electrically in one operation. Operations equipment. require a special 42

Memory Organization n n Usually organized into N locations where N is generally some

Memory Organization n n 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. 43

Operations on a memory n n Reading from a memory: retrieving data, and writing

Operations on a memory n n 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) 44

MDR and MAR 45

MDR and MAR 45

MDR and MAR (Cont’d) n n n In general, for an n-bit address information,

MDR and MAR (Cont’d) n n n In general, for an n-bit address information, a total of 2 n locations can be addressed. MAR consists of n binary devices, so that a total number of 2 n words can be addressed. The size of the MDR is the same as the word length. 46

Reading a memory n n Reading a memory location will usually not destroy or

Reading a memory n n Reading a memory location will usually not destroy or change the contents in the location - nondestructive 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. 47

Writing a memory n n The data is first placed in the MDR, and

Writing a memory n n 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. 48

Locality of Reference n n n References to memory at any given interval of

Locality of Reference n n n 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. 49

Cache Memory n n n Keeping the most frequently accessed instructions and data in

Cache Memory n n n 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. 50

Cache Memory (Cont’d) n n n Because of the locality of reference property of

Cache Memory (Cont’d) n n n 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. 51

Cache Memory (Operation) n n n When the CPU needs to access memory, the

Cache Memory (Operation) n n n 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. 52

Virtual Memory n n n Current active programs and data do not fit into

Virtual Memory n n n 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. 53

Virtual Memory (Cont’d) n n The binary addresses issued by the processor are called

Virtual Memory (Cont’d) n n 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. 54

Virtual Memory (Cont’d) n n If a virtual address refers to an address in

Virtual Memory (Cont’d) n n 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. 55

Virtual Memory (Cont’d) n n n The simplest method: arrange files in fixed-length units

Virtual Memory (Cont’d) n n n 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. 56

Virtual Memory (Cont’d) n n Bridging the size gap between the main memory and

Virtual Memory (Cont’d) n n Bridging the size gap between the main memory and secondary storage Usually implemented in part by software techniques. 57

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

Secondary Storage n A kind of non-volatile memory. n Relative low cost and large storage. n Directly addressed. n External to the microprocessor. n Contents must be loaded into the main memory before they can be accessed. 58

Secondary Storage 59

Secondary Storage 59

Floppy disks n n n Also called a diskette, consists of a circular piece

Floppy disks n n n 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. 60

Formatting floppy disks 61

Formatting floppy disks 61

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

Formatting floppy disks (Cont’d) n n n 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. 62

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

Formatting floppy disks (Cont’d) n n n 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. 63

Formatting floppy disks (Cont’d) n n n Formatting process also establishes a directory, the

Formatting floppy disks (Cont’d) n n n 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. 64

Accessing floppy disks n n Through a floppy disk drive. A drive motor rotates

Accessing floppy disks n n 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 65

Accessing floppy disks (Cont’d) 66

Accessing floppy disks (Cont’d) 66

Hard disks 67

Hard disks 67

Hard disks (Cont’d) n n Consist of one or more rigid platters coated with

Hard disks (Cont’d) n n 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. 68

Accessing Hard disks n Much like storing data on floppy disks except u hard

Accessing Hard disks n Much like storing data on floppy disks except u hard disks have multiple platters u read/write heads do not touch disk surface. n Access time for a hard disk is faster because it spins faster and spinning constantly. 69

Accessing Hard disks (Cont’d) n n Data is stored on both sides A hard

Accessing Hard disks (Cont’d) n n 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. 70

Disks cartridges n n Disk cartridges, are removable. They provide both the storage capacity

Disks cartridges n n Disk cartridges, are removable. They provide both the storage capacity and fast access times of hard disks and the portability of floppy disks. 71

Magnetic tape n n Thin ribbon of plastic, one side of which is coated

Magnetic tape n n 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. 72

Accessing Magnetic tape n n Same as disk drives, tape drives have an electromagnetic

Accessing Magnetic tape n n 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. 73

Accessing Magnetic tape (Cont’d) n n Digital audio tape (DAT) uses helical scan technology

Accessing Magnetic tape (Cont’d) n n 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. 74

Accessing Magnetic tape (Cont’d) 75

Accessing Magnetic tape (Cont’d) 75

PC Cards n n n Credit card-sized cards that fit into PCMCIA (Personal Computer

PC Cards n n n Credit card-sized cards that fit into PCMCIA (Personal Computer Memory Card International Association) expansion slots. Mostly used on portable computers Only 10. 5 mm thick but can contain more than 200 MB of data. 76

Optical Disks 77

Optical Disks 77

Optical Disks (Cont’d) n n n To record data on an optical disk, a

Optical Disks (Cont’d) n n n 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. 78

Optical Disks (Cont’d) n n n A CD-ROM can store more than 800 MB

Optical Disks (Cont’d) n n n 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. 79

Optical Disks (Cont’d) n n n Most optical disks are prerecorded and cannot be

Optical Disks (Cont’d) n n n 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. 80

Smart Card n n n Same size and thickness of a credit card Contains

Smart Card n n n 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. 81