Memory consists of a large array of words or bytes, each with its own address. The CPU fetches instructions from memory according to the value of the program counter. These instructions may cause additional loading from and storing to specific memory addresses. A typical instruction-execution cycle, for example, first fetches an instruction from memory The instruction is then decoded and may cause operands to be fetched from memory.
After the instruction has been executed on the operands, results may be stored back in memory. The memory unit see sortly a stream of memory addresses; it does not know how they are generated (by the instruction counter, indexing, indirection, literal addresses, and so on) or what they are for (instructions or data). Accordingly, we can ignore a program generates a memory address. We are interested only in the sequence of memory addresses generated by the running program.
The following is a summary of the six steps used to execute a single instruction.
Step 1: Fetch instruction.
Step 2: Decode instruction and Fetch Operands.
Step 3: Perform ALU operation.
Step 4: Access memory.
Step 5: Write back result to register file.
Step 6: Update the PC.