Computer Architecture Questions
The fetch-decode-execute cycle is the fundamental process that a CPU (Central Processing Unit) follows to execute instructions. It consists of three main steps:
1. Fetch: The CPU fetches the next instruction from the memory. The program counter (PC) holds the address of the next instruction to be fetched. The instruction is then loaded into the instruction register (IR).
2. Decode: The CPU decodes the fetched instruction to determine the operation to be performed and the operands involved. This step involves breaking down the instruction into its constituent parts, such as the opcode (operation code) and any associated addressing modes.
3. Execute: The CPU executes the decoded instruction by performing the specified operation on the operands. This step may involve accessing data from memory, performing arithmetic or logical operations, or transferring data between registers.
After the execution of an instruction, the program counter is updated to point to the next instruction in memory, and the cycle repeats with the fetch step. This cycle continues until the CPU is halted or the program is completed.