Types of Addressing Modes
De Wijesinghe H.R.P.S – (210107X)
Multiple forms of addressing are generically called addressing modes.It
refers to the way in which the operands are specified in machine
instructios.
Pc relative addressing mode
• A value from program memory that is close to the current
instruction can be loaded into a register using the PC-relative
addressing mode.
• Effective address of the operand is gain by adding the content of
program counter with the address part of the instruction
Instructions :-
jal => rd = PC + imm
auipc => rd = PC + imm << 12
The "JAL" instruction in assembly language, often used in RISC
architectures, stands for "Jump and Link." It's a command that
serves two purpose. It lets the program jump to a specific location
in its code. At the same time, it saves the current location (return
address) in a special register.
AUIPC stands for "Add Upper Immediate to PC." The purpose of
the "AUIPC" instruction is to calculate a memory address by
adding an immediate value shifted left by 12 bits to the current
value of the program counter (PC).
Register Offset Addressing
Register offset addressing mode is a memory addressing mode used in
computer architectures where an operand's memory address is
calculated by adding an offset to the value stored in a specific register.
Instructions :-
jarl => rd = PC + 4 ; PC = rs1 + imm
addi => rd = rs1 + imm
Jump and link register (jalr) is used to address given in rs1 into register +
immediate_offset.
Addi instruction is used to update the value in register.
Absolute addressing
Absolute addressing is a memory addressing mode in computer
programming and assembly languages where a memory operand is
specified by its exact, fixed memory address. In this mode, the actual
address of the data or instruction is provided directly in the instruction,
without any calculations or offsets involved.
Instructions -:
lui => rd =imm<<12
"LUI" stands for "Load Upper Immediate." This instruction is used to
load a 20-bit immediate value into the upper bits of a register.
References –
https://www.gatevidyalay.com/addressing-modes/
Computer organization and design (The hardware/Software
Interface: RISC-V Edition) - pg 244
https://www.geeksforgeeks.org/addressing-modes/