R

Appendix : PicoBlaze Instruction Set and Event Reference

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.

 

Register sY or

 

Literal kk

Borrow

Borrow In

CARRY

Register sX

 

UG129_aC_04_051604

Figure C-10:SUBCY Instruction

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

114

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

UG129 (v1.1.2) June 24, 2008

Page 114
Image 114
Xilinx UG129 manual Figure C-10SUBCY Instruction