Processor organization
Processor organization
PROCESSOR ORGANIZATION
The CPU with the System Bus :
The control unit fetches an instruction from memory and decodes it to determine the operation
to be performed and the operands involved.
The control unit sends control signals to the ALU and registers to perform the required
operation.
The ALU processes the data and stores the result in a register.
The control unit sends the result to memory or an input/output device using the data bus.
The control unit fetches the next instruction and repeats the process until the program is
completed.
The organization of the processor, let us consider the requirements placed on the processor,
the things that it must do:
■ Fetch instruction: The processor reads an instruction from memory (register, cache, main
memory).
■ Interpret instruction: The instruction is decoded to determine what action is required.
■ Fetch data: The execution of an instruction may require reading data from memory or an I/O
module.
The control unit sends an instruction to the ALU, specifying the operation to be performed and
the operands involved.
The ALU uses its components (shifter, complementer, arithmetic and Boolean logic) to
perform the operation.
The result of the operation is stored in a register.
The ALU also sets the status flags to indicate the result of the operation.
The control unit uses the status flags to determine the next steps in the execution of the
instruction.
User-Visible Registers :
A user-visible register is one that may be referenced by means of the machine
language that the processor executes. We can characterize these in the following categories:
■ General purpose :- General-purpose registers can be assigned to a variety of functions by the
programmer. Sometimes their use within the instruction set is orthogonal to the operation.
■ Data :- Data registers may be used only to hold data and cannot be employed in the
calculation of an operand address.
■ Address :- Address registers may themselves be somewhat general purpose, or they may be
devoted to a particular addressing mode
■ Condition codes :- Condition codes are bits set by the processor hardware as the result of
operations.
2. Execute:
The CPU decodes the instruction to determine the operation to be performed and the
operands involved.
The CPU executes the instruction using its arithmetic and logic unit (ALU) and registers.
3. Indirect:
If the instruction requires indirect addressing, the CPU fetches the effective address of the
operand from memory.
The effective address is used to access the actual data.
4. Interrupt:
If an interrupt occurs during the execution of an instruction, the CPU suspends the
current instruction and jumps to an interrupt service routine (ISR).
The ISR handles the interrupt and then returns control to the interrupted instruction.
■ Decode instruction (DI): Determine the opcode and the operand specifiers.
■ Calculate operands (CO): Calculate the effective address of each source operand. This may involve
displacement, register indirect, indirect, or other forms of address calculation.
■ Fetch operands (FO): Fetch each operand from memory. Operands in registers need not be fetched.
■ Execute instruction (EI): Perform the indicated operation and store the result, if any, in the specified
destination operand location.
Conditional Branch: A branch instruction that changes the program flow based on a
condition.
Pipeline Stalls: When a conditional branch is encountered, the pipeline may stall while the
branch condition is evaluated and the target address is determined.
Branch Penalty: The number of cycles lost due to a pipeline stall caused by a branch.
Instruction 4: In this example, Instruction 4 is a conditional branch.
Pipeline Stall: After Instruction 4, the pipeline stalls for three cycles (cycles 5, 6, and 7) while
the branch condition is evaluated and the target address is determined.
Instruction 15: If the branch is taken, Instruction 15 is fetched and executed. If the branch is
not taken, Instructions 5, 6, and 7 are discarded.
Branch Prediction: Modern CPUs often use branch prediction techniques to try to predict
whether a branch will be taken or not, which can help reduce the impact of branch penalties.
This diagram shows the ideal operation of the pipeline without any branches.
Each instruction moves through the pipeline stages (FI, DI, CO, FO, EI, WO) in
consecutive cycles.
The pipeline is fully utilized, with instructions being executed in every cycle.
Decode (DI):
The fetched instruction is decoded to determine its operation and the operands involved.
The processor identifies the type of instruction (e.g., arithmetic, logical, load, store) and
locates the necessary data.
If the instruction requires operands from memory, their addresses are calculated.
This involves determining the base address and offset based on the instruction's
addressing mode.
Execute (EI):
Scalar Organization:
Superscalar Organization:
Superpipelined:
Superscalar:
Allows multiple instructions to be executed in parallel, even if they are not consecutive.
Uses multiple execution units to perform different operations simultaneously.
More complex and expensive to design and build than superpipelined processors.
Comparison:
Limitations
True Data Dependency: One instruction needs the result of a previous instruction.
Procedural Dependency: Execution depends on the outcome of a previous instruction
(e.g., branch).
Resource Conflicts: Multiple instructions compete for the same resource.
Output Dependency: Two instructions write to the same location.
Antidependency: An instruction reads before a previous instruction writes.
Instruction-level parallelism exists when instructions in a sequence are independent and thus can be
executed in parallel by overlapping.
1 2
ILP is achieved in Ex1
Machine parallelism is a measure of the ability of the processor to take advantage of instruction-level
parallelism. Machine parallelism is determined by the number of instructions that can be fetched and
executed at the same time (the number of parallel pipelines) and by the speed and sophistication of the
mechanisms that the processor uses to find independent instructions.
Questions of Unit 4
-------------------------------------------------END------------------------------------------------------