Flow Control Opcodes
- Updated2025-10-09
- 11 minute(s) read
Jump
Jump opcodes are analogous to if/else operations.
| Syntax | Parameters | Descriptions |
|---|---|---|
| jump(label) | label is any local label within the pattern file or any label exported from another pattern file. | Executes the current vector and then executes the vector the label specifies. Execution continues from the vector the label defines. |
|
jump_if([!]failed,
label)
jump_if([!]seqflag, label) jump_if([!]matched, label) jump_if([!]trigger, |
label is any local label within the pattern file or any label
exported from another pattern file. Valid values for seqflag include seqflag0, seqflag1, seqflag2, and seqflag3. The optional ! character inverts the failed, seqflag, or matched parameter. Valid values for trigger include trig0, trig1, trig2, and trig3. Note matched is not the same evaluation as
!failed. !matched is not the same evaluation as
failed. Refer to the descriptions of the
matched and failed parameters for more
information. Note When using one of the following,
extra steps are required.
|
Executes the current vector and then jumps to the specified label when the first parameter is true. You can also use an optional ! operator to invert the parameter.
Note Refer to the
Related reference section at the end of this topic for a link to more information about pattern responses to comparisons.
|
Example
sample_timeset L; // For the comments below, assume that no failed comparisons have occurred before this vector. // This vector will not fail even if the previous vector evaluates to false // because it does not meet the required minimum number of cycles to wait. jump_if(failed, error) sample_timeset X; continue: repeat(78) sample_timeset X; // Pipeline delay must be at least 80 cycles after the last failure. // If it is less than 80, the !failed condition is always true. // If it is 80 or greater, the !failed condition reflects the result of the comparison. // The jump to the end label executes if the !failed condition is true. If the failed condition is asserted // because of a comparison 80 cycles ago, the pattern does not branch to the end label and continues to the next // vector with the error label. jump_if(!failed, end) sample_timeset X; error: halt sample_timeset X; end: halt sample_timeset X;
Repeat, Loop, and Subroutine
Subroutine opcodes are analogous to function calls.
| Syntax | Parameters | Description |
|---|---|---|
|
repeat(numeric)
repeat(register) |
numeric is the repeat count. Valid values are 1 - 65535.
register is the register from which to read the repeat count. Valid values for register include reg0 - reg15. |
Executes the vector the number of times the parameter specifies. If the parameter is a register, the opcode reads the repeat count from the specified register. Use pattern sequencer registers to pass numeric values between the pattern sequencer and a run-time test program. |
|
set_loop(numeric)
set_loop(register) |
numeric is the number of times to repeat the loop. Valid values are 1 - 65535.
register is the register from which to read the number of times to repeat the loop. Valid values for register include reg0 - reg15. |
Executes the current vector and then specifies the requested
number of loop iterations for the next loop in the pattern. If the parameter is a
register, the opcode reads the loop count from that register. This allows the
run-time test program to control how many times the loop executes. After you call the set_loop opcode, you must specify the first and last vectors in the loop. Create a label on the vector at which to start each iteration of the loop. Call the end_loop opcode on the vector at which to end each iteration of the loop. Use the label you created for the first vector of the loop as the parameter of the end_loop opcode. The digital pattern instrument supports nested loops up to 8 levels deep. The number of nested loops is validated only at run time, not at edit or compile time. |
| end_loop(label) | label must be a local label. | Marks the last vector in a loop. Executes the vector and then
compares the completed loop count to the number of iterations the
set_loop opcode specified for the loop. If the completed loop
count is less than the number of iterations specified, the pattern jumps to the
specified label, and the loop iterates. If the loop count equals the specified
number of iterations, the loop completes. The loop counter stack is then popped. The
vector after the end_loop opcode executes next. The digital
pattern instrument supports nested loops up to 8 levels deep. The number of nested
loops is validated only at run time, not at edit or compile time. You can optionally use the exit_loop and exit_loop_if opcodes to exit the loop before the requested number of iterations complete. |
| exit_loop(label) | label is any local label within the pattern file or any label exported from another pattern file. | Executes the current vector, pops the most nested loop count from the loop counter stack, and jumps to the label you specify.
You can optionally use the exit_loop and exit_loop_if opcodes to exit the loop before the requested number of iterations complete. |
|
exit_loop_if([!]failed,
label)
exit_loop_if([!]seqflag, label) exit_loop_if([!]matched, label) exit_loop_if([!]trigger, label) |
label is any local label within the pattern file or any label
exported from another pattern file. Valid values for seqflag include seqflag0, seqflag1, seqflag2, and seqflag3. Valid values for trigger include trig0, trig1, trig2, and trig3. The optional ! character inverts the failed, seqflag, or matched parameter. Note matched is not the
same evaluation as !failed. !matched is not the same evaluation
as failed. Refer to the descriptions of the
matched and failed parameters for more
information. Note When
using the match opcode or the matched or
failed parameters, extra steps are required. This applies to
jump_if and exit_loop_if opcodes. It also
applies when bursting patterns across multiple synchronized digital pattern
instruments. Each instrument must process comparison results independently. Use
one of the following options.
|
Executes the current vector and then conditionally exits the
loop, based on the condition you specify. If the condition is true, the loop counter
stack is popped, and the pattern execution jumps to the vector the label specifies.
If the condition is false, the next vector in the loop executes. You can optionally use the exit_loop and exit_loop_if opcodes to exit the loop before the requested number of iterations complete. Note Refer to the
Related reference section at the end of this topic for a link to
more information about pattern responses to comparisons.
|
| call(label) | label is any local label within the pattern file or any label exported from another pattern file. | Executes the current vector and then jumps to the subroutine the
label specifies. The subroutine executes until it reaches a return
opcode. It then jumps back to the next vector after the vector with a
call opcode. The digital pattern instrument supports nested
subroutine calls up to 8 levels deep. The Digital Pattern Editor (DPE) does not
validate nested subroutine calls at compile time. DPE also does not validate them at
edit time. DPE does not check the total number of nested calls in loaded patterns.
DPE does not compare this number against the instrument’s supported
limit. The vector immediately before a vector with a call opcode can use only call or match opcodes. You can use a call opcode on the first vector but not on the last vector in a pattern. |
| return | -- | Executes the current vector and then jumps to the vector that follows the vector with the corresponding call opcode. |
Example 1
set_loop(100) sample_timeset X; // Set the number of loop iterations for the looping operation. loop: sample_timeset X; // Set the label for the looping operation. exit_loop_if(seqflag0, exit) sample_timeset X; // Exit the loop prematurely if seqflag0 is set to true. end_loop(loop) sample_timeset X; exit: halt sample_timeset X;
Example 2
call(sub1) sample_timeset 0 L; // This vector executes first. halt sample_timeset 1 H; // This vector executes after the subroutine returns. ... sub1: sample_timeset 0 L; return sample_timeset 0 L;
Keep Alive
| Syntax | Parameters | Description |
|---|---|---|
| keep_alive | -- | Stops the pattern burst and jumps to the keep alive pattern
loaded on the digital pattern instrument. A keep-alive pattern is a simple looping
pattern that is used to maintain DUT stability. It prevents the DUT from unlocking
clocks and PLLs. Use it while performing tasks like loading or unloading patterns.
It also helps when changing time sets or instrument configurations. Use it when
transitioning between tests in the test program. Use the keep_alive
opcode instead of the halt opcode for these types of situations.
Use the keep_alive opcode on the last vector of a keep-alive pattern. This loops the pattern until another pattern bursts or it is aborted. |
Example
pattern RegularPattern(Clk,DIO1)
{
repeat(100) sample_timeset 1 1;
sample_timeset 1 H;
repeat(100) sample_timeset 1 0;
keep_alive sample_timeset 1 L; //Jumps to keep alive pattern
}
keep_alive_pattern KeepAlivePattern(Clk)
{
//Exit the keep alive pattern by bursting a new pattern
//or by calling the niDigital Abort Keep Alive VI or
//the DigitalPatternControl.AbortKeepAlive .NET method.
keep_alive - -;
}
Scan
| Syntax | Parameters | Description |
|---|---|---|
| scan(cycle_count) | cycle_count is the number of scan cycles in this scan vector. The value must be a positive integer. | Designates a vector as a scan vector and declares the number of scan cycle subrows each scan vector has.
Note Refer to the
Related reference section at the end of this topic for a link to more information about scan text pattern file syntax.
|
Example
pattern NewScanPattern (CLK, ScanIn0, ScanIn1, ScanOut0, ScanOut1)
{
scan(6) TSetScan 0 _ _ _ _;
{
ScanIn0 010101;
ScanIn1 101010;
ScanOut0 LHLHLH;
ScanOut1 HLHLHL;
};
Match
| Syntax | Parameters | Description |
|---|---|---|
| match | -- Note When
using the match opcode or the matched or
failed parameters, extra steps are required. This applies to
jump_if and exit_loop_if opcodes in burst
patterns. It also applies when bursting patterns across multiple synchronized
digital pattern instruments. Each instrument must process comparison results
independently. Use one of the following options to enable this.
|
Evaluates comparisons (H, L, M, or V) on the vector without
affecting the fail count and pass or fail results. Note Refer to the
Related reference section at the end of this topic for a link to
more information about pattern responses to comparisons. This opcode generates a matched (or !matched) condition after exactly 80 cycles. You can only use the matched condition on the 80th cycle with the jump_if or exit_loop_if opcodes. On vectors with the match opcode, all comparisons are evaluated to determine the state of the matched condition. You can use a repeat opcode to implement an 80 cycle delay. To wait for a DUT response, you can use a match pipeline. Create this by using the match opcode multiple times within a loop. This allows you to poll for a specific condition. Note Refer to the Related
reference section for more information about synchronizing multiple
instruments and using matched parameters on vectors that span
more than one instrument or more than one site. |
Example
match sample_timeset L; repeat(79) sample_timeset X; jump_if(matched, end) sample_timeset X; // Pipeline delay must be exactly 80 cycles after the match opcode. Jump(error) sample_timeset X; end: halt sample_timeset X;
Halt
| Syntax | Parameters | Description |
|---|---|---|
| halt | -- | Stops the execution of the pattern sequencer and the pattern burst. When the pattern sequencer halts, all the pins maintain their current programmed state.
The pattern sequencer does not automatically stop execution at the end of the pattern. You must specify the halt opcode on the last vector in the pattern to stop the execution of the pattern. Undefined behavior results in patterns that complete without a halt code. |
Related Information
- Sequencer Flags and Registers Opcodes
- Pattern Responses to Comparisons
- Pattern Declaration
The required pattern declaration defines the sequence of pattern vectors and defines the pins and pin groups to which the pattern applies using the following syntax:
- Scan Pattern File Syntax