1
Basic Concepts
Introduction to Analog Expression Language (AEL)
The Analog Expression Language (AEL) is an expression language designed to:
- Support full or partial evaluations of expressions
- Provide an expression evaluation mechanism especially adapted to rapid, repeated evaluation in critical time paths (that is, netlisting, simulation, and schematic annotation)
This manual contains concept and reference information about Analog Expression Language (AEL) and provides some sample applications. This user guide is aimed at developers and designers of integrated circuits and assumes that you are familiar with analog design and simulation. You should also be proficient in Cadence® SKILL language programming.
The following topics are discussed in this chapter:
Overview
This section explains the concepts of the Analog Expression Language (AEL) and provides some sample applications. AEL is not a programming language, but an expression language designed to
- Support full or partial evaluations of expressions
- Provide an expression evaluation mechanism especially adapted to rapid, repeated evaluation in critical time paths (that is, netlisting, simulation, and schematic annotation)
AEL distinguishes between several types of expression components:
- Literals with suffixes or converters such as 5K = 5000
- Globals
- CDF parameter functions: pPar( ) and iPar( )
- Non-CDF functions
- Literals without suffixes or converters
- Operators
AEL is used in these situations:
- In schematic annotation, you can display values or some form of expression that determines those values.
- You can dynamically define parameters for multiple simulators with a single expression and evaluate that expression as needed for each simulator. This is valuable because each target simulator is likely to provide a different level of support for variables and expressions.
- The large number of expressions that must be evaluated for behavioral modeling can be compiled once and executed many times. This is faster than repeatedly interpreting these expressions. Even repeated execution can be replaced by reusing previous results if expression dependency tracking is used.
In these and other situations, the controlled partial evaluation of expressions makes a single expression useful in a number of otherwise incompatible contexts. To get the same effect without controlled partial evaluation requires the maintenance of separate but related expressions, and possibly more than one expression evaluation mechanism.
Terminology
The following terms are used in this section.
Globals and Constant Globals
AEL globals are values that apply to all parts of any given large application. For example, they represent values such as the sheet resistivity of a particular material or the temperature at which a given simulation is run.
Some AEL globals are built-in constants. Constant globals behave the same way as user globals, except that they exist in every AEL environment and their values cannot be changed.
Suffixes and Converters
Suffixes and converters provide a shorthand notation for expressing powers of 10 and other multipliers. For example, 5p reads five pico and represents the value 5.0e-12 or 0.000000000005. (For more information on suffixes and converters, refer to “AEL Evaluation Symbols”.)
Defined and Deferred Globals and Functions
A user-supplied global is defined when it has a data type and a value. The value can be changed, but the data type cannot. A global is deferred if it appears in an expression but does not have a data type or value. A deferred global cannot become defined and a defined global cannot become deferred.
A defined function is one that is compiled into AEL. Both AEL-supplied and user-supplied functions are compiled into AEL. (You must have the Integrator’s Toolkit™ [ITK] to do this.) The functions have a return type and, in most cases, an argument template. A function is deferred if it appears in an expression but is not compiled into AEL. A deferred function cannot become defined, and a defined function cannot become deferred.
AEL can replace a defined global with its value or a defined function call with its return value, if all arguments are also defined. If a function or global is deferred or if a defined function has any deferred arguments, AEL cannot replace the global or function with a value.
In some cases, you may want to defer a function or global so that a simulator used later in the process can define and call the function or resolve the global. For example, if you want a simulator to sweep a variable, you can defer the design global in AEL. The resulting symbolic expression can then be passed to the simulator for further evaluation.
Component Description Format (CDF)
Component Description Format (CDF) is a facility for dynamically defining parameters for objects at different levels of the hierarchy of a design.
AEL can affect intercomponent CDF parameter dependencies. In particular, a parameter value on a given cell can be a function of the values of other parameters on the same cell or on the parent cell. Outside of AEL, such interdependent CDF parameter relationships are supported through user-written callbacks. They are not inherent in CDF and are not supported in contexts other than form-based user input.
For a CDF parameter to be processed by AEL, it must be a text string whose content is a legal AEL expression. The string must be marked parseAsCEL. Expressions marked this way can refer to other parseAsCEL parameters on the same cell or on the parent cell. (For more information on CDF, refer to the Component Description Format User Guide.)
Compile and Interpret
AEL expressions can be compiled and executed in separate steps or they can be interpreted (compiled and executed in one step). In some contexts, compilation is not possible or interpretation is more appropriate. AEL is most efficiently used, however, with expressions that are compiled once and executed many times.
Because AEL supports partial evaluation, compilation is not a clearly defined task. It assumes the following conditions:
- The values of individual globals can change between compilation and any execution.
- The meaning or result of compilation cannot change between compilation and execution.
If the first assumption is violated, you can perform only a one-time evaluation, not a compilation. If the second assumption is violated, compilation is invalidated, requiring a recompile. Either of these situations converts the compiler into an interpreter, defeating its purpose.
An evaluation mode determines which expression components are evaluated and which are retained unaltered. The evaluation mode that is set when an environment is created cannot be changed and applies to all expressions compiled in that environment. Each expression interpreted in a given environment can specify any evaluation mode desired.
Syntax
Use the following guidelines when creating AEL expressions:
- AEL syntax is based on the mathematical syntax in SKILL.
- Commas are required to separate arguments to functions.
- White space is not allowed between the last digit of a number and its suffix or converter.
- Suffixes and converters must be followed by the end of the string, white space, an operator, or appropriate punctuation.
Licensing Requirements
For information about licensing in the Virtuoso Studio Design Environment, see Virtuoso Software Licensing and Configuration Guide.
Partial Evaluation
A simple expression evaluator typically yields a floating-point value. An evaluator like AEL, that supports partial evaluation and deferred symbols, cannot do so. AEL can only convert the input string into another string containing a modified representation. For example, if the input string is
3*2*factor
and factor is a deferred global, AEL converts this input to
6*factor
If you want to use an expression in its most symbolic form, do not request any evaluation. If you want to use an expression in its most mathematical form, request evaluation of all globals and suffixes, but do not call functions or apply operators. If you use a simulator that does not support any expressions, request full evaluation. Full evaluation requires that all globals and functions be defined and that none are deferred.
Partial evaluation allows you to request evaluation of some or all expression components. If you request full evaluation and any globals or functions are deferred, those globals and functions remain symbolic. For example,
1.5u*3
produces a string representation of a double (“4.5e-6”) if suffixes are being evaluated. It remains unchanged if they are not.
Partial Evaluation Example
The following is a sample AEL expression.
2 * pi * pPar("freq") / sqrt(iPar("w") * magic(c)) * 1.5u
This expression contains these components:
| Component | Definition |
|---|---|
If you request literal evaluation, the evaluator returns the expression as entered. If you request full evaluation, and neither magic nor c is deferred, the evaluator returns a string representation of a double-precision floating-point number. This number results from replacing globals with their values, replacing suffixed literals with their equivalents in scientific notation, calling functions, and applying operators.
The following string results if none of the components in the expression are deferred and you request evaluation of globals, suffixes, and CDF parameters:
2 * 3.14159265358979323846 * 1e9 / sqrt(3e-6 * magic(10)) * 1.5e-6
All predefined and user-defined globals are replaced with their values, suffixed numbers are replaced with their equivalents in scientific notation, and all CDF parameter functions are called. However, no non-CDF functions are called and no operators are applied.
If full evaluation of the same expression is requested and the user-supplied global c is deferred, the evaluator returns the following string.
6.283185307e9 / sqrt(3e-6 * magic(c)) * 1.5e-6
By deferring c, you also defer the following elements:
-
The function,
magic,even though it is defined -
The multiplication of
3e-6by the return value ofmagic -
The call to
sqrt,even though it is built-in -
The multiplication of the return value of
sqrtby1.5e-6 -
The division of
6.283185307e9by the rest of the expression
Even though you request full evaluation, only two of five operators are applied and neither of the two non-CDF functions is called. If the expression is used only for annotation or if the expression will be passed to an evaluator that can finish the job, the expression might be acceptable in this state.
Evaluating AEL Expressions
Attaching Expressions to Design Components
The documentation for CDF describes how to create a string parameter, marked parseAsNumber and parseAsCEL, and how to attach it to a given cell. When AEL expressions are used as parameters, two things happen:
- CDF parameter values have the general resources of AEL at their disposal
- Parameters have AEL support of instance and inherited parameters
For more information on CDF, refer to the Component Description Format User Guide.
Example Expressions and Evaluation
The following is an example expression using AEL syntax followed by a table listing the results of several different types of evaluation.
2 * pi * pPar(“freq”) / sqrt(iPar(“w”) * magic(c)) * 1.5u
For the purposes of this expression, the following values are assumed:
| Evaluation Method | Resulting Expression |
|---|---|
|
|
|
Return to top