Steps followed by CPU to Execute an Instruction

steps followed by CPU to execute an

instruction step 1 fetch instruction

execution cycle starts with fetching

instruction from main memory the

instruction at the current program

counter PC will be fetched and will be

stored in instruction register IR step

to decode instruction during this step

the encoded instruction present in the

IR instruction register is interpreted

by the decoder to form a decoded portion

of the instruction step 3 part from ALU

operation Lu or arithmetic logic unit is

where two operands in the instruction

will be operated on given operator such

as if the instruction was to add two

values then here the addition will

happen here you take two values and

output one the result of the operation

however this step is optional as not all

the instruction need to go through a

loop for example the jump instruction

step 4 access memory there are only two

kind of instructional accesses memory

load and store store copies a register

value to memory and load copies a value

from memory to a register any other

instruction is keeps this step update

register file in this step the output or

result of the ALU is written back to the

register file to update the register

file the result will also be due to a

load from memory some instructions do

not have results to store for example

branch and jumped instruction do not

have any results gesture step 6

update the PC or program counter

ultimately at the end of the execution

of the current instruction we need to

update the program counter PC to the

address of the next instruction so

you can go back to step one where the

CPU will catch instruction however the

program counter might need to be set to

other memory addresses than the next one

if the instruction was branch for jump

instruction thank you very much for

watching the video like and share the

video if you have liked it and also

subscribe to our channel so that you get

all the latest videos as soon as they

are uploaded