Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization & Assembly Language Lecture 3 (Computer System Organization) Processors
From text book: 2.1, 2.1.1, The Von Neumann Machine CPU Organization Instruction Execution Timing Control Unit CISC vs. RISC Design Principles for modern Computers 2Processors
3 The first version of modern computer designed by John Von-Neumann It is the basis for the majority of digital computer designs Its main features are: Using binary arithmetic Representing the program in a digital form inside the computer’s memory Organizing the steps of the computer operation into a cycle of decode-fetch- execute.
4Processors It is the brain of the computer Its function is to execute programs stored in main memory by fetching instructions, decoding them, and executing them. CPU Main Memory (IOP)O-DI-D Registers Control Unit ALU It consists of 3 main components Arithmetic Logic Unit (ALU) Control Unit Registers
5Processors Internal components of the CPU: I. ALU: Arithmetic & Logic Unit responsible for manipulating data II. Control Unit: Directs the flow of information. It controls where every bit of data goes III. Registers: High speed memory locations used to store temporary results & certain control information CPU MAR Control Unit MDR PC IR R0R0 R1R1 :::::: R n-1 ALU Registers
6Processors (A)(A)(B)(B) ALU A + B) A + B A B Registers ALU input register ALU output register ALU input bus
The figure corresponds to the data path of a typical Von-Neumann machine Not all designs have the input registers A & B or the output register. It consists of: Registers (Typically 1 to 32) ALU Several busses connecting the pieces 7Processors
1. The registers feed into the ALU input registers A & B 2. The input registers hold the input data while the ALU does the execution 3. The ALU performs simple operations such as addition, subtraction, and Boolean logic on its inputs 4. The output value is fed into the ALU output register 5. The result is then stored in one of the registers in the register stack 6. The value of the register could be then saved in memory if required 7. The cycle repeats a gain for any other operation in the ALU 8Processors
9 The data path is very important in all machines Not all machines have the input registers A & B or the output register The process of running two operands through the ALU and storing the result is called the data path cycle. The faster the data path cycle is, the faster the machine runs.
10Processors Most instructions can be divided into one of the two categories: Register – Register Instructions: Involve instructions between registers Register – memory Instructions: Allow memory words to be fetched into registers, where they can be used as ALU inputs in subsequent instructions. Allow registers to be stored back into memory.
11Processors A machine instruction has two parts: Opcode Operands Specify the type of operationImmediate data or address OpcodeOperand 1Operand 2 16 bits 4 bits6 bits
12Processors There are three main registers in a typical ALU: Program Counter Register (PC): It holds the address of the next instruction to be fetched for execution Instruction Register (IR): It holds the instruction currently being executed Accumulator Register (AC): It accumulates arithmetic results
13Processors The processing required for an instruction is called an instruction cycle. Instruction cycle = fetch-decode-execute cycle The program is executed one instruction at a time. The execution of the program is nothing more than a repeated sequence of fetching, decoding, & executing individual instructions, until the program executes a Halt or until a fetal error occurs
14Processors Obtain instruction from program storage Instruction Fetch Instruction Decode Operand fetch Execute Result Store Next Instruction Determine required actions Locate and obtain operand data Compute result value and status Deposit result in storage Determine successor instruction
1. Fetch the next instruction from memory into the instruction register 2. Change the program counter to point to the following instruction 3. Determine the type of instruction just fetched 4. If the instruction uses a word in memory, determine where it is. 5. Fetch the word, if needed, into the CPU register 6. Execute the instruction 7. Go to step 1 to begin executing the following instruction 15Processors
16Processors Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Program code void main(void) { : a = 2; b = 5; a = a + b; }
17Processors Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Start PC AC IR
18Processors CPU PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Fetch 357 Fetch Load 100 in AC A register
19Processors CPU Load 100 in AC PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Execute 358 Execute 2 2 A register
20Processors CPU 2 Load 100 in AC PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Fetch 358 Fetch Add 101 to AC A register
21Processors CPU Add 101 to AC PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Execute 359 Execute = 7 5 A register
22Processors CPU = 7 Add 101 to AC PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Fetch 359 Fetch Store AC in 100
23Processors CPU 7 Store AC in 100 PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Execute 359 Execute 7
24Processors CPU 7 Store AC in 100 PC AC IR Main Memory Load contents of 100 into AC Add contents of 101 to AC Store contents of AC to Halt 359
25Processors Can we run a program that imitate the function of the CPU? Yes, by using an interpreter. This machine can be much simpler & less expensive than a hardware processor. A hardware machine should also be provided (in order to run the interpreter)
26Processors Voltage Time Train of clock pulses To ensure that the steps of an instruction are carried out in an orderly fashion a clock circuit controls the processor by generating a train of clock pulses.
27Processors The time interval between two pulses is known as a clock period The clock rate or speed corresponds to the number of pulses per second, measured in Mega Hertz (MHz). 1 MHz = 1 million cycles per second The computer circuits perform an operation on the clock pulse Each step in the instruction execution cycle requires one or more clock periods If the clock circuit is sped up, the processor could be made to operate faster. However, each processor has a rated maximum clock speed over which it can’t operate properly
The control unit of the microprocessor is the one responsible for controlling the sequencing of events needed for the execution of an instruction, as well as the timing of this sequence of events. It obtains instructions from memory in the proper order, and sends them to IR. Decode them, and issue the necessary timing and control signals to all other devices so that the instructions can be executed correctly. The control unit is complemented by a clock or timing generator that helps it trigger the occurrence of each event at the correct point in time. 28Processors
There are two major types of control organization: Hardwired control Microprogrammed control 29Processors This control determines the instruction set of the computer and it is mainly split into two main categories: RISC: (Reduced Instruction Set Computer) CISC: (Complex Instruction set Computer)