The MIPS R2000
Tom Kelliher, CS26
Sept. 17, 1996
R2000 shows its RISC heritage.
See SPIM S20: A MIPS R2000 Simulator for more information.
- 32 general purpose registers: $0-- $31.
- $0 is constant 0.
- $31 is written with return address on jal.
- Examples of convention uses of remaining registers:
- $29 --- stack pointer.
- $1 --- reserved for assembler.
- $8-- $15 --- caller save.
R2000 is a load/store architecture.
How are large constants constructed?
What is PC-relative mode used for?
- Datum size.
- Datum alignment.
- Three instruction formats.
- Instruction size.
- OpCode field is always most significant 6 bits. Why?
Instruction formats diagram:
- R Format --- Used for ALU instructions.
- I Format --- Used for immediate, branch instructions.
- J Format --- Used for j, jal instructions.
Assembly language provides ``virtual machine.''
See Using the SPIM Simulator for more information.
The R2000 has no condition codes. Why not?
A few branch examples:
The bare machine only has two branch instructions: beq,
- b label --- unconditional branch to label.
- beq Rsrc1, Src2, label --- branch on equal. Rsrc1 must
refer to a register; Src2 is either a register or an immediate.
- bgez Rsrc, label --- Branch on greater than zero.
Write an assembly language program corresponding to the following:
void bsort(int data, int n)
int i, j, temp;
for (i = n - 1; i > 0; --i)
for (j = 0; j < i; ++j)
if (data[j] > data[j + 1])
temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
How are bits set/reset?
How are fields masked?
- jal label --- subroutine call.
- jr reg --- subroutine return.
- Stack frames.
- Parameter passing.
Thomas P. Kelliher
Mon Sep 16 23:30:57 EDT 1996