Using The Expression Builder
The Expression Builder, shown in Expression Builder Window, is used to create expressions to perform detailed analysis of simulation data. The waveforms produced by the expressions can be displayed in the Results Display window.
Figure 6-1: Expression Builder Window
When bringing arguments into expressions, if they contain sweep data, the expression is calculated for each of the sweeps. However, the Expression Builder cannot deal with expressions that have different numbers of sweeps for each of its arguments - for example, five sweeps in arg1 and ten sweeps in arg2. The number of sweeps must be the same for all arguments in the expression.
Expressions can be created by typing the expression directly into the expression field, or they can be created by making selections in the desired order from the lists of available functions, waveforms, operators, macros, and other expressions.
The Functions list shows the functions that are available for use in creating expressions and macros. These are predefined functions. The functions available in AvanWaves are defined in Appendix B.
To use a function in an expression:
1. Select the function from the Functions list, then drag it into the Expression field. Alternatively, double-click on the function to insert it into the Expression field at the current cursor location. You can place the cursor by clicking at the desired insertion location.
2. Enter the arguments for the function either manually or by selecting and dragging curves from the Results Browser.
If a function takes two arguments, you can select both values for these arguments from the Results Browser and drag them to the Expression field together. Each curve entered as an argument is prefixed with its design and analysis number.
All functions work on either constants or waveforms. If a function is applied with one argument that is a constant and one argument that is a waveform, the constant is changed into a "constant value" waveform, and then the operation is performed.
Functions and Expressions can contain arguments that have not yet been defined. A function must have at least one argument, and not more than two. The expression name must be unique.
A set of arithmetic, numeric comparison, Boolean, and conditional operators are available for use in building expressions and macros in the Expression Builder. The following are the types of operators that can be selected from the Operators list:
Arithmetic (+, -, *, /) -- return analog waveforms only
Comparison (>, <, <=, >=, !=, ==) -- return logical waveform results (1 or 0)
Boolean combination ( &&, ||, !) -- return logical waveform results (1 or 0)
Conditional (expr1 ? expr2 : exp3) -- analog wave built from expr2 if expr1=0 or expr3 if expr1 is not equal to 0
To use an operator in an expression:
1. Place the cursor in the expression where you want to enter the operator.
2. Select the operator from the Operators list.
3. Click on the operator and drag it into the Expression field.
Alternatively, double-click on an operator to insert it into the Expression field at the current cursor location.
Using Curves in Expressions
Any curve (simulation waveform) can be placed in an algebraic expression as a parameter. The result of the expression operating on the waveform then can be displayed as a new waveform.
To use a waveform as a parameter in an expression
1. Select the function to use.
In the Expression Builder window, double-click on the function you want to use in the expression. The function is displayed in the Expression field of the Expression Builder window.
2. Select the waveform.
In the Results Browser, select the waveform you want to use. Holding the mouse button down, drag the waveform into the Expression field of the Expression Builder window. This places the waveform inside the function, so that it can be used as an argument.
NOTE: A function can have many parameters or arguments. You can select waveforms to be used as parameters in a function one at a time, or make multiple selections. When you insert multiple waveforms in the Expression field, they fill up the parameter values in the order in which you select them.
Selecting and Editing Expressions
To select an existing expression:
. This clears the Expressions field.
2. With the left mouse button, double-click on the expression (result name) in the Expressions list.
The actual expression is displayed in the Expression field, and the name of the expression is displayed in the Result field.
To edit the definition of an expression:
1. Select the expression.
2. In the Expression field, modify the expression definition, then click
The expression is modified to reflect the changes.
Another way of modifying an expression is by changing the macro definition within the expression. More information on Macros can be found in the "Editing a Macro" section on Page 6-6.
The Expressions list contains all the expressions created in AvanWaves using the Expression Builder. The expressions are saved with the current designs when a configuration is created. An expression can be used as part of another expression by selecting it and dragging it into the Expression field.
To add an expression to the Expressions list:
1. Enter an expression in the Expression text entry field, and enter a name for the result in the Result field.
to enter the expression in the Expressions list.
The expression is entered in the list under the Result name.
To expand an expression to display its definition:
Double-click on the result name in the Expressions list.
The expression name is entered into the Result field and the expression definition is displayed in the Expression field.
AvanWaves User Guide - Release 2001.2
To display an expression:
Select the expression name in the Expression list and drag it into the waveform display area of the panel.
The result of the expression is displayed as a waveform, and the name of the expression, preceded by the design and analysis number, is added to the Wave List in the Results Display window.
You cannot display an expression whose result is simply a constant, for example, abc = abs(-20). You can use it in another expression, but cannot display a constant result such as `abc' by itself. It must have a signal associated with it.
To view the waveforms associated with the expression, double-click on the name of the expression in the Wave List.
NOTE: Sweeps that are derived from an expression are not expanded in the Wave List, but they are expanded when they come from the simulator.
To delete an expression from the Expression list:
Using the left mouse button, select the expression from the list, then click
Select the expression, then select
Options >> Delete Expression