next up previous contents index
Next: Syntax Compatibility Up: The measure Command Previous: The measure Command   Contents   Index


Point and Interval Specification

The field that follows the resultname contains a description of the conditions which initiate a measurement. There are three basic types: a point specification, an interval specification, and a post-measurement specificantion.

The interval begins with the ``trigger'' and ends with the ``target''. Measurement will apply during this interval. If no target is given, the trigger sets the point, where measurement will be performed. The trigger and target are independently specified as follows:

point
[trig] pointlist
This consists of the keyword trig (which is optional) followed by a point specification list. The keyword ``from'' is equivalent to ``trig''.

interval
[trig] pointlist targ pointlist
An interval contains a second point specification initiated with the mandatory keyword targ. The keyword ``to'' is equivalent to ``targ''.

post-measurement
param=expression
Measurements in this form will be performed when all point and interval measurements are complete. After all point and interval measurements have been performed, the expression will be evaluated and the result saved in resultname. The expression can reference other measurement results in addition to the usual vectors and functions provided by the system. These measurement lines are evaluated in the order found in the input.

pointlist
pointspec [pointspec] ...
The point is specified with a list of pointspec specifications, and the event is registered on the first occasion when all pointspec elements are true, i.e., the conjunction is true.

pointspec
keyword expression1 [=][val=] [expression2] [cross=crosses] [rise=rises] [fall=falls]
[minx=min_delta] [td=delay]

The pointspec begins with one of the following kewords: before, at, after, when. The at keyword strobes, meaning that the event is triggered only if the conjunctions (other pointspecs) in the list are true at the specified event. The after and when keywords are equivalent, but varied use can give a natural language feel to the conjuction list. They are not strobing, meaning that the conjunctions can become true anytime at or after the specified event. The before keyword negates logic: the pointspec is true before the specified event. This can be useful as an element in the conjunction list.

Once a pointspec becomes triggered, it remains triggered for the remainder of the simulation run. Once triggered, a before pointspec will evaluate false, preventing the overall list from triggering. Otherwise, the overall list triggers when each pointspec is true. Similarly, an at clause that did not have all conjunctions true at its event time will thereafter always be false.

Following the keyword are one or two general expressions. There can be an optional equal sign (``='') or a ``val'' keyword ``val='' between the expressions.

An expression in this context can be:

In WRspice, an expression token is the minimum text required for a syntactically complete expression, and may include white space. Single quotes or parentheses can be used to delimit expressions in the pointspec, if nexessary. The normal single-quote expression expansion and substitution is suppressed in this context.

If only one expression is given, and it is not a constant expression or a measure name, the event is triggered at the first time the expression becomes logically true, meaning that the absolute value is one or larger. This corresponds to logical true produced by comparison and other logical operations in WRspice. For example, the expression ``v(5) > 0.25'' returns 0 if false and 1 if true.

It may be a bit confusing but the form expr1=expr2 is interpreted as two expressions, but the same form with any relational operator other than = is taken as a single expression with a binary result. Either the symbol or the keyword equivalent can be used. The relational operators available are listed below.

eq or = equal to
ne or < > not equal to
gt or > greater than
lt or < less than
ge or > = greater than or equal to
le or < = less than or equal to

If two expressions are given, neither can be a measure result name. We are implicitly comparing the values of the two expressions, finding points where the two expressions are equal. By default, the first time the values of the two expressions cross will trigger the event. The following keywords can be assigned an integer value to trigger at the indicated point.

cross=crosses
Integer crosses is the number of crossings.

rise=rises
Integer rises is the number of times that expression1 rises above expression2.

fall=falls
Integer falls is the number of times that expression1 falls below expression2.

minx=min_delta
Real min_delta is the minimum time before a following crossing event will be recognized, used to suppress spurious crossings from noise or ringing.

td=delay
If two expressions are given, the delay is the amount of scale value (e.g., time in transient analysis) before starting to look for crossing events.

If one expression is given, and the expression is not constant or a measure result name, the delay is the amount of the scale value to wait before checking to see if the expression evaluates true. If the expression is a measurement name, than the delay is added to the measurement time of the referenced measurement.

There is a special case, where no expressions are given, only a td=delay value. This can be a second or subsequent pointspec in the pointlist. This will trigger at the time of the previous pointspec in the list (to the left) delayed by delay.

ts=delay
This is similar to td, however it is strobing. In the two expression case, in addition to having the effect of td, it will convert when and after clauses to work as at, requiring conjunctions to be true at the time of the event. It simply acts as td for at and before.

In the single expression case, it requires that the expression and any conjunctions be true at the value given for ts.

Examples:
at v(2)=0.5 rise=3 td=0.2nS after td=0.1nS
Trigger 0.1nS after the third rising edge of v(2) after 0.2nS crosses 0.5V.
when v(2)<v(1) before v(2)<v(3)
Trigger the first time that v(2) < v(1) if and only if v(2) < v(3) has never been true.


next up previous contents index
Next: Syntax Compatibility Up: The measure Command Previous: The measure Command   Contents   Index
Stephen R. Whiteley 2022-09-18