An instruction cycle (sometimes called fetch-and-execute cycle, fetch-decode-execute cycle, or FDX) is the basic

operation cycle of a computer. It is the process by which a computer retrieves a program instruction from its memory, determines what actions the instruction requires, and carries out those actions. This cycle is repeated continuously by the central processing unit (CPU), from bootup to when the computer is shut down.

A diagram of the Fetch Execute Cycle.

       

1 Circuits Used 2 Initiating the cycle 3 Fetch cycle 4 Decode 5 Read the effective address 6 Execute cycle 7 The Fetch-Execute cycle in Transfer Notation 8 References

If the instruction is direct. Decode the instruction The decoder interprets the instruction. the PC points to the next instruction that will be read at the next cycle. Memory address register (MAR) .In case of a memory instruction (direct or indirect) the execution phase will be in the next clock pulse. passing them to the ALU to perform mathematical or logic functions on them.decodes the program instruction in the IR. or sent to an output device. Fetching the instruction The next instruction is fetched from the memory address that is currently stored in the program counter (PC).an incrementing counter that keeps track of the memory address of the instruction that is to be executed next. but will be similar to the following cycle: 1. it sends a condition signal back to the CU. the operation is performed (executed) at clock Pulse. If this is an I/O instruction or a Register instruction. .a temporary holding ground for the instruction that has just been fetched from memory Control unit (CU) . If the ALU is involved. Execute the instruction The control unit of the CPU passes the decoded information as a sequence of control signals to the relevant function units of the CPU to perform the actions required by the instruction such as reading values from registers. and writing the result back to a register. Program Counter may be updated to a different address from which the next instruction will be fetched. and any required data is fetched from main memory to be processed and then placed into data registers(Clock Pulse: T3). If the instruction has an indirect address. and stored in the instruction register (IR). 3. selecting machine resources such as a data source register and a particular arithmetic operation. At the end of the fetch operation. Memory data register (MDR) . During this cycle the instruction inside the IR (instruction register) gets decoded. nothing is done at this clock pulse. The result generated by the operation is stored in the main memory.Circuits Used The circuits used in the CPU during the cycle are:       Program counter (PC) . Based on the condition of any feedback from the ALU. the effective address is read from main memory.performs mathematical and logical operations Each computer's CPU can have different cycles based on different instruction sets. 2. 4.a two-way register that holds data fetched from memory (and ready for the CPU to process) or data waiting to be stored in memory Instruction register (IR) . and coordinates activation of those resources Arithmetic logic unit (ALU) .holds the address of a memory block to be read from or written to.

The opcode fetched from the memory is being decoded for the next steps and moved to the appropriate registers.. for instance. Indirect memory instruction . Decode Step 2 of the instruction Cycle is called the decode. These steps are the same for each instruction.Nothing is being this step the computer checks if it's a direct or indirect memory operation:   Direct memory instruction . If this is a I/O or Register instruction .the computer checks its kind and executes the instruction. Typically this address points to instructions in a read-only memory (ROM) which begin the process of loading the operating system. (That loading process is called booting. If this is a Memory operation . These steps will change with each instruction.The effective address is being read from the memory. Execute cycle Step 4 of the Instruction Cycle is the Execute Cycle. the predefined PC value is 0xfffffff0).) [1] Fetch cycle Step 1 of the Instruction Cycle is called the Fetch Cycle. The Fetch-Execute cycle in Transfer Notation Expressed in register transfer notation: .. Read the effective address Step 3 is deciding which operation it is. Next arithmetic and logical operations given in the instructions are executed on the data. Data is transferred between the CPU and the I/O module. Initiating the cycle The cycle starts immediately when power is applied to the system using an initial PC value that is predefined for the system architecture (in Intel IA-32 CPUs. The fetch cycle processes the instruction from the instruction word which contains an opcode. as well as other instructions such as jumping to another location on the program counter.The cycle is then repeated.

the MDR is expressed as the MBR (Memory Buffer Register).(Increment the PC for next cycle at the same time) The registers used above. which are used (at least conceptually) in the accessing of memory. T0 : AR = 0x5AF (PC) T1 : IR = 0x932E (M[AR]). The steps T0 to T5 have the following meaning: T0-T1 : Fetch operation T2 : Decode operation T3-T4 : Indirect Memory reference T5 : Execute ADD operation . besides the ones described earlier. I=1 (Indirect instruction) T3 : AR = 0x9AC (M[AR]) T4 : DR = 0x8B9F (M[AR]) T5 : AC = 0x8B9F + 0x7EC3 = 0x0A62. AR=0x32E. are the Memory Address Register (MAR) and the Memory Data Register (MDR). M[0x5AF]=0x932E. E = 1 (carry out). SC = 0 Summary: this is an example for an ADD Instruction which makes use of Register Indirect addressing. M[0x9AC]=0x8B9F. AC=0x7EC3. M[0x32E]=0x09AC. Often.Register Transfer Language): PC=0x5AF. Fetch and execute example (written in RTL . PC=0x5B0 (PC + 1) T2 : DECODE (IR) = ADD opCode.

Sign up to vote on this title
UsefulNot useful