next up previous contents index
Next: Technology File Global Variables Up: Technology File Previous: Technology File Comments   Contents   Index


Technology File Macros

In order to facilitate customization of the technology file to different variations, in particular to support scalable technology, a macro facility is provided, along with an expression evaluator. Macros can be used to simplify or clarify the constructs. A macro definition, which can appear anywhere in the technology file, follows the keyword ``Define''. The macro name may use alphanumeric characters and underscores, and must start with an alpha or underscore character. The name is optionally immediately followed by an argument list in parentheses. The arguments are arbitrary alphanumeric plus underscore tokens that start with an alpha or underscore and are separated by commas. This is the same syntax used in the C language preprocessor for ``#define'' lines. The remainder of the line is the substitution string.

The macro name search is case dependent, unlike most other keywords in the technology file.

Syntax:

Define name [text]
Define name(arg, arg1, ..., argN) [text_containing_args]

Throughout the technology file, each line is macro expanded. The actual arguments replace the formal arguments (if any) in the substitution text, which replaces the macro reference. The macro is recognized as a text token.

Example:

Define mytext(x) this is rule number x
...
MinWidth 2 # mytext(1.2)

The MinWidth line expands to

MinWidth 2 # this is rule number 1.2

A different type of macro is defined using the Set keyword, where the words following are parsed into three tokens ``name = value''. A macro is referred to by $(name), which is replaced by value as the file is read. The variable must be set before being referenced. Neither the name nor value tokens can contain the character `)' or a carriage return, though they can contain embedded white space. In either case, the beginning and end of the token is the first and last non-white character, respectively. Substitution is performed once only, non-recursively. The two types of macro can be mixed, though the Set line is not expanded for Define'ed macros. Other lines are first expanded for Define'ed macros, then for Set macros.

The Set keyword should not be confused with the !set command, which can also appear in the technology file.

An expression involving integers or floating point numbers can be evaluated as the file is read, with the result inserted into the line at the place of evaluation. This facilitates, for example, the use of design rules based on the lambda concept. In this type of rule set, design rules are specified in terms of a minimum dimension lambda. The lambda may vary between different process implementations. In the technology file, lambda is defined as a macro, and inputs to the design rule specifications is evaluated in terms of lambda.

The syntax for expression evaluation is eval(expression). This construct can occur anywhere in the text, although it makes sense only where a number is expected. The result of the evaluation is substituted into the text replacing the eval construct, before that line of the technology file is interpreted. The expression is interpreted by the parser otherwise used for interpreting command scripts, and the full complement of operations and functions is available. Macros are expanded before the expression is parsed.

Example:

Set lambda = .6
...
LayerName BASE
MinWidth eval(2*$(lambda)) #Minimum width of the BASE layer is 2*lambda

In this example, the parameter lambda is defined to ``.6'' with the Set keyword. Elsewhere in the file, design rules can be specified as functions of lambda using the eval construct, as shown.

Example:

Set lambda = .6
Define L(x) eval($(lambda)*x)
...

LayerName BASE
MinWidth L(2) #Min width of BASE layer is L(2)

In this example, the macro L(x) is used to hide the call to the evaluation function, simplifying syntax.

If the technology file is updated to disk using the Save Tech command button, only the macros used in the design rule keywords will be preserved in their original macro form in the new file. Elsewhere, the written lines will contain the expanded quantity. All of the Set and Define lines will be preserved. Thus, the use of macros should be restricted to the design rule keywords, unless the user is willing to hand edit the new files produced with the Save Tech command.

Macros defined with the Define keyword can be used to alter the sequence of lines read from the technology file. The technology file parser understands the following keywords:

IfDef token
IfnDef token
Else
Endif

The token is tested for existence against the names of macros defined with the Define keyword. If the token following IfDef is found, the lines up to the matching Else or Endif are read, otherwise they are ignored. IfnDef has the reverse logic. The Else line (if present) creates, along with the matching Endif, a block which is read or ignored with opposite logic to the initial block (IfDef/IfnDef to Else). This feature allows the technology file to be easily reconfigured by simply changing a Define at the top of the file. The constructs can be nested to arbitrary depth.

Example:

Define TightRules
...
Layer M1
IfDef TightRules
MinWidth .4
Else
MinWidth .8
Endif

In the example above, commenting out the Define line

#Define TightRules
reconfigures the technology file.

When the technology file is updated with the Save Tech command, only the lines that were actually processed are written, i.e., the IfDef, etc. lines and unused blocks are stripped.


next up previous contents index
Next: Technology File Global Variables Up: Technology File Previous: Technology File Comments   Contents   Index
Stephen R. Whiteley 2006-10-23