Reputation: 79
i try to learn the MIPS architecture and i kind of stuck at the R-Type instruction set. i know that in MIPS there is 32 registers each can old 32 bits data. but in R-type the rs rt and rd fields only 5 bits long. so what if i want to do something like add $t0, 4000, 5000? how that instruction is going to fit in R-TYPE or even bigger numbers thanks in advance
Upvotes: 0
Views: 273
Reputation: 62048
There are no ALU instructions to add two constants. You can either add two registers or a register and a constant.
This is what you can do:
li $t0, 4000
addiu $t0, $t0, 5000
or
li $t0, 4000
li $t1, 5000
addu $t0, $t0, $t1
Upvotes: 1