Fetch-Decode-Execute Cycle Flashcards
What is the Fetch-Decode-Execute cycle?
Is the basic method used by the CPU to carry out a single instruction contained in a computer program
Name the 5 registers involved in Fetch-Decode-Execute cycle
The MDR (Memory Data Register) The MAR (Memory Address Register) Program Counter Accumulator Instruction Register
What is the fetch operation?
Is responsible for getting an instruction or data from main memory into the CPU
What happens in the Fetch cycle?
The program you want to run is loaded into RAM
The starting address location is loaded into the program counter
The program counter value is loaded into the MAR
The control unit then loads the address on to the address bus
The control unit then sends a signal to RAM to read the address
The instruction at that address is passed across the data bus and copied into the MDR
The instruction in the MDR is copied into the instruction register, so that it is ready to use during the decode stage
The program counter is incremented by one location so that it’s ready to begin the next fetch cycle
What happens in the Decode cycle?
The control unit reads the Instruction Register, and makes sure that it is an instruction that the CPU can carry out i.e. it is in its instruction set. If it is, then various parts of the CPU are prepared for the next stage, which is the ‘Execute’ stage
What happens if the address of the instruction does not match up on the instruction set?
It would flag an error but more likely it will crash the program
What happens in the Execute cycle?
The CPU executes the instruction that has been decoded