Glade Reference
A cellView stores design data. It is a unique combination of a cell and a view. A cellView corresponds to GDS2 STRUCTs, LEF MACROs or a DEF DESIGN. A cellView is stored in a library. The cellView access functions are as follows. Note that all coordinate values are expected in database units. To find the number of database units per micron, use the library dbuPerUU() function.
Creating or opening cellViews
A cellView is created using a library object.
Create a cellView in an existing library lib with cell cellName and view viewName. The function returns a cellView. mode is a single character denoting the access mode; 'r' signifies readonly access, 'w' signifies write access (the cellview should not already exist and will be created), and 'a' signifies append access (the cellview already exists and is opened for modification). Note that after creating a new cellView and any objects in it, update() must be called to build the data structures before editing/viewing/querying.
Creating objects in a cellView
A cellView contains shape and instance/array objects. Shape objects are created on a specified layer number, which is internally represented by a signed 16 bit integer value. To get a layer number given a layer name and purpose, you can use the techfile class functions to get and manipulate layers.
layer = tech.getLayerNum(layerName, purposeName)
Create an arc with the specified origin, X and Y radius. The arc is part of an ellipse with the specified startAngle and spanAngle. Angles are referenced from the 3pm position, with positive angles going anticlockwise.
Create an array in the cellView and returns the array created. The array master cellView is specified by libName, cellName and viewName. The array's origin is given by origin and its orientation by orient. The enumerations R0, R90, R180, R270, MX, MXR90, MY, MYR90 can be used to specify the orientation. Orientations other than variants of 90 degrees are not supported. The magnification is specified by mag. If specified, instName is used to name the instance; else the instance name is autogenerated with the first being I0, then I1, I2 etc. numRows specifies the number of rows and must be greater than 0. numCols specifies the number of columns and must be greater than 0. rowSpacing is the spacing between rows and can be negative or positive, as can colSpacing.
Create an array in the cellView and returns the array created. This is identical to the above but takes a library *, rather than a library name, as argument. The array master cellView is specified by libName, cellName and viewName. The array's origin is given by origin and its orientation by orient. The enumerations R0, R90, R180, R270, MX, MXR90, MY, MYR90 can be used tp specify the orientation. Orientations other than variants of 90 degrees are not supported. The magnification is specified by mag. If specified, instName is used to name the instance; else the instance name is autogenerated with the first being I0, then I1, I2 etc. numRows specifies the number of rows and must be greater than 0. numCols specifies the number of columns and must be greater than 0. rowSpacing is the spacing between rows and can be negative or positive, as can colSpacing.
Create a circular ellipse, i.e. one with the same X and Y radius.
Create an ellipse with given origin (the centre of the ellipse), xRadius, yRadius and layer number
Creates a group with name name, origin at origin, and orientation orient.
Creates a hole in a polygon . The hole to be 'cut' is represented by the polygon defined by xpts, ypts, nPoints. The polygon and hole are on layer lyr. If obj is non-null, it is assumed to be the polygon to cut the hole in; if non-null, the largest polygon that overlaps the hole will be cut. In general, it is better to use the boolean operations to cut holes in polygons as they are more robust.
Similar to above but uses a Point *
Similar to above but uses a shape to cut a hole in this polygon. The shape acts like a 'cookie-cutter' to create the hole.
A HSeg is a horizontal track segment. HSegs are a memory efficient way of representing a two point path with a given layer that has a fixed width and style, and as such are used in representing DEF regular net routing. This function creates a HSeg object in the cellView and returns the HSeg created. (x1, y1) is the first point of the HSeg, (x2, y2) is the second point. layer is the layer the HSeg is created on. width is the HSeg width (defaults to 0) and style is the HSeg's path style (defaults to truncated). If the cellView's library does not contain a segparam index for the HSeg with matching layer and width/style, one is created.
Create an inst in the cellView and returns the instance created. The instance master cellView is specified by libName/cellName/viewName. The instance's origin is given by origin and its orientation by orient. The enumerations R0, R90, R180, R270, MX, MXR90, MY, MYR90 can be used to specify the orientation. Orientations other than variants of 90 degrees are not currently supported. The magnification is specified by mag. If specified, instName is used to name the instance; else the instance name is autogenerated with the first being I0, then I1, I2 etc.
Create an inst in the cellView and returns the instance created. This is identical to the above but takes a library *, rather than a library name, as argument. The instance master cellView is specified bycellName/viewName. The instance's origin is given by origin and its orientation by orient. The enumerations R0, R90, R180, R270, MX, MXR90, MY, MYR90 can be used to specify the orientation. Orientations other than variants of 90 degrees are not currently supported. The magnification is specified by mag. If specified, instName is used to name the instance; else the instance name is autogenerated with the first being I0, then I1, I2 etc.
Creates a label in the cellView at location origin with text name and returns the label created. The orientation of the label is given by orient and the label height by height. presentation is the alignment of the text label and layer is the label's layer.
Creates a wire in the cellView with vertices defined by points p1 and p2 on layer layer and returns the line created.
Creates a wire in the cellView with vertices defined by integer arrays x and y with size numPoints on layer layer and returns the line created.
Creates a wire in the cellView with vertices defined by the python list of Point s list. numPoints is the number of points. The line is created on layer layer..
Creates a lpp in the cellView.
Creates a MPP (MultiPartPath) in the cellView and returns the mpp created. ruleName is the name of the MPP rule. The array xpts and ypts are the X and Y coordinates of the path. nPoints specifies the number of points.
Similar to above but uses a Point *
Creates a MPP (MultiPartPath) in the cellView and returns the mpp created. The python list the coordinates of the path. ruleName is the name of the MPP rule. nPoints specifies the number of points.
myguard = cv.dbCreateMPP('pguard', [[0,0],[1000,0],[1000,1000],[0,1000]], 4)
Creates a MPP (MultiPartPath) in the cellView using the specified rule ruleName and returns the mpp created. The pts are the coordinates of the path. nPoints specifies the number of points. ruleName is the name of the (existing) mpp rule, as defined in the techfile.
Creates a MPP (MultiPartPath) in the cellView using the specified rule and returns the mpp created. The array xpts and ypts are the X and Y coordinates of the path. numPoints specifies the number of points.
Creates a MPP (MultiPartPath) in the cellView using the specified rule rule and returns the mpp created. The pts are the coordinates of the path. nPoints specifies the number of points. ruleName is the name of the (existing) mpp rule, as defined in the techfile.
Creates a MPP (MultiPartPath) in the cellView using the specified rule rule and returns the mpp created. The python list the coordinates of the path. nPoints specifies the number of points.
poly = cv.dbCreateMPP(rule, [[0,0],[1000,0],[1000,1000],[0,1000]], 4)
Create a path object in the cellView and returns the path created. The array xpts and ypts are the X and Y coordinates of the path. numPoints specifies the number of points and layer the layer the polygon is created on. width is the width of the path and style the path style (0 = TRUNCATE, 1 = ROUND, 2 = EXTEND, 4 = VAREXTEND, 8 = OCTAGONAL). If the path style is type 4, varExtend, then beginExtent and endExtent specify the path extension beyond the beginning and ending points.
Similar to above but uses a Point *
Create a path object in the cellView and returns the path created. The python list is a list of points, each of which is a list of x and y coordinates of the point. numPoints specifies the number of points and layer the layer the polygon is created on. width is the width of the path and style the path style (0 = TRUNCATE, 1 = ROUND, 2 = EXTEND, 4 = VAREXTEND, 8 = OCTAGONAL). If the path style is type 4, varExtend, then beginExtent and endExtent specify the path extension beyond the beginning and ending points.
Create a polygon object in the cellView and returns the polygon created. The array xpts and ypts are the X and Y coordinates of the polygon and should be created in python using the intarray() function. numPoints specifies the number of points and layer the layer the polygon is created on. If use_poly is false (the default), a rectangle will be created instead of a polygon if possible.
For example to create a triangle on layer 3 in python:
numPoints = 3 x = intarray(numPoints) y = intarray(numPoints) x[0] = 0 y[0] = 0 x[1] = 2000 y[1] = 0 x[2] = 0 y[2] = 2000 layer = 3 poly = cv.dbCreatePolygon(x, y, numPoints, layer)
Similar to above but uses a Point*
Similar to the above, but uses a python list of points, each of which is a list of x and y coordinates of the point.
poly = cv.dbCreatePolygon([[0,0],[1000,0],[1000,1000],[0,1000]], 4, 3)
Creates a rectangle object in the cellView with bounding box box and on layer layer and returns the created rectangle. If use_rect is false (the default), a square will be created instead of a rectangle if the box width equals the box height.
For example to create a rectangle on layer 3 in python:
box = Rect(0, 0, 1000, 2000) layer = 3 cv.dbCreateRect(box, layer)
Creates an viaInst of a via with master name, origin origin and orient orient and returns the viaInst created.
A VSeg is a vertical track segment. VSegs are a memory efficient way of representing a two point path with a given layer that has a fixed width and style, and as such are used in representing DEF regular net routing. This function creates a VSeg object in the cellView and returns the VSeg created. (x1, y1) is the first point of the VSeg, (x2, y2) is the second point. layer is the layer the VSeg is created on. width is the VSeg width (defaults to 0) and style is the VSeg's path style (defaults to truncated). If the cellView's library does not contain a segparam entry for the VSeg, one will be created with matching layer and width/style, one is created.
Gets a group with name name if it exists, or nullptr if it is not found.
Finds the instance with name name in the cellView and returns it, or null if not found.
Finds the instance with case-insensitive name name in the cellView and returns it, or null if not found.
Finds the instance with name given by regular expression expr in the cellView and returns it, or null if not found.
Creating connectivity in a cellView
A cellView can also contain connectivity, such as nets, pins and ports (physical pin shapes).
Creates a net in the cellView with name name and returns the net created. If the net already exists in the cellView, the net is not created and the net given by name is returned.
Finds the net with name name in the cellView and returns it, or null if not found.
Creates a logicalpin in the cellView with name name and db_PinDirection dir for the net n and returns the pin created. The net n must exist in the cellView.
Finds the pin with name name in the cellView and returns it, or null if not found.
Creates a port for pin p . A port is a physical representation of a pin so a valid shape s must be specified.
Delete the database object object. If reallyDelete is true, the object is deleted, else it is just removed from the object trees (and hence undoing the delete is possible). If opt is true, the tree is (re)optimised after the delete.
Delete the pin object. If reallyDelete is true, the object is deleted, else it is just removed from the object trees (and hence undoing the delete is possible).
Delete the net object. If reallyDelete is true, the object is deleted, else it is just removed from the object trees (and hence undoing the delete is possible).
Merges the net from into net to. All shapes have their connectivity reassigned to the to net; the from net is deleted from the cellView.
Creating and updating PCell instances in a cellViewb>
PCell (programmable cell) instances can be created in a cellView. See also loadPCell.
Create an instance of a PCell in the cellView and returns the instance created. The PCell master must have been previously created e.g. by a call to ui::loadPCell(). libName is the library name containing the pcell, cellName is the cellView name of the PCell and viewName is the view type of the PCell. origin is the instance's origin. If specified, orient is the instance's orientation, otherwise defaulting to R0. If numRows or numCols are not 1, an array is created of PCells.
Updates a PCell instance after any of its properties have been changed. This is equivalent to querying the PCell instance properties in the GUI and changing them. Note that the originalInst is destroyed, and newInst is created.
If you change your PCell python code and wish to update all existing instances of the PCell in a cellView, you can use this function.
Sets this cellView to be a PCell superMaster.
returns true if the cellView is a PCell superMaster.
Sets this cellView to be a PCell subMaster.
Returns true if the cellView is a PCell subMaster.
Sets the name of the PCell.
Gets the PCell name.
Sets the PCell filename.
Gets the PCell filename.
Searching for objects in a cellView
Searches the area given by box for any objects whose bounding boxes overlap the area. If allLayers is 0, then shapes on only the specified layer are returned. If allLayers is 1, shapes on all layers are searched. If instsToo is 1, any instances whose bounding box overlaps the area are returned in addition to any valid shapes, similarly is viaInstsToo is 1 then any via insts that overlap are also checked.
As dbGetOverlaps, but appends objects found to list. The number of objects found is returned.
As above, but returns a Python list of dbObj.
Searches the are given by box for any objects whose bounding boxes overlap the area. If allLayers is 0, only the shapes on the specified layer are returned. If allLayers is 1, shapes on all layers are searched. The search is carried out hierarchically up to level levels deep. The number of objects found is returned.
Searches the are given by box for any objects whose bounding boxes overlap the area. If allLayers is 0, only the shapes on the specified layer are returned. If allLayers is 1, shapes on all layers are searched. The search is carried out hierarchically up to level levels deep.The number of objects found is returned.
A dbHierObj is a simple class containing the object itself, the cellView containing the object and the transform of the object relative to the top level.
As above, but returns a Python list of dbHierObjs.
cellView utility functions
Returns the user units as inches or microns.
Sets the user units. units can be either inches or microns.
Returns the number of database units per user unit. The default number of dbu is 1000 if user units are microns, and 160 if user units are inches.
Sets the database units per user unit.
Updates the cellView's bounding box to enclose all objects it contains. This function is deprecated and update() should be used.
Build the internal data structures for the cellView. This must be called after creating any objects in a new cellView, but before viewing / editing / querying the cellView. This function is deprecated and update() should be used.
Sets the cellView editable flag.
Gets the cellView editable flag.
Sets the cellView edited flag.
Gets the cellView edited flag.
Calls updateBbox(), optimiseTrees(), sets the cellView as edited and sets the modification date. This should be called after a modification, or a set of modifications, to the cellView. For perfomance reasons it is better to call this after a set of operations rather than for each operation.
Get the bounding box of the cellView as a Rect.
Get the bounding box of the cellView as a QRect.
Resets the cellView's bounding box to (0,0) (0,0).
The existing cellView's bounding box becomes the union of the current bounding box and box.
Gets the cellView's boundary rectangle, if such a shape exists on the boundary drawing layer.
Delete the database object object. If reallyDelete is true, the object is deleted, else it is just removed from the object trees (and hence undoing the delete is possible). If opt is true, the tree is (re)optimised after the delete.
Get the number of shapes in the cellview.
Gets the number of shapes on a specific layer, where lyr is the layer number.
Get the number of instances in the cellview.
Get the number of viaInsts in the cellview
Get the number of nets in the cellview.
Get the number of pins in the cellview.
Get the cellview's library.
Sets the cellView's library.
Get the cellview's name.
Sets the cellView's cell name.
Get the cellview's viewname.
Sets the cellView's view name.
Sets the cellView's create date. This is a 6 byte array of the form YY-MM-DD-HH-MM-SS
Gets the cellView's create date.
Sets the cellView's modification date. This is a 6 byte array of the form YY-MM-DD-HH-MM-SS
Gets the cellView's modification date.
Increment the cellView's edit/modification count.
Decrement the cellView's modification count.
Get the cellView's modification count; if zero the cell has not been edited.
Get the nearest segment (object edge) to a point p in the cellview, up to a maximum distance dist.
Get the nearest object to a point p in the cellview, up to a maximum distance dist.
Get the lpp list for this cellView as a std::map
Get the layer-purpose pair with layer number layer in this cellview.
Get the layer-purpose pair with layer layerName and purpose purposeName in this cellview.
Delete the layer-purpose pair lpp in this cellview. All objects (shapes, insts and viaInsts) on that lpp will be deleted.
Returns a Python list of all layer-purpose pairs in the cellview. This is a python wrapper created using the SWIG %extend function.
Get the number of lpps in the cellview
Returns a Python list of all instances in the cellView. This is a python wrapper created using the SWIG %extend function.
Returns a Python list of all nets in the cellView. This is a python wrapper created using the SWIG %extend function.
Returns a Python list of all pins in the cellView. This is a python wrapper created using the SWIG %extend function.
An example of using the access functions to create text labels on pins follows.
# script to create labels from pins # # Get the current edit cellView, lib and technology cv = getEditCellView() lib = cv.lib() tech = lib.tech() # # Get desired pin layer lyr = tech.getLayerNum("text", "drawing") # # Iterate over all top level pins # pins = cv.getPins() for pn in pins : name = pn.name() # Get the pin shapes and iterate over them shapes = pn.getPorts() for shp in shapes : box = shp.bBox() origin = box.centre() cv.dbCreateLabel(origin, name, R0, 1.0, centreCentre, lyr) # end while # end while # # commit edits cv.update()
Rounds the shape shp with the radius given in dbu, using a minimum number of segments segs, and snaps the vertices of the curve to grid in microns. inner_radius is the radius of inner (concave) corners; outer_radius is the radius of outer (convex) corners.
Instead of using getInsts/getNets/getPins/getLpps it is possible to use iterators in Python:
Initialises the inst iterator for the cellView. For example:
# Script to print instance names in a cellview # from ui import * # cv = getEditCellView() iter = instIterator(cv) while not iter.end() : inst = iter.value() name = inst.instName() print "inst name = ", name iter.next() #
Advances the iterator to the next instance.
Returns false if there are more instances, else returns true if there are no more.
Returns the current instance.
Initialises the net iterator for the cellView. The iterator has similar next(), end();and value() functions as above.
Initialises the pin iterator for the cellView. The iterator has similar next(), end() and value() functions as above.
Initialises the dbLpp iterator for the cellView. The iterator has similar next(), end() and value() functions as above.
Initialises the dbObj iterator for a dbObjList. The iterator has similar next(), end() and value() functions as above.
Initialises the shape iterator for a shape. The iterator has similar next(), end() and value() functions as above.
Provided for documentation of the C++ API only.
Gets the hash table of instances.
Gets the hash table of nets.
Gets the hash table of pins.
Copyright © Peardrop Design 2024.