12 Searching

The Find dialogue helps you to find signal patterns. It behaves like the standard find dialogue of the text editors. You type in a find expression, select if you want to search forwards or reverse, with or without wrapping and then click find. The active cursor will be placed at the found position.

This article is based on impulse 1.8.

Simple searching

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

Modify the expression to your needs and press find. The active cursor will be placed at the found position. Click Reverse to do reverse searching, or Wrap to move from 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

No matter if you develop a reader, a recJs script, a search expression or a Signal Script production, impulse provides you always with the same interfaces to read, compare, analyze or generate signal data.

Open JavaDoc Reference Show Search examples

More about scripting impulse

The expression language is based on Java Script. The signal variables s1,s2,… are of the 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 the search need to continue. 

Domain relative expressions

Usually all statements of an expression are within the context of the current domain position. If you wish to compare relative positions, then you can use the relative method to obtain a relative pointer. 

	s0.isEdge(1) && 
	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 expressions are made easier 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 optional parameters for edge detection that can be left empty.

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

Integer and Float

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

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

Events and Text signals

You might use the 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 dialogue, 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 click Add (in the lower part of the dialogue). The expression is now visible in the list above.

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

Print

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive