Specifications

Table Of Contents
Altera Corporation 8–67
October 2007 Nios II Processor Reference Handbook
movhi
movhi
move immediate into high halfword
Operation:
rB
(IMMED : 0x0000)
Assembler Syntax:
movhi rB, IMMED
Example:
movhi r6, 0x8000
Description: Writes the immediate value IMMED into the high halfword of rB, and clears the lower
halfword of rB to 0x0000.
Usage: The maximum allowed value of IMMED is 65535. The minimum allowed value is 0. To
load a 32-bit constant into a register, first load the upper 16 bits using a
movhi
pseudoinstruction. The %hi() macro can be used to extract the upper 16 bits of a
constant or a label. Then, load the lower 16 bits with an
ori instruction. The %lo()
macro can be used to extract the lower 16 bits of a constant or label as shown below.
movhi rB, %hi(value)
ori rB,
rB, %lo(value)
An alternative method to load a 32-bit constant into a register uses the %hiadj() macro
and the
addi instruction as shown below.
movhi rB, %hiadj(value)
addi rB,
rB, %lo(value)
Pseudoinstruction:
movhi is implemented as orhi rB, r0, IMMED.