Instruction Set Architecture
Instruction Set Architecture
LD A ACC M[A]
ADD B ACC ACC + M[B]
ST X M[X] ACC
LD C ACC M[C]
ADD D ACC ACC + M[D]
MUL X ACC ACC x M[X]
ST X M[X] ACC
• ACC, Accumulator ;
• All operations are done between the ACC and memory operand
• Requires 7 instruction instead of three
Zero-address Instructions
X=(A+B)(C+D)
To perform an ADD instruction with zero address, all three addresses in the
instruction must be implied. A conventional way of achieving this goal is to
use structure referred to as stack.
last in, first out (LIFO); son giren ilk çıkar
Data manupulation operations are performed on the stack.
TOS : Top Of the Stack
TOS-1: below TOS
PUSH : loads the stack
PUSH X TOS M[X]
POP : Extract data from stack
POP X M[X] TOS
Zero-address Instructions
X=(A+B)(C+D)
X=(A+B)(C+D)
LD R1,A R1 M[A]
LD R2,B R2 M[B] 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 R2
ST X,R1 M[B] R1
Total 8 instruction
Immediate mode
The operand specified in the instruction itself. An
immadiate mode instruction has an operand field rather
than an address field.
Ex. Initializing registers to a constant value.
ADDRESSING MODES
Register and register-indirect modes
Address field of the instruction may specify either a memory location
(register indirect mode) or a processor register (register mode).
Before using register indirect mode instruction, the programmer must
ensure that the memory address is available in the processor register.
Autoincrement or autodecrement mode is similar to register-indirect
mode, except that the register is incremented or decremented after (or
before) ,ts address value is used to access memory.
ADD (R1)+, 3 M[R1] M[R1] + 3, R1 R1+1
R1 isi initialized to address the first element in the array. 3 ADD
instruction can be executed repeatedly.
ADDRESSING MODES
Direct addressing
mode
Address field of
the instruction
gives the address
of the operand in
memory in a data
transfer or data
manupulation
instruction.
ACC M[ADRS]
ADDRESSING MODES
Direct addressing mode for Branch type instructions
ADDRESSING MODES
Indirect
addressing mode
Address field of
the instruction
gives the address at
which the effective
address is stored in
memory
ADRS=500
M[ADRS]=800
ACC M[800]
ADDRESSING MODES
Relative addressing mode
Effective address=contents of PC + Address part of instruction
PC=250
ADRS=500
PC=252+500=752
ADDRESSING MODES
Index addressing mode
The content of an index register is added to the address part oıf
the instruction to obtain the effective address
Index register may be special CPU register or simply a register
in register file.
PC=250
ADRS=500
PC=252+500=752