R3000 Syntax
Syntax |
|
---|---|
rd,rs,rt | The result
of rs and rt
is placed in rd.
The contens of
rs and rt is unchanged. Example: t1=0x00000101 t6=0x00001010 addu v0,t1,t6 (add unsigned) v0=0x00001111 |
rd,rs,immediate | The result
of rs and
immediate is placed in rd.
The contens of rs is unchanged. Example 1: (Arithmetic Immediate) t4=0x00000FFF addi t4,t4,1 (add immediate) t4=0x00001000 Example 2: (Branching) t5=0x0000FACE t6=0x0000FACE beq t5,t6,immediate (if t5=t6 then branch) In case of branching the immediate is to see as a 16 bit displacement, which is used to calculate the address where to continue if the condition is true. |
rd,immediate | This syntax
is used by load immediate and branch instructions.
Example 1: (Load Immediate) t5=undefined. li t5,0xFACE (load immediate) t5=0x0000FACE (Load immediate is not a real machine instruction, later more). Example 2: (Branching) t4=0x00000100 bgez t4,immediate (if t4 >= 0 then branch) In case of branching the immediate is to see as a 16 bit displacement, which is used to calculate the address where to continue if the condition is true. |
rd | Single register
assingment.
Used by mflo, mfh, mtlo, mthi insturctions. Example 1: (Move from HI/LO) lo=0xEA t5=undefined mflo t5 (move from lo) t5=0xEA Example 2: (Move to HI/LO) hi=undefined t7=0x00001975 mthi t7 (move to hi) hi=0x00001975 |
rd,disp(rs) | This syntax
type appears in combination with load and
store
instructions. For both the memory address is calculated: The contents of rs seen as the base register + sign- extended 16bit displacement. Example 1: (Load Instructions) t1=0x1000 (let the byte at address 0x1000 be 0xEA) t2=undefined lbu t2, 0(t1) (load byte unsinged) t2=0x000000EA Example 2: (Store Instructions) t4=0xFACEECAF t1=0x00001000 sw t4,8(t1) (store word) The contents of the memory address 0x00001008 = 0xFACEECAF. |
target | The single
operand target
is used in combination with
unconditional branching. (j - jump/ jal- jump and link) Example: jal dothatforme (Jump and Link) The program stores the return address in ra. Then calculates the address where to branch. Executes then dothatforme. target is a 26bit displacement. |
rx,ra | The multipy
and divide instrucitons use two register
as operands. The destination registers are fixed.(hi, lo) If performing a multiply of two 32bit numbers, the result is going to be 64bit. Two seperate 32 bit register (hi, lo) store the 64bit result. Divide instructions store the quotient and the remainder in this registers. |