next up previous contents index
Next: Cell Info Up: Main Functions 1 Previous: Main Functions 1   Contents   Index


Current Cell

(int) Edit(name, symname)
This function will read in the named file or cell and make it, or one of the cells in the hierarchy, the current cell. If the present cell has been modified, in graphics mode the user is prompted for whether to save the cell before reading the new one. The name argument can be null or empty, in which case the user will be prompted for a file or cell to open for editing, if in graphics mode. If not in graphics mode, an empty cell is created in memory and made the current cell.

The name provided can be an archive file, the name of an Xic cell, a library file, or the ``database name'' of a Cell Hierarchy Digest (CHD). If a CHD name or the name of an archive file is given, the name of the cell to open can be provided as symname. If symname is null or empty, The CHD's default cell, or the top level cell (the one not used as a subcell by any other cells in the file) is the one opened for editing. If there is more than one top level cell, in graphics mode the user is presented with a pop-up choice menu and asked to make a selection. If the file is a library file, the symname can be given, and it should be one of the reference names from the library, or the name of a cell defined in the library. If symname is null or empty, in graphics mode a pop-up listing the library contents will appear, allowing the user to select a reference or cell. If not in graphics mode, and the cell to edit can not be determined, the current cell is unchanged, and nothing is read.

See the table in 14.1 for the features that apply during a call to this function. This function is consistent with the Open menu command in that cell name aliasing, layer filtering and modification, and scaling are not available (unlike in the pre-3.0.0 version of this function). If these features are needed, the vt OpenCell function should be used instead.

The return value is one of the following integers, representing the command status:

-2 The function call was reentered. This is not likely to happen in scripts.
-1 The user aborted the operation.
0 The open failed: bad file name, parse error, etc.
1 The operation succeeded.
2 The read was successful on an archive with multiple top-level cells but the cells to edit can't be determined. The current cell has not been set, but the cells are in memory. The second argument could have been used to resolve the ambiguity.
3 The cell name was the name of the device library or model library file, which has been opened for text editing (in graphic mode only).

(int) OpenCell(name, symname, curcell)
This function will read a file into memory, similar to the Edit function. The first two arguments are the same as would be passed to Edit. The third argument is a boolean value.

See the table in 14.1 for the features that apply during a call to this function.

If curcell is nonzero, then this function will behave like the Edit function in switching the current cell to a newly-read cell. The only difference from Edit is that scaling, layer filtering and aliasing, and cell name modification are allowed, as in the pre-3.0.0 versions of the Edit function. The return values are those listed for the Edit function.

If curcell is zero, the new cell will not be the current cell. Once in memory, the cell is available by its simple name, for use by the Place function for example. If name is the name of an archive or library file, symname is the cell or reference to open, similar to the Edit function. In this mode, the return value is 1 on success, 0 otherwise.

(int) TouchCell(cellname, curcell)
If no cell exists in the current symbol table for the current mode with the given name, create an empty cell for cellname and add it to the symbol table. If the boolean curcell is true, switch the current cell to cellname. This can be much faster than Edit or OpenCell for cells already in memory. The return value is -1 on error, 0 if no new cell was created, or 1 if a new cell was created.

(int) RegisterSubMasters(archive)
Suppose that one has a collection of pcell sub-master Xic cells that have been imported from a foreign OpenAccess tool such as Virtuoso. These are assumed to not be portable pcells. One would like to use these cells to resolve pcells when reading directly from the OpenAccess database. There are two issues: 1) the system needs to know that these cells are available, and 2) one has to remap the cell names. The first issue is fixed simply by making the sub-masters available through the library mechanism. The second issue is due to the simple naming convention of the sub-master instantiations, which suffixes the pcell name with ``$$" followed by an integer. The integer is a count of when the cell was generated, and is consistent with the design output at the time, but there is no guarantee the the names are consistent with the design at other times.

This function will read a collection of cells into a temporary symbol table. Those that are pcell sub-masters have the property strings entered into the internal pcell database, under the existing cell name. This will cause the correct cell name to be associated with a given parameter set. The cells are not saved, but the entries in the pcell table persist so that resolution, when reading OpenAccess or otherwise, will reference the correct cells. The cell collection must be available through an open library, and this function must be run before loading the design.

The argument is either a path to a directory containing native pcell sub-master cells, or a path to an archive file that contains the cells. The return is 1 on success, 0 otherwise with a message available from GetError; This functionality is also available with the !preload command.

(int) Push(object_handle)
This function will push the editing context to the cell of the instance referenced by the handle, that is, make it the currrent cell. The handle is the return value from the SelectHandle or AreaHandle functions. This is similar to the Push command in Xic. The editing context can be restored with the Pop function. If the instance is an array, the 0,0 element will be pushed (see PushElement).

If successful, 1 is returned, otherwise 0 is returned. This function will fail if the handle passed is not a handle to an object list.

This function implicitly calls Commit before the context change.

(int) PushElement(object_handle, xind, yind)
This is very similar to Push, but allows passing indices which select the instance element to push if the instance is arrayed. The indices are always effectively 0 in the Push function. An out of range index value will cause the function to return 0 and not push the context. If both index values are zero, the function is identical to Push. The selection of the array element only affects the graphical display.

This function implicitly calls Commit before the context change.

(int) Pop()
This function will pop the editing context to the parent cell, to be used after the Push function or a Push command in Xic. The Pop function always returns 1, and has no effect if there was no corresponding push.

This function implicitly calls Commit before the context change.

(string) NewCellName()
This function returns a string which is a valid cell name that does not conflict with any cell in the current symbol table. The cell is not actually created. This can be used with the Edit function to open a new cell for editing, similar to the New button in the File Menu. This function never fails.

(string) CurCellName()
The return value of this function is a string containing the name of the current cell.

(string) TopCellName()
The return value of this function is a string containing the name of the top level cell in the hierarchy being edited. This is different from the current cell name while in a subedit (i.e., the Push command is active).

(string) FileName()
This function returns the name of the file from which the current cell was read. If there is no such file, a null string is returned.

(int) CurCellBB(array)
This function will return the bounding box of the current cell, in microns, in the array, as l, b, r, t. The array must have size 4 or larger. The function returns 1 on success, 0 if there is no current cell.

In electrical mode, the bounding box returned will be for the schematiic or symbolic representation, matching how the cell is displayed in the main window. See the CellBB function for an alternative.

(int) SetCellFlag(cellname, flagname, set)
This will set a flag (see 9.4.3) in the cell whose name is passed as the first argument. If this argument is 0, or a null or empty string, the current cell is understood. The second argument is a string giving the flag name. This must be the name of a user-modifiable flag. The third argument is a boolean indicating the new flag state, a nonzero value will set the flag, zero will unset it. The return value is the previous flag status (0 or 1), or -1 on error. On error, a message can be obtained from GetError.

Warning: This affects the user flags directly, and does not update the property used to hold flag status that is written to disk when the cell is saved. These flags should be set by setting the Flags property (property number 7105) with AddProperty or AddCellProperty, if the values need to persist when the cell is written to disk and reread.

(int) GetCellFlag(cellname, flagname)
This will query a flag (see 9.4.3) in the cell whose name is passed as the first argument. If this argument is 0, or a null or empty string, the current cell is understood. The second argument is a string giving the flag name, which can be any or the flag names. The return value is the flag status (0 or 1), or -1 on error. On error, a message can be obtained from GetError.

(int) Save(newname)
This function will save to disk file the current cell, and its descendents if the cell originated from an archive file. If the argument is null or the empty string, the current cell name is used, suffixed with one of the following if saving as an archive:

CGX .cgx
CIF .cif
GDSII .gds
OASIS .oas

The default format will be the format of the original input file, though format conversion can be imposed by adding one of these suffixes or ``.xic'' to newname. The cell is saved unconditionally; there is no user prompt.

See the table in 18.10 for the features that apply during a call to this function.

This function returns 1 on success, 0 otherwise. On error, a message is likely available from GetError.

(int) UpdateNative(dir)
This will write to disk all of the modified cells in the current hierarchy as native cell files in the directory given as the argument. If the argument is null or empty, cells will be written in the current directory. The return value is the number of cells written.

Note that only modified or internally created cells will be written. To write all cells as native cell files, use the ToXIC function.


next up previous contents index
Next: Cell Info Up: Main Functions 1 Previous: Main Functions 1   Contents   Index
Stephen R. Whiteley 2024-09-29