Xilinx UG129 Answering Machine User Manual


 
114 www.xilinx.com PicoBlaze 8-bit Embedded Microcontroller
UG129 (v1.1.2) June 24, 2008
Appendix : PicoBlaze Instruction Set and Event Reference
R
Pseudocode
sX Å (sX – Operand) mod 256; always an 8-bit result
if ( (sX – Operand) < 0 ) then
CARRY Å 1
else
CARRY Å 0
endif
if ( (sX - Operand) = 0 ) then
ZERO Å 1
else
ZERO Å 0
endif
PC Å PC + 1
Registers/Flags Altered
Registers: sX, PC
Flags: CARRY, ZERO
SUBCY sX, Operand —Subtract Operand from Register sX with
Borrow
The SUBCY instruction performs an 8-bit subtraction of two operands and subtracts an
additional ‘1’ if the CARRY (borrow) flag was set by a previous instruction, as shown in
Figure C-10. The first operand is any register, which also receives the result of the
operation. The second operand is also any register or an 8-bit constant value. Flags are
affected by this operation.
Examples
Operand is a register location, sY, or an immediate byte-wide constant, kk.
SUBCY sX, sY; Subtract register. sX = sX - sY - CARRY
SUBCY sX, kk; Subtract immediate. sX = sX - kk - CARRY
Figure C-10: SUBCY Instruction
Borrow Borrow In
UG129_aC_04_051604
Register sX
Register sY or
Literal kk
CARRY