Creating Interoperable PCells Using the Python Language file:///gfs/ind/tcsnas01/eesof/build/apps/linux_x86/synopsys/customcompiler/U-2023.03/doc/help/col...
Creating Interoperable PCells Using the Python Language
PyCells are OpenAccess-based parameterized cells (PCells) that allow the
designers to specify a set of input values for a PCell and instantiate that PCell
in any OpenAccess design database.
A PyCell supports the following layout design capabilities:
• Auto-abutment of MOSFETs
• Stretch handles for MOSFETs
• DFM options
The Custom Compiler tools support PyCells for all oaDesigns, which includes
oaReservedViewType, maskLayout, schematic, and schematicSymbol view
types.
This section covers the following topics:
• Writing the PyCell Code
• Creating the __init__.py File
• Creating the PyCell SuperMaster
Writing the PyCell Code
The following is the syntax of a PyCell code construct for a cell:
Syntax:
from <synopsysPackage> import(
List of APIs separated by commas.
)
class <className>(<APIbaseClassName>):
@classmethod
def defineParamSpecs():
...
def setupParams():
...
def genLayout():
...
Refer to the PyCell Studio documentation for details.
Following is a PyCell code example for a diode:
##########################
#
# diode.py
#
##########################
# Import APIs to be used for creating the PyCells
from cni.dlo import(
Box,
DloGen,
GapStyle,
Layer,
MultiPath,
Rect,
Term,
TermType,
)
# API class names:
##### class name ### base class name
class DiodeTemplate(DloGen):
# Start of class methods
@classmethod
# Define parameters and their legal values
def defineParamSpecs( cls, specs):
specs( "length", 1)
specs( "width", 1)
# Reads and processes parameter values entered by the user
def setupParams( self, params):
# Diode W & L
self.width = params["width"]
self.length = params["length"]
# Create Term and Pin for inside and outside terminals
self.insideTermId = Term( "minus",TermType.INPUT_OUTPUT)
self.insidePinId = Pin("minus","minus")
self.outsideTermId = Term("plus",TermType.INPUT_OUTPUT)
self.outsidePinId = Pin("plus", "plus")
Creating the __init__.py File
After you create your PyCells, you need to define them in the __init__.py file,
so that the PyCells are packaged with the iPDK.
Syntax:
1 of 2 2/21/25, 02:35
Creating Interoperable PCells Using the Python Language file:///gfs/ind/tcsnas01/eesof/build/apps/linux_x86/synopsys/customcompiler/U-2023.03/doc/help/col...
import <PyCell_filename>
def definePcells(lib):
lib.definePcell(<PyCell_filename>.<className>, <cellName>)
...
Example 1: Sample __init__.py file
import diode
def definePcells(lib):
lib.definePcell(diode.np, "np")
Creating the PyCell SuperMaster
After you create the __init__.py file, you need to create the PyCell
SuperMaster.
Synopsys provides the cngenlib utility to update your OpenAccess database
library with different PyCell definitions, or to update the technology binding for
your OpenAccess PyCell library.
Syntax:
cngenlib --update
pkg:<package>
<libraryName>
./<path to library>
Argument Description
--update Option to update the PyCell library.
pkg Path to the PyCell code directory.
libraryName Name of the OpenAccess library that must be updated.
path to library Path to the OpenAccess library.
Refer to the PyCell Studio documentation for details.
Example 2: Sample cngenlib command
cngenlib --update
pkg:pyCells
sampleLib "./Diodepycell/sampleLib"
2 of 2 2/21/25, 02:35