MIPS
Learned in CS241E.
MIPS is a family of RISC-V instruction set architectures (ISA) developed by MIPS Computer Systems.
Basic Instructions
For lis
, notice that it also increments pc
by an additional 4. If we don’t do this, the word right after that we are supposed to load would be interpreted as an instruction, and that could be an unrecognized instruction.
lw
Load Word copies a word from an address in memory into registersw
Store Word copies a word from register t into an address in memory- memory address is computed by adding constant to value of register → makes it easy to access memory addresses at fixed constant offsets from some address held in register
- The Jump Register copies the value of register s into the program counter (PC) register. The next instruction that will execute after the Jump Register instruction will be the instruction whose address was in register
s
jalr
The Jump And Link Register instruction does the same thing, but in addition, it saves the previous value of the program counter into register 31. Therefore, after performing a Jump And Link Register instruction, executing a Jump Register 31 instruction will restore the program counter back to the word immediately after the Jump And Link Register instruction. This instruction will later become our basic building block for implementing procedure calls, since a procedure must return to the point that it was called from when it finishes executing.
Technique 2: Variables
Technique 3: Use temp variables
in ECE222: MIPS = Millions of instructions per second