MIPS Assembler Instruction parameters

Posted by Martin K. on Stack Overflow See other posts from Stack Overflow or by Martin K.
Published on 2010-05-10T23:01:36Z Indexed on 2010/05/10 23:04 UTC
Read the original article Hit count: 399

Filed under:
|

Hi,

why does such a instruction as

mul   $t1, $v0 , 4 

evaluates as expected. But

mul   $t1, 4 , $v0 

results in a syntax error!

I wonder why the first one works, because mul only works with registers per default, so I expect that only a solution like this will be workin

li   $t1, 4             # set $t1 = 4
mul   $t1, $v0 , $t1      # set $t1 = 4 * n

I'm using the SPIM simulator.

© Stack Overflow or respective owner

Related posts about mips

Related posts about assembler