mips assembly question
does anyone know how the CPU det开发者_如何学编程ermines which register should receive the result produced by an instruction?
anyone???
That would depend on the instruction. Many instructions take the destination register as an argument, and others have defined behavior as to where a result is stored. For example, the ADD instruction:
add $d, $s, $t
The result of $s + $t is stored into $d
Here is the full reference
It's encoded in the instruction. For example, "add" takes dest, op1, op2 and does dest = op1+op2.
See Wikipedia's page on MIPS architecture
For basic instructions like an add or a dub you need to define the register it goes into. mul and div instructions put values in hi and lo registers.
精彩评论