Xilinx UG129 manual Addcy sX, Operand -Add Operand to Register sX with Carry

Models: UG129

1 124
Download 124 pages 29.5 Kb
Page 92
Image 92

R

Appendix : PicoBlaze Instruction Set and Event Reference

Pseudocode

sX Å (sX + Operand) mod 256; always an 8-bit result

if ( (sX + Operand) > 255 ) then

CARRY Å 1 else

CARRY Å 0 endif

if ( ((sX + Operand) = 0) or ((sX + Operand) = 256) ) then

ZERO Å 1 else

ZERO Å 0 endif

PC Å PC + 1

Registers/Flags Altered

Registers: sX, PC

Flags: CARRY, ZERO

ADDCY sX, Operand —Add Operand to Register sX with Carry

The ADDCY instruction performs an addition of two 8-bit operands and adds an additional ‘1’ if the CARRY flag was set by a previous instruction, as shown in Figure C-2. The first operand is any register, which also receives the result of the operation. A second operand is also any register or an 8-bit constant value. Flags are affected by this operation.

 

Register sY or

 

Literal kk

Carry Out

Carry In

CARRY

Register sX

 

UG129_aC_02_051604

Figure C-2:ADDCY Instruction

Example

Operand is a register location, sY, or an immediate byte-wide constant, kk.

ADDCY sX, sY; Add register. sX = sX + sY + CARRY

ADDCY sX, kk; Add immediate. sX = sX + kk + CARRY

Description

Operand and CARRY flag are added to register sX. The ZERO and CARRY flags are set appropriately.

92

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

UG129 (v1.1.2) June 24, 2008

Page 92
Image 92
Xilinx UG129 manual Addcy sX, Operand -Add Operand to Register sX with Carry