Xilinx UG129 Answering Machine User Manual


 
96 www.xilinx.com PicoBlaze 8-bit Embedded Microcontroller
UG129 (v1.1.2) June 24, 2008
Appendix : PicoBlaze Instruction Set and Event Reference
R
COMPARE sX, Operand — Compare Operand with Register sX
The COMPARE instruction performs an 8-bit comparison of two operands, as shown in
Figure C-4. The first operand, sX, is any register and this register is NOT affected by the
COMPARE operation. The second operand is also any register or an 8-bit immediate
constant value. Only the flags are affected by this operation.
Register sX is compared against Operand. The ZERO flag is set when Register sX and
Operand are identical. The CARRY flag is set when Operand is larger than Register sX,
where both Operand and Register sX are evaluated as unsigned integers.
Example
Operand is a register location, sY, or an immediate byte-wide constant, kk.
COMPARE sX, sY; Compare sX against sY.
COMPARE sX, kk; Compare sX against immediate constant, kk.
Pseudocode
if ( Operand > sX ) then
CARRY Å 1
else
CARRY Å 0
endif
if ( sX = Operand ) then
ZERO Å 1
else
ZERO Å 0
endif
PC Å PC + 1
Registers/Flags Altered
Registers: PC only. No data registers affected.
Flags: CARRY, ZERO
Notes
pBlazIDE Equivalent: COMP
The COMPARE instruction is only supported on PicoBlaze microcontrollers for Spartan
®
-3,
Virtex
®
-II, and Virtex-II Pro FPGAs.
Figure C-4: COMPARE Operation
A=B?
AB
B>A?
AB
CARRYZERO
Register sX
Register sY or
Literal kk
UG129_aC_05_051604