810 likes | 982 Views
Digital Technology and Computer Fundamentals. Chapter 5 Computer Organization. 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;
E N D
Digital Technology and Computer Fundamentals Chapter 5 Computer Organization
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;
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
Objectives (Cont’d) • describe the principles of operations of the different secondary storage devices.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Components of CPU • A simplified CPU
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.
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.
Accumulator • Used extensively for data manipulations. • It is commonly used to store the operands and results of different operations
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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
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.
Categorizing Memories • Based on the way a memory is accessed. • Time required to locate and access a memory is called access time.
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.
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.
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.
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.
Dynamic RAM (Cont’d) • The charge in a capacitor has tendency to discharge itself. • Required periodic charging to maintain the data stored - refreshing.
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.
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.
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.
Programmable ROMs (PROM) • Can be programmed permanently by the user or distributor using special equipment. • Only programmed once.
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.
Electrically Erasable Programmable ROMs (EEPROM) • Similar to EPROM. • User can erase a single bit electrically in one operation. • Operations require a special equipment.
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.
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)
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.
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.
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.
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.
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.