Overview

The following example shows an ADDI instruction being used both with and without a PFX.

Code Example 3: The ADDI Instruction Used with/without a PFX

 

;

Assume %g3 contains the value 0x0041

ADDI %g3,5

;

Add 5 to %g3

 

;

so %g3 now contains 0x0046

PFX %hi(0x1234)

;

Load K with upper 11 bits of 0x1234

ADDI %g3,%lo(0x1234) ;

Add low 5 bits of 0x1234 to %g3

 

;

so the K register contained 0x0091

 

;

and the immediate operand of the ADDI

 

;

instruction contained 0x0011, which

 

;

concatenated together make 0x1234

Besides arithmetic and logical instructions, several other instructions use immediate-mode constants of various widths, and the constant is not modified by the K register. See the description of each instruction in the “32-Bit Instruction Set” for a precise explanation of its operation. Table 10 shows instructions using 5/16-bit immediate values.

Table 10. Instructions Using 5/16-bit Immediate Values

ADDI

AND*

ANDN*

ASRI

 

 

 

 

CMPI

LSLI

LSRI

MOVI

 

 

 

 

MOVHI

OR*

SUBI

XOR*

 

 

 

 

*AND, ANDN, OR, and XOR can only use PFX’d 16-bit immediate values. These instructions act on two register operands if not preceded by a PFX instruction.

1

Overview

Altera Corporation

11

Page 23
Image 23
Excalibur electronic A-MNL-NIOSPROG-01.1 manual Code Example 3 The Addi Instruction Used with/without a PFX