The state-based triggering flow allows you to define a custom triggering flow to organize your triggering conditions. These examples show templates for common triggering flow scenarios and illustrate various scenarios where the state-based triggering flow is useful. For all of these examples, you can paste the flow description directly into the SignalTap II State-Based trigger flow tab using the display mode All States in One Window and modify the description to suit your debugging scenario.
State-Based Triggering Flow Description
//make sure if condition containing trigger action is first,
// since conditional statements are priority based.
if ( c1 >= 5)
trigger;
else if ( ! condition1 )
increment c1;
else if ( condition1 && c1 < 5 )
reset c1;
Data Analysis Result
State-Based Triggering Flow Description
state ST1:
if ( condition1 && c1 > 0 && c1 < 5)
trigger;
else if ( ! condition1 && c1 < 6)
increment c1;
else if ( condition1 && c1 > 5 )
reset c1;
In the case of a long sequence where Condition1 does not occur, the Boolean condition c1 <6 was added in the second else if conditional statement to prevent the counter from wrapping.
Data Analysis Result
State-Based Triggering Flow Description
state ST1:
if ( c1 >= 5)
trigger;
else if ( condition1 )
increment c1;
Data Analysis Result
Trigger on the 5th Transition of a Group Value
Method #1: Using the an Edge-Sensitive Trigger
Setup for Trigger Condition
For this case, we can define an edge-sensitive trigger condition to detect all bus transitions to the desired group value. We require an edge detection for any bit on our data bus logically ANDed with a comparison to our desired group value. An advanced trigger condition is necessary in this case. The setup from the advanced trigger condition editor is shown below.
State-Based Triggering Flow Description
state ST1:
if (c1 >= 5)
trigger;
else if (condition1)
increment c1;
Data Analysis Result
Method #2: Using a Simple Trigger and the State-Based Triggering Flow
Setup for Trigger Condition
Since setting up an advanced trigger condition for a large bus value may be cumbersome, this alternate method uses a basic trigger and uses the state-based triggering flow to detect the transition of the bus to the desired group value.
State-Based Triggering Flow Description
state ST1:
if (condition1)
begin
increment c1;
goto ST2;
end
state ST2:
if (c1 >= 5)
trigger;
//wait condition; stay in this state until condition 1 is false to ignore
//all occurrences of condition1 that are not bus transitions
else if (! condition1)
begin
goto ST1;
end
Data Analysis Result
Note that there is a slight difference in behavior of how data is captured as compared to the first method. In this case, a level sensitive trigger is used for the trigger condition. If the bus value is parked at the desired group value at the start of data analysis, this method includes the group value in the count. Since the first method only counts a bus transition to the desired group value, the first method would ignore the first occurrence of the group value if the group value is already parked on the bus at the start of the acquisition.
Trigger After Condition1 is Followed by Condition2
Setup for Trigger Condition
Three basic trigger conditions are defined in the setup tab to the desired values. The first two trigger conditions are set to the desired group values. The third trigger condition is meant to capture some type of idle transaction across the bus between the first and second conditions. You can put this trigger condition as “don’t cares” if it is more appropriate. Note the use of Mnemonics for TrigCond1, TrigCond2, and IDLE.
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST2;
state ST2:
if ( condition1 || condition3 )
goto ST2;
else if (condition2 )
goto ST3;
else if ( ! condition2 )
goto ST1;
state ST3:
trigger;
Data Analysis Result
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST2;
state ST2:
if ( condition1 )
goto ST2;
else if (condition2 )
trigger;
else
goto ST1;
Data Analysis Result
Trigger on Condition2 Not Occurring Between Condition1 and Condition3
Setup for Trigger Condition
Three basic trigger conditions are defined to the desired group values. Note again, the use of Mnemonics.
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST2;
state ST2:
if ( condition3 )
goto ST4;
else if ( ! condition2 )
goto ST3;
else
goto ST1;
state ST3:
if ( condition3 )
goto ST4;
state ST4:
trigger;
Data Analysis Result
Trigger on the 5th Consecutive Occurrence of Condition1
Setup for Trigger Condition
One basic trigger condition is defined in the setup tab to the desired value. TrigCond1 shown in the figure below is an alias for the value AA setup using a Mnemonic table setup.
State-Based Triggering Flow Description
state ST1:
if ( c1 >= 5 )
trigger;
else if ( condition1 )
increment c1;
else if ( ! condition1 )
reset c1;
Data Analysis Result
Trigger After a Violation of Sequence: Condition1-> Condition2-> Condition3-> Condition4
Setup for Trigger Condition
Four basic trigger conditions are set up to the desired sequence values. Mnemonics are used for all four trigger conditions shown.
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST3;
else if ( condition2 )
goto ST4;
else if ( condition3 )
goto ST5;
else if ( condition4 )
goto ST2;
else
trigger;
state ST2:
if ( condition4 )
goto ST2;
else if (condition1 )
goto ST3;
else
trigger;
state ST3:
if (condition1)
goto ST3;
else if (condition2)
goto ST4 ;
else
trigger;
state ST4:
if (condition2)
goto ST4;
else if (condition3)
goto ST5;
else
trigger;
state ST5:
if (condition3)
goto ST5;
else if ( condition4)
goto ST2;
else
trigger;
Data Analysis Result
Trigger on a Sequence of Edges
Setup for Trigger Condition
Three edge-sensitive basic trigger conditions are set up for the desired sequence. This example looks for a rising edge on channel 1, a falling edge on channel 2, followed by a rising edge on channel 3.
State-Based Triggering Flow Description
state ST1:
if (condition1)
goto ST2;
state ST2:
if (condition2)
goto ST3;
state ST3:
if (condition3)
trigger;
else
goto ST1;
Data Analysis Result
Trigger on Condition1 Followed by Condition2 After 5 Clock Cycles
Setup for Trigger Condition
Two basic trigger conditions are defined to the desired group values. Note again, the use of Mnemonics for TrigCond1 and TrigCond2.
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST2;
state ST2:
if ( condition1)
goto ST2;
else if ( ! condition2 )
increment c1;
else if (condition2 && c1 >= 5)
trigger;
else if (condition2 && c1 < 5)
goto ST1;
Data Analysis Result
Trigger on Condition1 Followed by Condition2 Within 5 Samples
Setup for Trigger Condition
Two basic trigger conditions are defined to the desired group values. Note again, the use of Mnemonics for TrigCond1 and TrigCond2.
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST2;
state ST2:
if ( condition1)
goto ST2;
else if ( ! condition2)
increment c1;
else if (condition2 && c1 <= 5)
trigger;
else if (condition2 && c1 > 5)
goto ST1;
Data Analysis Result
Trigger on Condition1 Not Followed by Condition2 Within 5 Samples
Setup for Trigger Condition
Two basic trigger conditions are defined to the desired group values. Note again, the use of Mnemonics for TrigCond1 and TrigCond2.
State-Based Triggering Flow Description
state ST1:
if ( condition1 )
goto ST2;
state ST2:
if (c1 == 5)
trigger;
else if ( condition1)
goto ST2;
else if ( ! condition2)
increment c1;
Data Analysis Result
Trigger After 5 Consecutive Transitions
Setup for Trigger Condition
This example needs a trigger condition to capture any transition activity on the monitored bus. An advanced trigger condition is needed since an OR condition is required.
State-Based Triggering Flow Description
state ST1:
if ( c1 == 5 )
trigger;
else if ( ! condition1)
reset c1;
else if ( condition1 )
increment c1;
Data Analysis Result
Trigger When Condition1 Occurs Less Than 5 Times Between Condition2 and Condition3
Setup for Trigger Condition
This example requires three edge-sensitive trigger conditions with each trigger condition containing a comparison to the desired group value. This can be done using the advanced trigger condition editor. The figure below shows an example for one of the three edge-sensitive trigger conditions.
State-Based Triggering Flow Description
state ST1:
if ( condition2)
begin
reset c1;
goto ST2;
end
state ST2:
if (condition3 )
goto ST3;
else if ( condition2)
goto ST1;
else if ( condition1 )
increment c1;
else if ( condition3 && (c1 >= 5 ))
goto ST1;
state ST3:
trigger;