PC <- literal value in instruction
PC <- old PC + literal value in instruction
beq $t1, $t2, 100 # PC = PC + 100 if $t1 == $t2
PC <- Rn
ADD Dest, Src1, Src2and use different addressing modes for Src2.
ADD Dest, Src1, literal value
ADD Dest, Src, Register
ADD Dest, Src, memory address
ADD Dest, Src, (Register)
public class IntList { private int x; private IntList next; }although the next variable is strictly a reference, not a pointer: Java stops you from seeing the address.
struct IntList { int x; struct IntList *next; }and the next variable is a pointer which holds an address and which is directly visible to the programmer.
ADD Dest, Src, base(Register)
ADD Dest, Src, BaseRegister(offset)
struct Student { int id; # 32-bit value short age; # 16-bit value char gender; # 8-bit value }
s1.age = 23;
StoreHalfword R5(4), 23as we know the age field is 4 bytes from the address that R5 points to.
ADD Dest, Src, BaseRegister(IndexRegister)
ADD Dest, Src, BaseRegister(IndexRegister)offset
studentlist[57].age = 23;
ADD Dest, Src, +Register or -Register
ADD Dest, Src, Register+ or Register-
ADD Dest, Src, (memory address)
C1 | C0 | Meaning |
0 | 0 | ALU input |
0 | 1 | PC input |
1 | x | Register input |
Phase | AddrBus | R/W | IR | IRwr | ALU1 | ALU2 | ALUop | Regsel | RegInp | Regwr | PC | PCwr |
1 | PC | R | dbus | 1 | xx | xx | xx | xx | xx | 0 | xx | 0 |
2 | xx | R | xx | 0 | immed | $t0 | ADD | xx | xx | 0 | xx | 0 |
3 | ALU | R | xx | 0 | xx | xx | xx | $t1 | dbus | 1 | Incr | 1 |