Xic supports a scripting language and user-definable commands (scripts). These commands can be associated with buttons in the User Menu. Scripts may also be used in ``script labels'', which are labels placed in a drawing which execute the script when clicked on. Scripts are also used in user-defined design rules, and are the basis for the protocol used in the Xic server mode. Scripts are also integral to the template cell capability.
In addition to the native scripting capability, Xic provides an interface to the popular open-source Tcl/Tk scripting language.
The scripting capability can be used to provide commands that quickly generate complex geometry for microwave integrated circuits, for example. Another application is to produce simple, often-needed geometry such as vias or device structures. This powerful capability provides the user with the tools to automate many tasks.
Scripts are executed in Xic using a high-performance compilation technique whereby the entire script is first compiled, then executed. Looping constructs within the script execute very quickly. Further, scripts can call user-defined functions that have been saved in a library, avoiding the tiny compilation overhead and allowing the user to build a collection of sharable function blocks.
Files named ``library'' in the script search path are read and processed when Xic starts, and during a Rehash command. These files should contain function definitions. The functions will be ``compiled'' and saved within Xic. Any executable lines that are not part of a function block will be executed once only as the library is read. This can provide initialization, if needed.
Functions that are saved will be available for calling from scripts, avoiding having to parse them each time the script is run. This also facilitates using the same functions in several scripts.
The functions saved within Xic can be maintained with two `!' commands: !listfuncs provides a pop-up listing of the functions stored, and !rmfunc allows the user to remove functions from memory.
Script files are created using a text editor, perhaps most conveniently from within the debugger built into Xic, which is accessible from the Debugger button in the User Menu. Scripts can be executed within the debugging environment, which offers single stepping, breakpoints, and other features. The language is rather generic and somewhat reminiscent of the C programming language.
ScriptPath (directory directory1 ... )
This path can also be set with the ScriptPath variable using the !set command. A script path set with the ScriptPath variable takes precedence over a script path defined in the environment using the XIC_SCR_PATH environment variable. If no script path is otherwise specified, the search path used will consist of the single default directory.
Each directory in the search path is expected to contain script files, which must have an extension of ``.scr'', function libraries which are named ``library'', and script menu files, which will produce a drop-down submenu in the User Menu. Script menu files must have an extension ``.scm''. In addition, auxiliary files such a images, referenced in the help text, may also be present.
Scripts can also be included in the technology file itself. These scripts will appear as buttons in the User Menu, as with other scripts. This should be useful for including simple technology-specific commands, such as those that create special extraction layers. However, scripts in the technology file can not be loaded into the debugger.
In the technology file a script is included as follows. The Script keyword is followed by the name which will appear in the command button. This will supersede any script file with the same name. The script text must be terminated with the keyword EndScript. See A.1 for more information.
The !script command is yet another means by which scripts can be placed into the User Menu. This command associates a keyword, which will appear on the menu button, with an arbitrary path to a script file. Commands registered in this way can also be removed with the !script command.
Each entry word in the User Menu is unique in the menu. Script execution has the following priority when names clash:
An encryption capability for scripts is provided. This allows the content of scripts to be hidden from users.