Instruction Formats
Each instruction is placed on a separate line in the following format:
label: mnemonic operands #comment
- label (optional):
The colon is NOT part of the label.
Must be unique within the assembly language file.
Cannot be an opcode.
- mnemonic:
Opcode for a MIPS instruction or directive
- operands:
Other information (registers, memory addresses, values, etc.) needed by the instruction
- # comment:
Anything after the # on a line is ignored by the assembler.
All MIPS instructions are 32 bits in length and consist of three types:
- R-type,
which is the most common; it specifies an opcode, up to two source and one destination registers, and a shift amount for shift.
It includes arithmetic and logic, shift, and register direct jump instructions.
- I-type,
which is used for immediate instructions.
- J-type,
which is used for the unconditional jump instructions.
Conditional branch is using I-type format.
|
|
|