Propeller Manual

Table Of Contents
MOVD – Assembly Language Reference
MOVD
Instruction: Set a register’s destination field to a value.
MOVD Destination, # Value
Result: Value is stored in Destination’s d-field (bits 17..9).
Destination (d-field) is the register whose destination field (bits 17..9) is set to Value’s
value.
Value (s-field) is a register or a 9-bit literal whose value is stored into Destination’s d-
field.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– Z Result C Result Result Clocks
010101 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
$0003_FE00; 261,632 0 1
$FFFF_FFFF; -1 $0000_01FF; 511 -
-
wz wc
$FFFF_FFFF; -1 0 0
$FFFF_FFFF; -1 $0000_0000; 0 -
-
wz wc
$FFFC_01FF; -261,633 0 0
Explanation
MOVD copies the 9-bit value of Value into Destination’s d-field (destination field) bits 17..9.
Destination’s other bits are left unchanged. This instruction is handy for setting certain
registers like
CTRA and VCFG, and for updating the destination field of instructions in self-
modifying code.
For self-modifying code, ensure that at least one other instruction is executed between a
MOVD
instruction and the target instruction that MOVD modifies. This gives the cog time to write
MOVD’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.
Page 312 · Propeller Manual v1.1