IPR-NIOS Altera, IPR-NIOS Datasheet - Page 193

no-image

IPR-NIOS

Manufacturer Part Number
IPR-NIOS
Description
IP NIOS II MEGACORE RENEW
Manufacturer
Altera
Type
MegaCorer
Datasheet

Specifications of IPR-NIOS

License
Renewal License
Lead Free Status / RoHS Status
Not applicable / Not applicable
Chapter 8: Instruction Set Reference
Instruction Set Reference
add
December 2010 Altera Corporation
Operation:
Assembler Syntax:
Example:
Description:
Usage:
Exceptions:
Instruction Type:
Instruction Fields:
31
30
29
A
28
27
26
25
24
B
rC ← rA + rB
add rC, rA, rB
add r6, r7, r8
Calculates the sum of rA and rB. Stores the result in rC. Used for both signed and unsigned
addition.
Carry Detection (unsigned operands):
Following an add operation, a carry out of the MSB can be detected by checking whether the
unsigned sum is less than one of the unsigned operands. The carry bit can be written to a
register, or a conditional branch can be taken based on the carry condition. Both cases are
shown below.
add rC, rA, rB
cmpltu rD, rC, rA
add rC, rA, rB
bltu rC, rA, label
Overflow Detection (signed operands):
An overflow is detected when two positives are added and the sum is negative, or when two
negatives are added and the sum is positive. The overflow condition can control a conditional
branch, as shown below.
add rC, rA, rB
xor rD, rC, rA
xor rE, rC, rB
and rD, rD, rE
blt rD, r0,label
None
R
A = Register index of operand rA
B = Register index of operand rB
C = Register index of operand rC
23
22
21
20
19
C
18
17
16
15
14
# The original add operation
# rD is written with the carry bit
# The original add operation
# Branch if carry generated
# The original add operation
# Compare signs of sum and rA
# Compare signs of sum and rB
# Combine comparisons
# Branch if overflow occurred
0x31
13
12
11
10
9
0
8
Nios II Processor Reference Handbook
7
6
5
4
0x3a
3
2
1
add
8–7
0

Related parts for IPR-NIOS