Addressing Modes
Addressing Modes
Other registers
• Registers in the register file accessible only to
microprograms (R8 to R15)
• Instruction registers (IR)
• Program counter (PC)
• Pipeline registers
• Processor status register (PSR: CVNZ state)
• Stack pointer (SP)
7 8
9 10
11 12
2
One Address Instructions Zero Address Instructions
Defines:
• Restriction on the number of memory addresses in instructions
Memory • Number of operands
Address Two kinds of addressing architecture:
• Memory-to-memory architecture
Push: 100 Only one register - PC
• SP Å SP-1; TOS Å R1 SP=101 All operands from memory, and results to memory
C 101
Many memory accesses
Pop:
B 102
• R1 Å TOS; SP Å SP +1 • Register-to-register (load/store) architecture
R1 A 103 Restrict only one memory address to load/store types, all other
operations are between registers
104 LD R1, A R1 Å M[A]
LD R2, B R2 Å M[B]
ADD R3, R1, R2 R3 Å R1 + R2
LD R1, C R1 Å M[C]
LD R2, D R2 Å M[D]
ADD R1, R1, R2 R1 Å R1 + R2
MUL R1, R1, R3 R1 Å R1 X R3
15
ST X, R1 M[X] Å R1 16
Address field: contains the information needed Implied mode - implied in the opcode, such as stack,
to determine the location of the operands and accumulator
the result of an operation Immediate mode (operand) - a = 0x0801234
Addressing mode: specifies how to interpret Register mode - a=R[b]
the information within this address field, how to Register-indirect mode – a =M[R[b]]
compute the actual or effective address of the Direct addressing mode - a = M[0x0013df8]
data needed. Indirect Addressing mode - a= M[M[0x0013df8]]
Availability of a variety of addressing modes PC-relative addressing – branch etc. (offset + PC)
lets programmers write more efficient code Indexed addressing - a=b[1]
17 18
3
PC=250
Example ADRS or NBR =500 R1=400 Overview
ACC
Addressing Symbolic Register transfer Effective Content
mode conversion address of ACC
250 Opcode Mode
Computer architecture
251
19 20
• Ports
Increment INC Clear CLR Logical shift right SHR
Decrement DEC Set SET Logical shift left SHL
Independent I/O system: address range Add ADD Complement NOT Arithmetic shift right SHRA
assigned to memory and I/O ports are Subtract SUB AND AND Arithmetic shift left SHRL
Multiply MUL OR OR Rotate right ROR
independent from each other Divide DIV Exclusive-OR XOR Rotate left ROL
Memory-mapped I/O system: assign a Add with carry ADDC Clear carry CLRC Rotate right with
carry
RORC
subrange of the memory addresses for Subtract with SUBB Set Carry SETC Rotate left with ROLC
borrow carry
addressing I/O ports Subtract reverse SUBR Complement COMC
carry
Negate NEG
23 24
4
Floating-Point Computation Recall Scientific Notation
decimal point exponent
What can be represented in N bits? (Sign, magnitude)
Floating-Point Numbers
27