Machine Instructions & Addressing Modes
Machine Instructions & Addressing Modes
Machine Instructions
• Definition: A machine instruction is a binary code that a processor executes to
perform a specific operation.
• Instruction Format:
where Opcode specifies the operation, and Operand(s) specify the data or memory
address.
• Types of Instructions:
– Data Transfer: e.g., MOV, LOAD, STORE.
– Arithmetic: e.g., ADD, SUB, MUL, DIV.
– Logical: e.g., AND, OR, XOR, NOT.
– Control Transfer: e.g., JMP, CALL, RET.
– Input/Output: e.g., IN, OUT.
• Instruction Cycle:
PC ← PC + Instruction Length
Ttotal = N · CP I · Tclock
where N is the number of instructions, CPI is cycles per instruction, Tclock is clock
period (s).
Addressing Modes
• Definition: Specifies how the operand of an instruction is accessed (e.g., data location
in memory or registers).
• Common Addressing Modes:
1
– Immediate: Operand is part of the instruction.
Operand = Value
EA = [Register]
EA = PC + Offset
SP ← SP ± 1 (after PUSH/POP)
2
Performance Considerations
• Effective Address Calculation Time: Varies by addressing mode (e.g., immediate
is fastest, indirect is slower).
• Memory Accesses: Indirect and indexed modes may require multiple memory ac-
cesses.
• Instruction Size: Immediate and direct modes increase instruction length due to
address or data fields.
Key Notes
• For GATE, focus on identifying addressing modes from instruction examples.
• Understand the impact of addressing modes on instruction execution time.
• RISC architectures prefer simpler addressing modes (e.g., register, immediate).
• CISC architectures support complex modes (e.g., indirect, indexed).
• Practice problems involving PC updates and effective address calculations.