logo

12 Searching

The Find dialog helps to find signal patterns. Its behaving like the standard find dialog of the text editors. You type in a find expression, select if you want to search forward or reverse, with or without wrapping, and press find. The active cursor will be placed at the found position.

Simple searching

To start searching, select the signals to search on and press Ctrl-f. The Find dialog pops up with a predefined expression. This expression contains all selected signals and compares them with the values at active cursor position.

Modify the expression to your needs and press find. The active cursor will be placed onto the found position. Click Reverse to do reverse searching, or press Wrap, to move at the end of the signal to its beginning.

If the expression has an error, you will get a message in the status log below.

Search expressions

The expression language is again java script. It uses the same mechanisms as Signal Scripting. The signal variables s1,s2,.. are of type ISamplePointer. For each search step, the sample pointers are adjusted to the new position and the expression is evaluated. Returning a boolean true means that the search was successful, false means that search need to be continued.

Java reference for scripts

Domain relative expressions

Usually all statements of an expressions are in the context of the current domain position. If you wish to compare at relative positions you can use the relative method to get a relative pointer.

	s0.isEdge(1,null) && 
	s1.relative("-10ns").fhex()=='x2521'

The expression above returns true at the current position, if s0 has a positive edge and s1's value was 'x2521' 10 ns 'before'.

Logic signals

Logic signal expression are made easy by using the format methods. There are fbin,fhex,foct and fdec.

	s0.fbin()=='b1' && 
	s1.fbin()=='b0' && 
	s2.fbin()=='b0' && 
	s3.fhex()=='x2521'

Instead of the conversion routines, you can test logic signals with isEdge,isHigh and isLow. These methods have an additional parameter for edge detection that can be left empty.

	s0.isEdge(1,null) && // 1: rising edge -1: falling edge
	s1.fbin()=='b1' &&
	s2.isHigh(null)

Integer and Float

Use the val method to get the native current value. You can compare with usual js methods.

	s0.val()>4.0 && 
	s1.val()==0.0 && 
	s2.val()<1

Events and Text signals

You might use val or stringValue method to get the current value.

	s0.stringValue()=='Stop' && 
	s1.stringValue()=='0'

Struct signals (Logs & Transactions)

The struct access members xxxxOf({member}) allows you to compare all members of a struct. Here the method stringValueOf is used:

s0.stringValueOf('Level')=='WARN'
&& s0.stringValueOf('Message')
	.indexOf("version") >=0

Manage search expressions

When you open the Manage Search Configuration section in the Find dialog, you'll see a list of all search expressions defined for the active configuration. To add a new one, give the current expression a name and press Add (in the lower part of the dialog). The expression is now visible in the list above.

To select one of the expressions in the list, just double-click on it.