next up previous contents index
Next: Tcl/Tk Support Up: Xic Configuration and Startup Previous: Representing Xic Cells in   Contents   Index


Python Support

This interface is presently not available under Microsoft Windows.

The Python (www.python.org) scripting language is a powerful, versatile language enjoying much popularity. In particular, it has become the language of choice for writing portable parameterized cells, as used in the PyCell Studio project from Ciranova, Inc. (now Synopsys). This download provides the essentials for creating portable pcells, using the Python language, and OpenAccess. Whiteley Research strongly favors this approach, and will integrate Ciranova standards as tightly as possible.

Python is made available, when Python-2.6 or newer is found on the user's computer, via the Python plug-in. Red Hat Enterprise Linux 6 and 7 provide a compatible native Python. Presently, only Python release 2.6 is supported on Red Hat Enterprise Linux 5, so installation of an updated package is required on that operating system.

The Ciranova PCell Studio provides Python 2.6, as well as OpenAccess. If using Ciranova, the Ciranova-supplied Python should be used.

Red Hat Enterprise Linux 6,7
This supplies a native Python-2.6/2.7, which will work with the plug-in without any configuration. Unfortunately, this is not compatible with the Python-2.6 provided by Ciranova. Xic can use either one. The Python-2.6 provided by Ciranova was built with different setup flags for handling UTF8 text than the stock Python-2.6.

Red Hat Enterprise Linux 5
The operating system provides Python-2.4, which is not supported. The Ciranova PyCell Studio provides Python-2.6, which is one source for a compatible Python. Another is to install the python26 extension package. Using the Package Manager or yum, install
epel-release-5-4.noarch.
This will add additional repositories. Then, in the epel repository, find and install a release like ``python26-2.6.8-2.el5.x86_64''.

To use a non-default Python such as that supplied by Ciranova in the PyCell Studio, one will need to set the LD_LIBRARY_PATH variable to include the alternative shared library location. This will happen automatically if Ciranova's setup procedure is followed before starting Xic (see 5.6).

Failure to load the Python plug-in is by default silent. If the environment variable XIC_PLUGIN_DBG is set, diagnostics and error messages will be printed in the console when attempting to load plug-ins at program startup.

When the Python plug-in is loaded, Xic is able to execute Python scripts. This includes stand-alone scripts, and scripts that are used in parameterized cells. Note that Ciranova PyCells, which are also Python-based, are supported via OpenAccess, and are independent of Python support in Xic. However, future plans are to support PyCells natively in Xic. Xic is presently able to support the Ciranova protocols for stretch handles and abutment natively.

This information is preliminary, and may change.

The entire library of native script functions are callable from Python. However, at this point many of the more complicated data types found in the native function library are unsupported. There are two ways to call a native function from Python:

xic.native_func(args, ...)
xic.eval("native_func", args, ...)

The choice of style is up to the user, the first is probably slightly more efficient and is recommended.

The Python script must include some initialization lines in order to use the Xic interface. As a simple example, the script below will draw two boxes in the current cell, using the current layer.

import xic
import xicerr
import sys
sys.stderr = xicerr
xic.Box(2.0, 2.0, 6.0, 7.0)
xic.eval("Box", 1.0, 1.0, 5.0, 6.0)
xic.Commit()

The first line is mandatory for using any native script functions. It loads the Xic interface module.

The next three lines redirect Python error messages to the Xic error reporting system. These are optional, if not included Python messages will be printed on the console window.

The final three lines call functions from the native script library. The first two of these lines illustrate calling the Box function using the two syntax styles. The final line calls the Commit function, which registers the change with the undo system, among other things.

The first four lines are implicitly added during pcell evaluation, thus no not have to be included in a Python pcell script (see 5.1).

Presently, datatypes translate in the following manner. If an un-handled data type is encountered, the script will terminate with a fatal error.

Xic type Python type
string String.
scalar Float.
array List of float.
zlist List of ``zlist'' followed by lists of six integers (LL, LR, YL, UL, UR, YU in internal units).
handle A list containing ``xic_handle'', followed by the handle integer value. For stringlist handles only, the strings follow.

When these forms are passed back to Xic functions, they are reverted to the Xic data type. Note that handles can be passed through Python, but except for stringlist handles they are useless in Python at present.

When the Python plug-in is loaded, the !py command is available. This command will execute a script file containing Python commands, the path to which is given as the argument. Also, the following script functions are available:

RunPython Run a Python script.
RunPythonModFunc Execute a Python module function.
ResetPython Reset the Python interpreter.


next up previous contents index
Next: Tcl/Tk Support Up: Xic Configuration and Startup Previous: Representing Xic Cells in   Contents   Index
Stephen R. Whiteley 2022-05-28