Pergunta

I my friends,

I'm working on a compiler program so, I can't understand that while I'm passin 3 code address to Mips Assembly, it gets an error in simple sums like those:

addi $t0 , 1 ,1

it only accepts :

addi temp , temp , 1

How can I sum two integers? Do I have to store the first "1" in a temporary?

Thanks a lot

Foi útil?

Solução

Yes. Each instruction has only 32-bits to encode the operation, the registers and in your case the immediate value. The immediate value alone consumes 16-bits, so there aren't any instructions with 2 immediates. I also question why you would ever need two immediate values. If you have two constants that you want to put into code, then compute the answer and put the answer into the instruction that you code.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top