Comparison Instructions; Shift And Rotate Instructions - Altera Nios II User Manual

Hide thumbs Also See for Nios II:
Table of Contents

Advertisement

Chapter 3: Programming Model
Instruction Set Categories

Comparison Instructions

The Nios II architecture supports a number of comparison instructions. All of these
compare two registers or a register and an immediate value, and write either one (if
true) or zero to the result register. These instructions perform all the equality and
relational operators of the C programming language.
Table 3–44. Comparison Instructions
Instruction
==
cmpeq
!=
cmpne
signed >=
cmpge
unsigned >=
cmpgeu
signed >
cmpgt
unsigned >
cmpgtu
unsigned <=
cmple
unsigned <=
cmpleu
signed <
cmplt
unsigned <
cmpltu
cmpeqi
cmpnei
cmpgei
cmpgeui
These instructions are immediate versions of the comparison operations. They compare the value of
cmpgti
a register and a 16-bit immediate value. Signed operations sign-extend the immediate value to
cmpgtui
32-bits. Unsigned operations fill the upper bits with zero.
cmplei
cmpleui
cmplti
cmpltui

Shift and Rotate Instructions

The following instructions provide shift and rotate operations. The number of bits to
rotate or shift can be specified in a register or an immediate value.
Table 3–45. Shift and Rotate Instructions
Instruction
The rol and roli instructions provide left bit-rotation. roli uses an immediate value to specify the number
rol
of bits to rotate. The ror instructions provides right bit-rotation.
ror
roli
There is no immediate version of ror, because roli can be used to implement the equivalent operation.
sll
These shift instructions implement the << and >> operators of the C programming language. The sll, slli,
slli
srl, srli instructions provide left and right logical bit-shifting operations, inserting zeros. The sra and
sra
srai instructions provide arithmetic right bit-shifting, duplicating the sign bit in the most significant bit.
srl
slli, srli and srai use an immediate value to specify the number of bits to shift.
srai
srli
February 2014 Altera Corporation
Description
Description
3–59
Nios II Processor Reference Handbook

Advertisement

Table of Contents
loading

Table of Contents