NAMES: Raheem AbdulRaheem MATRIC NUMBER:18/sci01/081 FUNCTIONS OF CPU 1.Fetch: Each is stored in memory and has its own address. The processor takes this address number from the program counter, which is responsible for tracking which instructions the CPU should execute next. Fetch is the first of two stages involved in computer processing. The processor operates by processing instructions in what is called the "fetch/execute cycle." The processor fetches (reads from memory) an instruction and then, depending on the instruction, executes it (takes some further action with it, such as shifting bits to the right or left). Then it fetches the next instruction, and so forth. A register in the processor called the program counter holds information about where the processor is in the particular program being processed and the address (location) of the next instruction to be executed. At the beginning of the cycle, the program counter tells the processor which instruction to fetch; during the cycle, the instruction is executed and the information is updated to refer to the next instruction to be fetched. In some newer processor designs, more than one instruction can be fetched at the same time and execution is done in parallel. 2.Decode : All programs to be executed are translated to into Assembly instructions. Assembly code must be decoded into binary instructions, which are understandable to your CPU. This step is called decoding. The decoding process allows the CPU to determine what instruction is to be performed so that the CPU can tell how many operands it needs to fetch in order to perform the instruction. The opcode fetched from the memory is decoded for the next steps and moved to the appropriate registers. The decoding is done by the CPU's Control Unit. This step evaluates which type of operation is to be performed. If it is a memory operation, the computer checks whether it's a direct or indirect memory operation: A.Direct memory operation - Nothing is done. B.Indirect memory operation - The effective address is read from memory. If it is an I/O or register instruction, the computer checks its type and executes the instruction. 3.Execute: One may be amazed how the CPU is programmed. A special register is contained in CPU-the instruction register-whose bit pattern determines what the CPU will do. Once that action has been completed, the bit pattern in the instruction register can be changed, and the CPU will perform the operation specified by this next bit pattern. Most of the modern CPUs use an instruction queue. Some instructions are waiting in the queue, ready to be executed. Different electronic circuitry keeps the instruction queue full while the control unit is executing the instructions. But this is simply an implementation details that allows the control unit to run faster. The nature of how the control unit executes a program is represented by the single instruction register model. As instructions are simply bit patterns, they can be stored in memory. Instruction pointer register always has the memory address of (points to) the next instruction to be executed. To execute this instruction for the control unit, it is copied into the instruction register. 4.Store: The CPU must give feedback after executing an instruction, and the output data is written to the memory.