Unit 2
Unit 2
The ISA is the set of instructions a CPU understands and executes. It specifies:
The ISA acts as the bridge between machine hardware and the software that runs on it.
Interpretation of Instructions
Each instruction in the ISA consists of an opcode (operation code), which tells the CPU what
operation to perform, and operands, which specify the data to be used in the operation.
The CPU interprets instructions in a cycle that consists of the following steps:
Key Features:
Simple, fixed-length instructions.
Limited instruction set with a focus on frequently used operations.
Most instructions execute in a single clock cycle.
Emphasis on optimizing instruction pipelines.
Advantages:
Simplified hardware and faster execution for each instruction.
Easier to implement efficient pipelining due to the uniform instruction size.
Disadvantages:
Programs may be longer because more instructions are needed to perform complex
operations.
Key Features:
Larger, more complex instruction set, with variable-length instructions.
Instructions can execute complex tasks in a single instruction.
Many instructions take multiple clock cycles.
Advantages:
Shorter programs, as complex instructions perform more tasks.
Can directly execute high-level language constructs.
Disadvantages:
More complex hardware and control unit.
Harder to implement efficient pipelining due to variable instruction length.
1. Accumulator-Based Architecture
2. Register-Based Architecture
3. Stack-Based Architecture
4. Memory/Register Architecture
Addressing Modes
Addressing modes define how an instruction specifies its operands. Common addressing
modes include:
The operand is located in memory, and the instruction directly specifies the memory
address.
Example: LOAD R1, 1000 (Load the value at memory address 1000 into register R1).
The instruction provides a memory address, which points to another memory location that
contains the operand.
Example: LOAD R1, (1000) (Use the value at memory address 1000 as an address to
find the operand).
5. Indexed Addressing Mode
Arithmetic: Perform operations like addition, subtraction, multiplication, and division (e.g.,
ADD , SUB , MUL ).
Logical: Perform bitwise operations like AND, OR, XOR, and NOT (e.g., AND , OR , XOR ).
Move data between CPU registers and memory (e.g., LOAD , STORE , MOV ).
Transfer data between registers.
1. Fixed Format
2. Variable Format
3. Hybrid Format
Combines features of both fixed and variable formats to balance space efficiency and
simplicity.
Pipelining in CPUs
Pipelining is a technique used to increase CPU throughput by overlapping the execution of
multiple instructions. The instruction cycle is divided into stages (e.g., fetch, decode, execute),
and each stage processes a different instruction simultaneously.
1. Basic Concepts
Throughput refers to the number of instructions the CPU can complete in a given time.
Speedup measures how much faster the pipeline executes instructions compared to non-
pipelined execution.
3. Hazards
To manage hazards, techniques such as branch prediction, forwarding, and stalling are
used.
This explanation covers the fundamental concepts of CPU organization, ISA, instruction cycle,
addressing modes, and pipelining, providing a detailed breakdown of each topic.