6_2_Addressing_mode
Computer Composition Chapter VI: Instruction System Principles
6.1 Basic Concepts
Introduction to the fundamental concepts related to computer instruction systems.
6.2 Addressing Methods
Different techniques through which instructions locate operands or next instruction addresses.
6.3 RISC vs. CISC
Overview of the differences between RISC (Reduced Instruction Set Computer) and CISC (Complex Instruction Set Computer) architectures.
Addressing Methods
Instruction Addressing
Refers to the method for determining the address for the next instruction in a sequence.
The address of the next instruction is typically given by the Program Counter (PC).
Key Concepts in Instruction Addressing
Opcode (OP): The part of the instruction that specifies the operation to be performed.
Address Code: May involve specifying multiple addresses depending on the instruction structure.
Instruction Structure: An instruction usually consists of an opcode and its corresponding address codes.
Addressing Mode: The method used to locate an operand or an instruction's address in memory.
Sequential Addressing
Instructions are usually stored sequentially in memory.
If the address of the first instruction is known, the next instruction's address can be calculated by adding the instruction length to the current address.
Branching and Jump Instructions
Branch Instructions: Change the execution order based on certain conditions.
Jump Instructions: Change the execution order unconditionally.
Program Counter (PC)
Holds the address of the next instruction to be executed.
The value in PC increments by one (or by the length of the instruction) after each instruction fetch.
Instruction Formats
Fixed-Length Instruction Word Structure
Memory is accessed word by word, typically with an instruction length of 16 bits (2 bytes).
Example sequence with opcodes and address codes (simplified):
LDA 1000: Load Accumulator with data from memory address 1000.
ADD 1001: Add data from memory address 1001 to the Accumulator.
JMP 7: Jump to instruction at address 7.
Overview of Addressing Types
Immediate Addressing
The operand itself is represented in the instruction (denoted by
#).Advantages include fast execution as no additional memory access is required.
Direct Addressing
The address field in the instruction directly points to the operand’s location in memory.
This method offers simplicity but may have limited addressing range based on the bits allocated.
Indirect Addressing
The address field points to another memory location that contains the effective address of the operand.
It allows accessing a broader range of memory but requires multiple memory accesses.
Register Addressing
Operand address is directly given as a register identifier.
Benefits include a fast execution phase since it does not access main memory.
Stack Addressing
Uses the stack pointer (SP) to implicitly reference operands stored on a stack.
Operands are accessed in a Last In, First Out (LIFO) manner.
Implicit Addressing
The operand’s address is implied by the instruction itself (e.g., accumulator-based instructions).
Relative Addressing
The effective address is computed using the program counter (PC) and an offset specified in the instruction.
Facilitates code relocation and supports branching instructions.
RISC vs. CISC
RISC (Reduced Instruction Set Computer)
Characterized by a small, highly optimized instruction set with fixed instruction formats.
Focuses on executing instructions in fewer clock cycles, often one cycle per instruction.
CISC (Complex Instruction Set Computer)
Contains a large variety of instructions, many addressing modes, and instruction formats leading to more complicated instruction decoding.
Typically takes multiple clock cycles to execute most instructions.
Comparison of RISC and CISC
RISC simplifies command sets and shifts processing to register, while CISC tends toward complex instructions that appeal to high-level language support.
Compilation and optimization strategies vary, with RISC being more efficient in runtime execution due to its streamlined instructions.