Each computer's CPU can have different cycles based on different instruction sets, but will be similar to the following cycle:
1. Fetch the instruction
The CPU presents, on the address bus, the value stored in the Program Counter. This is the memory address of the next instruction that is to be executed. The CPU then fetches the instruction from main memory via the data bus, and it is then placed into the CIR. The Program Counter is incremented to contain the address the next instruction.
2. Decode the instruction
The instruction decoder interprets the instruction. If the instruction has an indirect address, the effective address is read from main memory, and any required data is fetched from main memory to be processed and then placed into data registers.
3. Execute the instruction
The CU 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, passing them to the ALU to perform mathematical or logic functions on them, and writing the result back to a register. If the ALU is involved, it sends a condition signal back to the CU.
4. Store results
The result generated by the operation is stored in the main memory, or sent to an output device. Based on the condition of any feedback from the ALU, Program Counter may be updated to a different address from which the next instruction will be fetched.
The cycle is then repeated.
Fetch cycle
Steps 1 and 2 of the Instruction Cycle are called the Fetch Cycle. These steps are the same for each instruction. The fetch cycle processes the instruction from the instruction word which contains an opcode and an operand.
Execute cycle
Steps 3 and 4 of the Instruction Cycle are part of the Execute Cycle. These steps will change with each instruction.
The first step of the execute cycle is the Process-Memory. Data is transferred between the CPU and the I/O module. Next is the Data-Processing uses mathematical operations as well as logical operations in reference to data. Central alterations is the next step, is a sequence of operations, for example a jump operation. The last step is a combined operation from all the other steps.
Initiating the cycle
The cycle starts immediately when power is applied to the system using an initial PC value that is is predefined for the system architecture (in Intel IA-32 CPUs, for instance, the predefined PC value is
0xfffffff0
). 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.)[1]The Fetch-Execute cycle in Transfer Notation
Expressed in register transfer notation:
The registers used above, besides the ones described earlier, are the Memory Address Register (MAR) and the Memory Data Register (MDR), which are used (at least conceptually) in the accessing of memory.
References
- ^ Bosky Agarwal (2004). "Instruction
No comments:
Post a Comment