Professional Documents
Culture Documents
Instruction Set Architecture: 1-Address Instructions 2-Address Instructions
Instruction Set Architecture: 1-Address Instructions 2-Address Instructions
STORE x (x:=r)
3-address instructions
push pop
ADD
POP x
Points to Consider
• Special-purpose or general purpose?
• Data types?
less clumsy]
Instruction Types
BASIC INSTRUCTIONS
SPECIAL INSTRUCTIONS
RISC machines.
implemented as
LOAD r1, Y
LOAD r2, Z
STORE r3, X
memory.
Mode meaning
immediate Operand = D
R = R + n (n=1|2|4|8)
Auto-decrement R = R – n (n = 1|2|4|8)
Operand = M[R]
instructions.
efficient programs.
and pipelining.
MIPS Architecture
MIPS follows the RISC architecture. It has 32 registers
r0 $zero Always 0
Example 1 f=g+h–i
Example 2. g = h + A[8]
200 200
Word 1 = 4 bytes s3
Word 2 = 4 bytes
Word 3 = 4 bytes
t0
lw
MEMORY
Machine language representations
0 18 8 17 0 32
6 5 5 5 5 6
opcode rs rt address
6 5 5 16
35 19 8 32
6 5 5 16
if (i ==j) f = g + h; else f = g – h
jump
Exit:
The program counter
1028
Instruction 1
1028
1032 Instruction 2
1036 Instruction 3 PC
Instruction 4
CPU
data
data
MEMORY
is a 32-bit word.
of A[i]
switch (k) {
case 0: f = i + j; break;
case 1: f = g + h; break;
case 2: f = g – h; break;
case 3: f = I – j; break;
f=i+j
L0
J Exit
f = g+h
L1
j Exit
Exit
MEMORY
Here is the remainder of the program;
lw $t0, 0($t1)
jr $t0
J Exit
J Exit
J Exit