Glade Reference


Libraries

All design data is stored in libraries. Libraries contain cells and views; the combination of a cell and a view is a cellView, which contains the actual design data. For example a library may contain a cell 'NAND2'. This cell may contain a cellView 'NAND2' 'layout', where 'layout is the view of the cell.

 

library * library::library(const char *fred)

Construct a library called "fred", returning the library object. A default techfile is created with system layers only.

 

bool library::dbOpenLib(const char *libPath)

Opens and reads a previously saved library. libPath is the full path to the library, including the library name. Returns true if the library can be opened successfully, otherwise false. Note you need to create a library object before you can read a saved library.

 

bool library::dbSaveLib(const char *libPath)

Saves a library to disk. libPath is the full path to the library, including the library name. Returns true if the library can be saved successfully, otherwise false.

 

library::dbClose(const char *cellName, const char *viewName)

Closes a cellview. Currently this does not purge the cellview from virtual memory.

 

list library::cellNames()

Returns a Python list of all the cell names in the library.

 

list library::getCells()

Returns a Python list of the cells in the library.

 

list library::viewNames()

Returns a Python list of all the view names in the library.

 

list library::getViews()

Returns a Python list of the views in the library.

 

int library::dbu()

Return the size of a database unit in meters. Deprecated, use cellView::dbu().

 

int library::dbuPerUU()

Return the number of database units per micron (defaults to 1000). Deprecated, use cellView::dbuPerUU(.)

 

library::dbBindInstMasters()

Rebinds the instance masters for this library. All cellViews in the library are checked, and if their master cellView is unbound, then a search is performed in the currently open libraries in an attempt to rebind it. For example, to rebind all open libraries you can use the following:

			libs = getLibList()
			for lib in libs :
				lib.dbBindInstMasters()
			

cellView * library::dbOpenCellView(const char *cellName, const char *viewName, char mode)

Returns a cellView object. "mode" can be 'r', 'w' or 'a'. 'w' mode is used to create a new cellView; the cellView must not exist. 'a' mode is used to append (edit) an existing cellView; the cellView must exist. 'r' mode is used to read an existing cellView; the cellView must exist. An exception is thrown on failure.

 

bool library::dbCopyCellView(const char *newCellName, const char *newViewName, const char *oldLibName, const char *oldCellName, const char *oldViewName)

Copies a cellview. Returns true if successful.

 

bool library::dbRenameCellView(const char *newCellName, const char *newViewName, const char *oldCellName, const char *oldViewName)

Renames a cellView. Returns true if successful.

 

cellView * library::dbFindCellViewByName(const char *cellName, const char *viewName)

Returns a cellView object corresponding to the given cellName and viewName, or None if it does not exist in the library.

 

cell * library::dbFindCellByName(const char *cellName)

Returns a cell object corresponding to the given cellName, or None if it does not exist.

 

view * library::dbFindViewByName(const char *viewName)

Returns a view object corresponding to the given viewName, or None if it does not exist.

 

bool library::dbDeleteCellView(const char *cellName, const char *viewName)

Deletes the cellview specified by cellName and viewName and returns true if sucessful, None if not.

 

bool library::dbRenameCell(const char *newCellName, const char *oldCellName)

Renames a cell. Returns true if sucessful, false if not.

 

bool library::dbDeleteCell(const char *cellName)

Deletes the cell specified by cellName and returns true if sucessful, false if not.

 

char * library::libName()

Returns the name of the library.

 

char * library::libPath()

Returns the library path if the library has been read or saved on disk, otherwise None.

 

techfile * library::tech()

Returns a pointer to the library's techfile.

 

library * db::getLibByName("libName")

Get a library by name.

 

int library::addVia(via *v, bool check)

Adds a via  v to the library via table and returns the via's index in that table. If check is true (the default is false), the via name is checked and the new via will NOT be added; the index returned is that of the existing via.

 

via * library::getVia(int index)

Gets a via by index from the library. No bounds checking is performed.

 

via * library::getViaByName(const char *name)

Gets a via by name.

 

int library::getViaIndexByName(const char *name)

Gets a via's index by the via name.

 

const char * library::getViaNameByindex(int index)

Gets a via's name from its index.

 

int library::getNumVias()

Gets the number of vias in the library's via table. Note the table size is currently limited to 8192 vias.

 

 

Iterators

It is possible to use iterators in Python:

iter = cellIterator(library *lib)

Initialises the cell iterator for the library. For example:

			# Script to print cell names in a library
			#
			from ui import *
			#
			cv = getEditCellView()
			lib = cv.lib()
			iter = cellIterator(lib)
			while not iter.end() :
				cell = iter.value()
				name = cell.name()
				print "Cell name = ", name
				iter.next()
			#
		

iter.next()

Advances the iterator to the next instance.

 

bool iter.end()

Returns false if there are more instances, else returns true if there are no more.

 

inst = iter.value()

Returns the current instance.

 

iter = viewIterator(library *lib)

Initialises the view iterator for the library. The iterator has similar next(), end();and value() functions as above.

 

 

Contents|Index

Copyright © Peardrop Design 2024.