Nios II Classic Processor Reference Guide

ID 683620
Date 10/28/2016
Public
Document Table of Contents

3.9.2. Arithmetic and Logical Instructions

Logical instructions support and, or, xor, and nor operations. Arithmetic instructions support addition, subtraction, multiplication, and division operations.
Table 48.  Arithmetic and Logical Instructions
Instruction Description
and
or
xor
nor
These are the standard 32-bit logical operations. These operations take two register values and combine them bit-wise to form a result for a third register.
andi
ori
xori
These operations are immediate versions of the and, or, and xor instructions. The 16-bit immediate value is zero-extended to 32 bits, and then combined with a register value to form the result.
andhi
orhi
xorhi
In these versions of and, or, and xor, the 16-bit immediate value is shifted logically left by 16 bits to form a 32-bit operand. Zeroes are shifted in from the right.
add
sub
mul
div
divu
These are the standard 32-bit arithmetic operations. These operations take two registers as input and store the result in a third register.
addi
subi
muli
These instructions are immediate versions of the add, sub, and mul instructions. The instruction word includes a 16-bit signed value.
mulxss
mulxuu
These instructions provide access to the upper 32 bits of a 32x32 multiplication operation. Choose the appropriate instruction depending on whether the operands should be treated as signed or unsigned values. It is not necessary to precede these instructions with a mul.
mulxsu
This instruction is used in computing a 128-bit result of a 64x64 signed multiplication.