Table Of Contents

Flow Control Opcodes

Last Modified: November 23, 2020

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.

spd-note-note
Note  

matched is not the same evaluation as !failed, and !matched is not the same evaluation as failed. Refer to the descriptions of the matched and failed parameters for more information.

spd-note-note
Note  

When you use the match opcode or the matched or failed parameter of the jump_if or exit_loop_if opcodes in a pattern that you burst on multiple synchronized digital pattern instruments, you must use the niDigital Enable Match Fail Combination VI, EnableMatchFailCombination .NET method, or niDigital_EnableMatchFailCombination C function to enable each synchronized instrument to process the comparison results. You must also use the NI-Sync driver and a PXIe-6674T timing and synchronization instrument to combine comparison results across digital pattern instruments synchronized using NI-TClk. Refer to the Related reference section at the end of this topic for a link to more information about using matched and failed functionality across multiple synchronized digital pattern instruments.

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.
spd-note-note
Note  

Refer to the Related reference section at the end of this topic for a link to more information about pattern responses to comparisons.

  • failed - Jump if any comparison failed in the current pattern burst on any pin from any site. Continue to the next vector otherwise. This condition does not include the vectors that executed within the last 80 cycles or vectors that contain the match opcode. You can use the repeat opcode to implement an 80 cycle delay.
    spd-note-note
    Note  

    Refer to the Related information section at the end of this topic for a link to more information about synchronizing multiple instruments and using failed parameters on vectors that span more than one instrument or more than one site.

  • seqflag - Jump if the specified pattern sequencer flag is set. Continue to the next vector otherwise.
    spd-note-note
    Note  

    When you use the seqflag parameter for pins that span multiple digital pattern instruments, you must use NI-TClk to synchronize the instruments. Refer to the Related reference section at the end of this topic for a link to more information about using sequence flag triggers and synchronizing digital pattern instruments.

  • matched - Jump if the vector that executed exactly 80 cycles prior matched. Continue to the next vector otherwise.
    spd-note-note
    Note  

    Refer to the Related reference section at the end of this topic for a link to more information about synchronizing multiple instruments and using matched parameters on vectors that span more than one instrument or more than one site.

  • trigger - Jump if the specified trigger is asserted. Continue to the next vector otherwise.
    spd-note-note
    Note  

    When you use the trigger parameter for pins that span multiple digital pattern instruments, you must use NI-TClk to synchronize the instruments. Refer to the Related reference section at the end of this topic for a link to more information about using conditional jump triggers and synchronizing digital pattern instruments.

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 requested number of loop iterations from the specified register to allow the run-time test program to control the number of times a 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 number of iterations specified, the loop completes, the loop counter stack is popped, and the vector after the end_loop opcode executes. 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.

spd-note-note
Note  

matched is not the same evaluation as !failed, and !matched is not the same evaluation as failed. Refer to the descriptions of the matched and failed parameters for more information.

spd-note-note
Note  

When you use the match opcode or the matched or failed parameter of the jump_if or exit_loop_if opcodes in a pattern that you burst on multiple synchronized digital pattern instruments, you must use the niDigital Enable Match Fail Combination VI, EnableMatchFailCombination .NET method, or niDigital_EnableMatchFailCombination C function to enable each synchronized instrument to process the comparison results. You must also use the NI-Sync driver and a PXIe-6674T timing and synchronization instrument to combine comparison results across digital pattern instruments synchronized using NI-TClk.

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.

spd-note-note
Note  

Refer to the Related reference section at the end of this topic for a link to more information about pattern responses to comparisons.

  • failed - Exits the loop if any comparison failed in the current pattern burst on any pin from any site. Continue to the next vector otherwise. This condition does not include the vectors that executed within the last 80 cycles or vectors that contain the match opcode. You can use the repeat opcode to implement an 80 cycle delay.
    spd-note-note
    Note  

    Refer to the Related information section at the end of this topic for a link to more information about synchronizing multiple instruments and using failed parameters on vectors that span more than one instrument or more than one site.

  • seqflag - Exits the loop if the specified pattern sequencer flag is set. Continue to the next vector otherwise.
    spd-note-note
    Note  

    When you use the seqflag parameter for pins that span multiple digital pattern instruments, you must use NI-TClk to synchronize the instruments. Refer to the Related reference section at the end of this topic for a link to more information about using sequence flag triggers and synchronizing digital pattern instruments.

  • matched - Exits the loop if the vector that executed exactly 80 cycles prior matched. Continue to the next vector otherwise.
    spd-note-note
    Note  

    Refer to the Related reference section at the end of this topic for a link to more information about synchronizing multiple instruments and using matched parameters on vectors that span more than one instrument or more than one site.

  • trigger - Terminates the loop if the specified trigger is asserted. Continue to the enxt loop iteration otherwise.
    spd-note-note
    Note  

    When you use the trigger parameter for pins that span multiple digital pattern instruments, you must use NI-TClk to synchronize the instruments. Refer to the Related reference section at the end of this topic for a link to more information about using conditional jump triggers and synchronizing digital pattern instruments.

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 and 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 does not validate at compile time or edit time the total number of nested subroutine calls in the patterns you load against the number of nested subroutine calls the digital pattern instrument supports.

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 specialized, simple looping pattern designed to keep the DUT from unlocking clocks and PLLs while you perform other tasks, such as loading or unloading patterns, changing time sets, changing instrument configurations, or moving from one test to another in the test program. Use the keep_alive opcode instead of the halt opcode for these types of situations.

You must use the keep_alive opcode on the last vector of a keep alive pattern to loop the keep alive pattern until you burst another pattern or until you abort the keep alive pattern.

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.
spd-note-note
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 --
spd-note-note
Note  

When you use the match opcode or the matched or failed parameter of the jump_if or exit_loop_if opcodes in a pattern that you burst on multiple synchronized digital pattern instruments, you must use the niDigital Enable Match Fail Combination VI, EnableMatchFailCombination .NET method, or niDigital_EnableMatchFailCombination C function to enable each synchronized instrument to process the comparison results. You must also use the NI-Sync driver and a PXIe-6674T timing and synchronization instrument to combine comparison results across digital pattern instruments synchronized using NI-TClk.

Evaluates comparisons (H, L, M, or V) on the vector without affecting the fail count and pass or fail results.
spd-note-note
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 create a pipeline of matches by using the match opcode multiple times within a loop to poll for a certain condition.

spd-note-note
Note  

Refer to the Related reference section at the end of this topic for a link to 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.


Recently Viewed Topics