Xilinx UG129 manual Examples

Models: UG129

1 124
Download 124 pages 29.5 Kb
Page 94
Image 94

R

Appendix : PicoBlaze Instruction Set and Event Reference

Examples

AND sX, sY ; Logically AND the individual bits of register sX with ; the corresponding bits in register sY

AND sX, kk ; Logically AND the individual bits of register sX with ; the corresponding bits in the immediate constant kk

Pseudocode

;logically AND the corresponding bits in sX and the Operand for (i=0; i<= 7; i=i+1)

{

sX(i) Å sX(i) AND Operand(i)

}

CARRY Å 0

if (sX = 0) then

ZERO Å 1 else

ZERO Å 0 end if

PC Å PC + 1

Registers/Flags Altered

Registers: sX, PC

Flags: ZERO, CARRY is always 0

CALL [Condition,] Address — Call Subroutine at Specified Address, Possibly with Conditions

The CALL instruction modifies the normal program execution sequence by jumping to a specified program address. Each CALL instruction must specify the 10-bit address as a three-digit hexadecimal value or a label that the assembler resolves to a three-digit hexadecimal value.

The CALL instruction has both conditional and unconditional variants. A conditional CALL is only performed if a test performed against either the ZERO flag or CARRY flag is true. If unconditional or if the condition is true, the CALL instruction pushes the current value the PC to the top of the CALL/RETURN stack. Simultaneously, the specified CALL location is loaded into the PC.

A subroutine function must exist at the specified address. The subroutine function requires a RETURN instruction to return from the subroutine.

The CALL instruction does not affect the ZERO or CARRY flags. However, if a CALL is performed, the resulting subroutine instructions may modify the flags.

Examples

CALL

MYSUB; Unconditionally call MYSUB

subroutine

CALL C,

MYSUB; If CARRY flag set, call MYSUB subroutine

CALL NC,

MYSUB; If CARRY flag not

set, call MYSUB subroutine

CALL Z,

MYSUB;

If

ZERO

flag

set,

call MYSUB subroutine

CALL NZ,

MYSUB;

If

ZERO

flag

not set, call

MYSUB subroutine

94

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

 

 

UG129 (v1.1.2) June 24, 2008

Page 94
Image 94
Xilinx UG129 manual Examples