Program Flow Control

R

The JUMP, CALL, and RETURN instructions are all conditionally executed, depending if a condition is specified and specifically whether the CARRY or ZERO flags are set or cleared. Table 3-6summarizes the possible conditions. The condition is specified as an instruction operand. The instruction is unconditionally executed if no condition is specified.

Table 3-6:Instruction Conditional Execution

Condition

 

Description

 

 

<none>

Always true. Execute instruction unconditionally.

 

 

 

C

CARRY = 1.

Execute instruction if CARRY flag is set.

 

 

 

NC

CARRY = 0.

Execute instruction if CARRY flag is cleared.

 

 

Z

ZERO = 1. Execute instruction if ZERO flag is set.

 

 

NZ

ZERO = 0. Execute instruction if ZERO flag is cleared.

 

 

 

JUMP

The JUMP instruction is conditional and executes only if the specified condition, listed in Table 3-6, is met. If the condition is false, then the conditional JUMP instruction has no effect other than requiring two clock cycles to execute. No registers or flags are affected.

If the conditional JUMP instruction is executed, then the PC is loaded with the address of the specified label, which is computed and assigned by the assembler. The PicoBlaze processor then executes the instruction at the specified label.

The JUMP instruction does not interact with the CALL/RETURN stack.

Arrow ‘A’ in Figure 3-27illustrates the program flow during a JUMP instruction. When the PicoBlaze microcontroller executes the JUMP C, skip_over instruction, it first checks if the CARRY bit is set. If the CARRY bit is set, then the address of the skip_over label is loaded into the PC. The PicoBlaze microcontroller then jumps to and executes the instruction located at that address. Program flow continues normally from that point.

PicoBlaze 8-bit Embedded Microcontroller

www.xilinx.com

37

UG129 (v1.1.2) June 24, 2008

Page 37
Image 37
Xilinx UG129 manual Program Flow Control, 6Instruction Conditional Execution Description