What does CPU stand for and what is its role?
CPU stands for Central Processing Unit. It is the processor that follows the fetch–decode–execute cycle to process instructions.
What is the fetch–decode–execute cycle?
It is the cycle that the CPU follows from boot-up until shutdown to process instructions. It has three main stages: fetch, decode, and execute.
Name the three main stages of the instruction cycle.
Fetch, decode, and execute.
In simple CPUs, how are instructions processed?
In simple CPUs, instructions are processed sequentially, one after another.
What is an instruction pipeline?
An instruction pipeline is a technique used in modern CPUs where the next instruction starts processing before the previous one finishes, by breaking the cycle into separate steps and processing them concurrently.
What is the program counter (PC)?
The program counter is a register that holds the memory address of the next instruction to be executed.
What happens to the program counter after each instruction copy to the MAR?
After each instruction copy to the MAR, the PC can increment to the next sequential instruction, jump to a specified pointer, or branch conditionally to a specified pointer.
What is the memory address register (MAR)?
The MAR stores the address of the location of the instruction. It acts as an address buffer pointing to locations in memory.
What is the memory data register (MDR)?
The MDR temporarily holds instructions read from the address in MAR. It is a two-way register, transferring data between memory and CPU.
What is the current instruction register (CIR)?
The CIR (also called instruction register, IR) temporarily holds the instruction so the CPU can decode it and produce control signals for execution.
What is the role of the control unit (CU)?
The control unit decodes the instruction in the CIR and sends signals to other components like the ALU, memory, or FPU to execute the instruction.
What does the arithmetic logic unit (ALU) do?
The ALU performs arithmetic and logical operations based on specific opcodes in the instruction.
What happens during the fetch stage?
The CPU retrieves the next instruction from memory. The PC provides the address, which is copied to MAR, memory is read, data goes to MDR, then to CIR. The PC increments to point to the next instruction.
What happens during the decode stage?
The control unit interprets the instruction in the CIR, determines what operations and operands are needed, and sends signals to prepare components like the ALU or FPU.
What happens during the execute stage?
The actual operation is carried out by the CPU's functional units. The ALU may perform arithmetic/logical operations, data may be read/written to memory, and results are stored. The PC might branch based on ALU output.
What is an interrupt?
An interrupt causes the CPU to jump to an interrupt service routine, execute it, and then return to the instruction it was executing. In some cases, an interrupted instruction is re-executed after return.
How does the CPU start executing instructions?
The first instruction cycle begins when power is applied, with an initial PC value predefined by the architecture. This address typically points to ROM, which starts booting the operating system.
In the fetch stage, what is the role of the PC?
The PC contains the address of the instruction to be fetched, which is copied to the MAR.
In the fetch stage, what happens after the address is copied to MAR?
The CU sends a read signal to the control bus, the memory at that address is read, and the data is placed on the data bus.
In the fetch stage, what happens to the data on the data bus?
The data is transferred to the CPU via the data bus and loaded into the MDR. Then the PC increments by one.
In the fetch stage, what happens after the data is in the MDR?
The contents of the MDR are copied into the CIR, where the instruction opcode and data operand can be decoded.
What does the decode stage determine?
It determines what instruction is to be performed and how many operands are needed. The opcode is decoded and moved to appropriate registers.
What performs the decoding in the CPU?
Binary decoders in the control unit perform the decoding.
What is an addressing mode?
An addressing mode is a way an architecture specifies how to determine the effective address for operands.