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 used in the technology file, and facilitate portability by effectively customizing the technology file to different environments.
The macro capability makes use of the generic macro preprocessor provided in Xic, which is described in 15.1. The reader should refer to this section for a full description of the preprocessor capabilites. The preprocessor provides a few predefined macros used for testing (and customizing for) release number, operating system, etc. The keyword names, which correspond to the generic names as described for the macro preprocessor, are case-insensitive and listed in the following table.
Keyword | Function |
---|---|
Define | Define a macro. |
If | Conditional evaluated test. |
IfDef | Conditional definition test. |
IfnDef | Conditional non-definition test. |
Else | Conditional else clause. |
Endif | Conditional end clause. |
A macro definition can appear anywhere in the technology file. 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
The conditional keywords provide tests which can be used to select which lines of the technology file are actually read, based of the settings of existing macros and/or expression evaluation. The logic is explained in the description of the generic macro preprocessor.
Example:
Define TightRules
...
Layer M1
IfDef TightRules
MinWidth .4
Else
MinWidth .8
Endif
In the example above, commenting out the Define line
#Define TightRulesreconfigures 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.
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
...
PhysLayer 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)
...
PhysLayer 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.