mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-08-29 01:24:39 +02:00
RELEASE 1.0
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env python
|
||||
import gdsMill
|
||||
#we are going to make an array of instances of an existing layout
|
||||
#assume that we designed the "base cell" in cadence
|
||||
#step 1 is to stream it out of cadence into a GDS to work with
|
||||
# creater a streamer object to interact with the cadence libraries
|
||||
streamer = gdsMill.GdsStreamer()
|
||||
|
||||
# use the streamer to take a cadence layout, and convert it to GDS 2 for us to work with
|
||||
# the GDS will be named testLayoutA.gds
|
||||
#streamer.streamFromCadence(cadenceLibraryContainerPath = "~/design/600nmAmi",
|
||||
# libraryName = "gdsMillTest",
|
||||
# cellName = "testLayoutA",
|
||||
# outputPath = "./gdsFiles")
|
||||
|
||||
#next, load our base cell layout from the GDS generated above
|
||||
arrayCellLayout = gdsMill.VlsiLayout()
|
||||
reader = gdsMill.Gds2reader(arrayCellLayout)
|
||||
reader.loadFromFile("./gdsFiles/testLayoutA.gds")
|
||||
|
||||
##since we will be streaming into the same library that testLayout came from
|
||||
#let's rename it here so that we don't overwrite accidentally later
|
||||
arrayCellLayout.rename("arrayCell")
|
||||
|
||||
#now create a new layout
|
||||
#be sure to assign a name, since this will be the root object in our hierarchy to which
|
||||
#all other objects are referenced
|
||||
newLayout = gdsMill.VlsiLayout(name="arrayExample")
|
||||
|
||||
#now place an instnace of our top level layout into the filled layout
|
||||
#hierarchy looks like this:
|
||||
# array example
|
||||
# array cell layout
|
||||
# layout elements
|
||||
# layout elements
|
||||
# layout elements
|
||||
# cell instance
|
||||
# cell instance
|
||||
# cell instance
|
||||
# connection elements .....
|
||||
|
||||
#now create the array of instances
|
||||
for xIndex in range(0,10):
|
||||
for yIndex in range(0,10):
|
||||
if(yIndex%2 == 0):
|
||||
mirror = "MX"
|
||||
else:
|
||||
mirror = "R0"
|
||||
newLayout.addInstance(arrayCellLayout,
|
||||
offsetInMicrons = (xIndex*10.0,yIndex*15.0),
|
||||
mirror = mirror,
|
||||
rotate = 0.0)
|
||||
|
||||
#add a "wire" that in a real example might be a power rail, data bus, etc.
|
||||
newLayout.addPath(layerNumber = newLayout.layerNumbersInUse[7],
|
||||
coordinates = [(-20.0,0.0),(25.0,0),(25.0,10.0)],
|
||||
width = 1.0)
|
||||
|
||||
#add some text that in a real example might be an I/O pin
|
||||
newLayout.addText(text = "Hello",
|
||||
layerNumber = newLayout.layerNumbersInUse[5],
|
||||
offsetInMicrons = (0,0),
|
||||
magnification = 1,
|
||||
rotate = None)
|
||||
|
||||
|
||||
newLayout.prepareForWrite()
|
||||
|
||||
#and now dump the filled layout to a new GDS file
|
||||
writer = gdsMill.Gds2writer(newLayout)
|
||||
writer.writeToFile("./gdsFiles/arrayLayout.gds")
|
||||
#and stream it into cadence
|
||||
#streamer.streamToCadence(cadenceLibraryContainerPath = "~/design/600nmAmi",
|
||||
# libraryName = "gdsMillTest",
|
||||
# inputPath = "./gdsFiles/arrayLayout.gds")
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python
|
||||
import gdsMill
|
||||
|
||||
#we will add the filler at a higher level of hiearchy
|
||||
#so first, load our top level layout from GDS
|
||||
myTopLevelLayout = gdsMill.VlsiLayout()
|
||||
reader = gdsMill.Gds2reader(myTopLevelLayout)
|
||||
reader.loadFromFile("./gdsFiles/testLayoutA.gds")
|
||||
|
||||
#now create a new layout
|
||||
#be sure to assign a name, since this will be the root object in our hierarchy to which
|
||||
#all other objects are referenced
|
||||
filledLayout = gdsMill.VlsiLayout(name="filledLayout")
|
||||
|
||||
#now place an instnace of our top level layout into the filled layout
|
||||
#hierarchy looks like this:
|
||||
# filled layout
|
||||
# top level layout
|
||||
# layout elements
|
||||
# layout elements
|
||||
# layout elements
|
||||
# fill elements
|
||||
# fill elements .....
|
||||
filledLayout.addInstance(myTopLevelLayout,
|
||||
offsetInMicrons = (0,0),
|
||||
mirror = "",
|
||||
rotate = 0.0)
|
||||
|
||||
#now actaully add the fill - gds mill will create an array of boxes
|
||||
# maintaining spacing from existing layout elements
|
||||
#we'll do it once for two different layers
|
||||
filledLayout.fillAreaDensity(layerToFill = myTopLevelLayout.layerNumbersInUse[5],
|
||||
offsetInMicrons = (-10.0,-10.0), #this is where to start from
|
||||
coverageWidth = 40.0, #size of the fill area in microns
|
||||
coverageHeight = 40.0,
|
||||
minSpacing = 0.5, #distance between fill blocks
|
||||
blockSize = 2.0 #width and height of each filler block in microns
|
||||
)
|
||||
filledLayout.fillAreaDensity(layerToFill = myTopLevelLayout.layerNumbersInUse[7],
|
||||
offsetInMicrons = (-11.0,-11.0), #this is where to start from
|
||||
coverageWidth = 40.0, #size of the fill area in microns
|
||||
coverageHeight = 40.0,
|
||||
minSpacing = 0.5, #distance between fill blocks
|
||||
blockSize = 3.0 #width and height of each filler block in microns
|
||||
)
|
||||
#and now dump the filled layout to a new GDS file
|
||||
writer = gdsMill.Gds2writer(filledLayout)
|
||||
writer.writeToFile("./gdsFiles/filledLayout.gds")
|
||||
#and strea
|
||||
streamer = gdsMill.GdsStreamer()
|
||||
streamer.streamToCadence(cadenceLibraryContainerPath = "~/design/600nmAmi",
|
||||
libraryName = "gdsMillTest",
|
||||
inputPath = "./gdsFiles/filledLayout.gds")
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
#-----------------------------
|
||||
#Need a path to a recent python distribution
|
||||
#If a recent one is already installed locally, just comment this out
|
||||
#setenv PATH /some/path/to/python/Python2.6.1/bin\:$PATH
|
||||
|
||||
#-----------------------------
|
||||
#To do automatic stream IN/OUT, we need a path to PIPO (the cadence stream executable)
|
||||
#PIPO is usually inside the dfII/bin directory of your cadence installation
|
||||
#if not used, this can be commented out
|
||||
#setenv PATH /some/path/to/cadence/ic-5.141_usr5/tools/dfII/bin\:/some/path/to/cadence/ic-5.141_usr5/tools/bin\:$PATH
|
||||
|
||||
#-----------------------------
|
||||
#This is the search path where Python will find GDSMill
|
||||
if ( ! ($?PYTHONPATH) ) then
|
||||
setenv PYTHONPATH /design/common/GDSMill
|
||||
else
|
||||
setenv PYTHONPATH /design/common/GDSMill\:$PYTHONPATH
|
||||
endif
|
||||
|
||||
#-----------------------------
|
||||
#If you are going to use GDS Mill in conjunction with a particular Cadence work directory, it often makes sense to source the shell script
|
||||
#required within that directory (for example, a shell script in my work directory sets up permissions to access the design kit files)
|
||||
source ~/design/600nmAmi/600nmAmi.cshrc
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python
|
||||
import gdsMill
|
||||
|
||||
#creater a streamer object to interact with the cadence libraries
|
||||
streamer = gdsMill.GdsStreamer()
|
||||
|
||||
#use the streamer to take a cadence layout, and convert it to GDS 2 for us to work with
|
||||
#the GDS will be named testLayoutA.gds
|
||||
streamer.streamFromCadence(cadenceLibraryContainerPath = "/soe/bchen12/openram/branches/newptx/freepdk45/openram_temp",
|
||||
libraryName = "gdsMillTest",
|
||||
cellName = "testLayoutA",
|
||||
outputPath = "./gdsFiles")
|
||||
|
||||
#create a layout object - this object represents all of the elements within the layout
|
||||
myLayout = gdsMill.VlsiLayout()
|
||||
|
||||
#give our layout object to a gds reader object. The gds reader will look at the binary gds 2 file and
|
||||
#populate the layout object with the file's contents
|
||||
reader = gdsMill.Gds2reader(myLayout)
|
||||
|
||||
#tell the reader object to process the gds file that we streamed in above
|
||||
#un-comment the next line to see some details about the gds contents
|
||||
#reader.debugToTerminal=1
|
||||
reader.loadFromFile("./gdsFiles/testLayoutA.gds")
|
||||
|
||||
#our layout object now contains all of the elements of the layout
|
||||
#let add a box to the layout
|
||||
myLayout.addBox(layerNumber = myLayout.layerNumbersInUse[0], #pick some layer
|
||||
offsetInMicrons = (-10,0), #location
|
||||
width = 10.0, #units are microns
|
||||
height = 5.0,
|
||||
# updateInternalMap = True, #This is important for visualization - see note 1 below
|
||||
center = True) #origin is in the center or the bottom left corner
|
||||
#Note 1:the layout object keeps track of its elements in a 2D map (no hiearachy)
|
||||
#this makes visualization more efficient. Therefore, to do a PDF output or some other
|
||||
#flat output, you need to "update the internal map" of the layout object. Only do this
|
||||
# ONE TIME after all the objects you are manipulating are fixed
|
||||
|
||||
#let's take out new layout and stream it back into a cadence library
|
||||
#first, create a new GDS
|
||||
#we change the root structure name (this will be the cellview name upon stream in)
|
||||
myLayout.rename("testLayoutB")
|
||||
writer = gdsMill.Gds2writer(myLayout)
|
||||
writer.writeToFile("./gdsFiles/testLayoutB.gds")
|
||||
|
||||
streamer.streamToCadence(cadenceLibraryContainerPath = "~/design/600nmAmi",
|
||||
libraryName = "gdsMillTest",
|
||||
inputPath = "./gdsFiles/testLayoutB.gds")
|
||||
|
||||
#let's create a PDF view of the layout object
|
||||
#first, create the object to represent the visual output
|
||||
visualizer = gdsMill.PdfLayout(myLayout)
|
||||
|
||||
#since we have no knowledge of what the layer numbers mean for this particular technology
|
||||
#we need to assign some colors to them
|
||||
|
||||
#uncomment the following line if you want to actually see the layout numbers in use
|
||||
#print myLayout.layerNumbersInUse
|
||||
|
||||
#for each layer number used in the layout, we will asign it a layer color as a RGB Hex
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[0]]="#219E1C"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[1]]="#271C9E"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[2]]="#CC54C8"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[3]]="#E9C514"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[4]]="#856F00"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[5]]="#BD1444"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[6]]="#FD1444"
|
||||
visualizer.layerColors[myLayout.layerNumbersInUse[7]]="#FD1414"
|
||||
|
||||
#set the scale so that our PDF isn't enormous
|
||||
visualizer.setScale(500)
|
||||
#tell the pdf layout object to draw everything in our layout
|
||||
visualizer.drawLayout()
|
||||
#and finally, dump it out to a file
|
||||
visualizer.writeToFile("./gdsFiles/gdsOut.pdf")
|
||||
|
||||
Reference in New Issue
Block a user