Propeller Manual

Table Of Contents
3: Assembly Language Reference – MOVI
MOVI
Instruction: Set a register’s instruction and effects fields to a value.
MOVI Destination, # Value
Result: Value is stored in Destination’s i-field and effects-field (bits 31..23).
Destination (d-field) is the register whose instruction and effects fields (bits 31..23) are
set to Value’s value.
Value (s-field) is a register or a 9-bit literal whose value is stored into Destination’s
instruction and effects field.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– Z Result C Result Result Clocks
010110 001i 1111 ddddddddd sssssssss
Result = 0 --- Written 4
Concise Truth Table:
In Out
Destination Source Z
C
Effects
Destination Z C
$0000_0000; 0 $0000_0000; 0 -
-
wz wc
$0000_0000; 0 1 0
$0000_0000; 0 $0000_01FF; 511 -
-
wz wc
$FF80_0000; -8,388,608 0 1
$FFFF_FFFF; -1 $0000_01FF; 511 -
-
wz wc
$FFFF_FFFF; -1 0 0
$FFFF_FFFF; -1 $0000_0000; 0 -
-
wz wc
$007F_FFFF; 8,388,607 0 0
Explanation
MOVI copies the 9-bit value of Value into Destination’s instruction and effects fields bits
31..23. Destination’s other bits are left unchanged. This instruction is handy for setting
certain registers like
CTRA and VCFG, and for updating the instruction and effects fields of
instructions in self-modifying code.
For self-modifying code, ensure that at least one other instruction is executed between a
MOVI
instruction and the target instruction that MOVI modifies. This gives the cog time to write
MOVI’s result before it fetches the target instruction for execution; otherwise, the as-yet-
unmodified version of the target instruction would be fetched and executed.
If the
WZ effect is specified, the Z flag is set (1) if Value equals zero. The result is written to
Destination unless the
NR effect is specified.
Propeller Manual v1.1 · Page 313