mirror of https://github.com/VLSIDA/OpenRAM.git
Make purposes argument to gdsMill. Create prefixGDS.py script.
This commit is contained in:
parent
a0921b4afc
commit
8d71a98ce9
|
|
@ -20,6 +20,10 @@ from globals import OPTS
|
||||||
from vector import vector
|
from vector import vector
|
||||||
from pin_layout import pin_layout
|
from pin_layout import pin_layout
|
||||||
from utils import round_to_grid
|
from utils import round_to_grid
|
||||||
|
try:
|
||||||
|
from tech import special_purposes
|
||||||
|
except ImportError:
|
||||||
|
special_purposes = {}
|
||||||
|
|
||||||
|
|
||||||
class layout():
|
class layout():
|
||||||
|
|
@ -777,7 +781,7 @@ class layout():
|
||||||
debug.info(3, "opening {}".format(self.gds_file))
|
debug.info(3, "opening {}".format(self.gds_file))
|
||||||
self.gds = gdsMill.VlsiLayout(units=GDS["unit"])
|
self.gds = gdsMill.VlsiLayout(units=GDS["unit"])
|
||||||
reader = gdsMill.Gds2reader(self.gds)
|
reader = gdsMill.Gds2reader(self.gds)
|
||||||
reader.loadFromFile(self.gds_file)
|
reader.loadFromFile(self.gds_file, special_purposes)
|
||||||
else:
|
else:
|
||||||
debug.info(3, "Creating layout structure {}".format(self.name))
|
debug.info(3, "Creating layout structure {}".format(self.name))
|
||||||
self.gds = gdsMill.VlsiLayout(name=self.name, units=GDS["unit"])
|
self.gds = gdsMill.VlsiLayout(name=self.name, units=GDS["unit"])
|
||||||
|
|
@ -789,7 +793,7 @@ class layout():
|
||||||
debug.info(4, "Printing {}".format(gds_file))
|
debug.info(4, "Printing {}".format(gds_file))
|
||||||
arrayCellLayout = gdsMill.VlsiLayout(units=GDS["unit"])
|
arrayCellLayout = gdsMill.VlsiLayout(units=GDS["unit"])
|
||||||
reader = gdsMill.Gds2reader(arrayCellLayout, debugToTerminal=1)
|
reader = gdsMill.Gds2reader(arrayCellLayout, debugToTerminal=1)
|
||||||
reader.loadFromFile(gds_file)
|
reader.loadFromFile(gds_file, special_purposes)
|
||||||
|
|
||||||
def clear_visited(self):
|
def clear_visited(self):
|
||||||
""" Recursively clear the visited flag """
|
""" Recursively clear the visited flag """
|
||||||
|
|
|
||||||
|
|
@ -669,11 +669,11 @@ class Gds2reader:
|
||||||
else:
|
else:
|
||||||
print("There was an error parsing the GDS header. Aborting...")
|
print("There was an error parsing the GDS header. Aborting...")
|
||||||
|
|
||||||
def loadFromFile(self, fileName):
|
def loadFromFile(self, fileName, special_purposes={}):
|
||||||
self.fileHandle = open(fileName,"rb")
|
self.fileHandle = open(fileName,"rb")
|
||||||
self.readGds2()
|
self.readGds2()
|
||||||
self.fileHandle.close()
|
self.fileHandle.close()
|
||||||
self.layoutObject.initialize()
|
self.layoutObject.initialize(special_purposes)
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from datetime import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import math
|
import math
|
||||||
import debug
|
import debug
|
||||||
from tech import use_purpose
|
|
||||||
|
|
||||||
class VlsiLayout:
|
class VlsiLayout:
|
||||||
"""Class represent a hierarchical layout"""
|
"""Class represent a hierarchical layout"""
|
||||||
|
|
@ -81,6 +81,12 @@ class VlsiLayout:
|
||||||
coordinatesRotate.extend((newX,newY))
|
coordinatesRotate.extend((newX,newY))
|
||||||
return coordinatesRotate
|
return coordinatesRotate
|
||||||
|
|
||||||
|
def prefixAll(self, prefix):
|
||||||
|
for name in self.structures:
|
||||||
|
if name == self.rootStructureName:
|
||||||
|
continue
|
||||||
|
self.structures[prefix + name] = self.structures[name]
|
||||||
|
|
||||||
def rename(self,newName):
|
def rename(self,newName):
|
||||||
# take the root structure and copy it to a new structure with the new name
|
# take the root structure and copy it to a new structure with the new name
|
||||||
self.structures[newName] = self.structures[self.rootStructureName]
|
self.structures[newName] = self.structures[self.rootStructureName]
|
||||||
|
|
@ -211,17 +217,17 @@ class VlsiLayout:
|
||||||
del transformPath[-1]
|
del transformPath[-1]
|
||||||
return
|
return
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, special_purposes={}):
|
||||||
self.deduceHierarchy()
|
self.deduceHierarchy()
|
||||||
# self.traverseTheHierarchy()
|
# self.traverseTheHierarchy()
|
||||||
self.populateCoordinateMap()
|
self.populateCoordinateMap()
|
||||||
#only ones with text
|
# only ones with text
|
||||||
for layerNumber in self.layerNumbersInUse:
|
for layerNumber in self.layerNumbersInUse:
|
||||||
#if layerNumber not in no_pin_shape:
|
# if layerNumber not in no_pin_shape:
|
||||||
if layerNumber in use_purpose:
|
if layerNumber in special_purposes:
|
||||||
self.processLabelPins((layerNumber, use_purpose[layerNumber]))
|
self.processLabelPins((layerNumber, special_purposes[layerNumber]))
|
||||||
else:
|
else:
|
||||||
self.processLabelPins((layerNumber, None))
|
self.processLabelPins((layerNumber, None))
|
||||||
|
|
||||||
def populateCoordinateMap(self):
|
def populateCoordinateMap(self):
|
||||||
def addToXyTree(startingStructureName = None,transformPath = None):
|
def addToXyTree(startingStructureName = None,transformPath = None):
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from gdsMill import gdsMill
|
||||||
|
|
||||||
|
if len(sys.argv) < 4:
|
||||||
|
print("Script to prefix every instance and structure to create a unique namespace.")
|
||||||
|
print("Usage: {0} prefix in.gds out.gds".format(sys.argv[0]))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
prefix = sys.argv[1]
|
||||||
|
|
||||||
|
gds_file = sys.argv[2]
|
||||||
|
arrayCellLayout = gdsMill.VlsiLayout()
|
||||||
|
gds = gdsMill.Gds2reader(arrayCellLayout,debugToTerminal = 1)
|
||||||
|
gds.loadFromFile(gds_file)
|
||||||
|
|
||||||
|
gds.prefixAll(prefix)
|
||||||
|
|
||||||
|
writer = gdsMill.Gds2writer(gds)
|
||||||
|
writer.writeToFile(sys.argv[3])
|
||||||
Loading…
Reference in New Issue