Lec 4-2
Lec 4-2
Lecture 6
Instruction Set Architecture (ISA)
2
3
4
5
Instructions
software
instruction set
hardware
◼ MIPS instructions
add t0, g, h
add t1, i, j
sub f, t0, t1
Instruction
Opcode Operand
Direct Addressing
◼ Address field contains address of operand
◼ e.g. ADD A
❑ Add contents of cell A to accumulator
❑ Look in memory at address A for operand
Instruction
Opcode Address A
Memory
Operand
Indirect Addressing (1)
◼ Memory cell pointed to by address field contains the
address of (pointer to) the operand.
◼ EA = (A)
❑ Look in A, find address (A) and look there for operand
Opcode Address A
Memory
Pointer to operand
Operand
Indirect Addressing (2)
◼ Large address space: 2n where n = word length
◼ Hence slower
Register Addressing (1)
◼ Operand is held in register named in address filed
◼ EA = R
Instruction
Opcode Register Address R
Registers
Operand
Register Addressing (2)
◼ No memory access
◼ EA = (R)
Instruction
Opcode Register Address R
Memory
Registers
Instruction
Opcode Register R Address A
Memory
Registers
◼ R = Program counter, PC
◼ EA = A + (PC)
◼ R = displacement
◼ EA = A + R
◼ Includes opcode
Instruction 1 Instruction 1
Instruction 2 Instruction 2
48
Write an assembly language program
◼ To write a program using ISA we should know the
addressing mode of the processor.
49
Example
◼ Write an assembly code for execute the following
statements using accumulator addressing mode,
register addressing mode, indirect mode, stack
mode and register indirect and store the result in
memory which has the address stored in AR:
➢ F=A+B+5
➢ X=A+(B*4)
➢ Z=A*B*C+7
50
51
F=A+B+5
◼ Load ACC, A
◼ Add B
◼ Add 5
◼ Store M[AR]
52
F=A+B+5
◼ Load R0, A
◼ Load R1, B
◼ Load R2, 5
◼ Add R0,R1
◼ Add R0,R2
◼ Move M[AR],R0
53
54