Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly language (MIPS) difference betweent addi and add

Tags:

assembly

mips

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
like image 684
user2171775 Avatar asked Mar 20 '13 03:03

user2171775


People also ask

What does Addi mean in MIPS?

Add immediate, addi, is another common MIPS instruction that uses an immediate operand. addi adds the immediate specified in the instruction to a value in a register, as shown in Code Example 6.9.

How does add work in assembly?

The add instruction adds together its two operands, storing the result in its first operand. Note, whereas both operands may be registers, at most one operand may be a memory location. The inc instruction increments the contents of its operand by one. The dec instruction decrements the contents of its operand by one.

Why is there no SUBI instruction in MIPS?

The MIPS creators realized that there isn't a need for subi (because you can add a negative number with addi using 2's complement), and they simply made the decision to forego making that instruction. It may have been to conserve the number of instructions, or just simply because it isn't needed.

What are pseudo instructions in MIPS?

Pseudo-instructions are legal MIPS assembly language instructions that do not have a direct hardware implementation. They are provided as a convenience for the programmer. When you use pseudo-instructions in a MIPS assembly language program, the assembler translates them into equivalent real MIPS instructions.


1 Answers

add adds the value in two registers

addi adds an immediate value (constant) to the register

This gives you some example.

like image 94
Oleksi Avatar answered Sep 20 '22 16:09

Oleksi