18
votes

I'm trying to understand the difference between using addi and add, does both do the same thing?

e.g

addi  $t0, $0, $a0
add  $t0 , $0, $a0
2

2 Answers

27
votes

add adds the value in two registers

addi adds an immediate value (constant) to the register

This gives you some example.

3
votes

Adding to answer :

Add syntax looks like this :

Add rd , rs , rt // look difference rs , rt here

i.e rd <--- rs + rt

bit(31)|operation code| rs | rt | rd |shift amount|function code| bit (0)

While addi :

Addi rt , rd , immediate // look difference of rt , rd compare to ADD

i.e rd <--- rt + immediate

bit(31)|operation code|rs|rt|immediate(16 bits)| bit(0)