A machine cycle consists of a sequence of three steps that is performed continuously and at a rate of millions per second while a computer is in operation. They are fetch, decode and execute. There also is a fourth step, store, in which input and output from the other three phases is stored in memory for later use; however, no actual processing is performed during this step.
In the fetch step, the control unit requests that main memory provide it with the instruction that is stored at the address (i.e., location in memory) indicated by the control unit's program counter.
The control unit is a part of the CPU that also decodes the instruction in the instruction register. A register is a very small amount of very fast memory that is built into the CPU in order to speed up its operations by providing quick access to commonly used values; instruction registers are registers that hold the instruction being executed by the CPU. Decoding the instructions in the instruction register involves breaking the operand field into its components based on the instructions opcode.
Opcode (an abbreviation of operation code) is the portion of a machine language instruction that specifies what operation is to be performed by the CPU. Machine language, also called machine code, refers to instructions coded in patterns of bits (i.e., zeros and ones) that are directly readable and executable by a CPU.
A program counter, also called the instruction pointer in some computers, is a register that indicates where the computer is in its instruction sequence. It holds either the address of the instruction currently being executed or the address of the next instruction to be executed, depending on the details of the particular computer. The program counter is automatically incremented for each machine cycle so that instructions are normally retrieved sequentially from memory.
The control unit places these instructions into its instruction register and then increments the program counter so that it contains the address of the next instruction stored in memory. It then executes the instruction by activating the appropriate circuitry to perform the requested task. As soon as the instruction has been executed, it restarts the machine cycle, beginning with the fetch step.
Created May 15, 2006.