tags:

views:

37

answers:

3

does anyone know how the CPU determines which register should receive the result produced by an instruction?

anyone???

+1  A: 

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

Ed Swangren
A: 

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

Berry
A: 

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.

Nathan Z