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 pin_layout import pin_layout
|
||||
from utils import round_to_grid
|
||||
try:
|
||||
from tech import special_purposes
|
||||
except ImportError:
|
||||
special_purposes = {}
|
||||
|
||||
|
||||
class layout():
|
||||
|
|
@ -777,7 +781,7 @@ class layout():
|
|||
debug.info(3, "opening {}".format(self.gds_file))
|
||||
self.gds = gdsMill.VlsiLayout(units=GDS["unit"])
|
||||
reader = gdsMill.Gds2reader(self.gds)
|
||||
reader.loadFromFile(self.gds_file)
|
||||
reader.loadFromFile(self.gds_file, special_purposes)
|
||||
else:
|
||||
debug.info(3, "Creating layout structure {}".format(self.name))
|
||||
self.gds = gdsMill.VlsiLayout(name=self.name, units=GDS["unit"])
|
||||
|
|
@ -789,7 +793,7 @@ class layout():
|
|||
debug.info(4, "Printing {}".format(gds_file))
|
||||
arrayCellLayout = gdsMill.VlsiLayout(units=GDS["unit"])
|
||||
reader = gdsMill.Gds2reader(arrayCellLayout, debugToTerminal=1)
|
||||
reader.loadFromFile(gds_file)
|
||||
reader.loadFromFile(gds_file, special_purposes)
|
||||
|
||||
def clear_visited(self):
|
||||
""" Recursively clear the visited flag """
|
||||
|
|
|
|||
|
|
@ -669,11 +669,11 @@ class Gds2reader:
|
|||
else:
|
||||
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.readGds2()
|
||||
self.fileHandle.close()
|
||||
self.layoutObject.initialize()
|
||||
self.layoutObject.initialize(special_purposes)
|
||||
|
||||
##############################################
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from datetime import *
|
|||
import numpy as np
|
||||
import math
|
||||
import debug
|
||||
from tech import use_purpose
|
||||
|
||||
|
||||
class VlsiLayout:
|
||||
"""Class represent a hierarchical layout"""
|
||||
|
|
@ -81,6 +81,12 @@ class VlsiLayout:
|
|||
coordinatesRotate.extend((newX,newY))
|
||||
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):
|
||||
# take the root structure and copy it to a new structure with the new name
|
||||
self.structures[newName] = self.structures[self.rootStructureName]
|
||||
|
|
@ -211,15 +217,15 @@ class VlsiLayout:
|
|||
del transformPath[-1]
|
||||
return
|
||||
|
||||
def initialize(self):
|
||||
def initialize(self, special_purposes={}):
|
||||
self.deduceHierarchy()
|
||||
# self.traverseTheHierarchy()
|
||||
self.populateCoordinateMap()
|
||||
#only ones with text
|
||||
# only ones with text
|
||||
for layerNumber in self.layerNumbersInUse:
|
||||
#if layerNumber not in no_pin_shape:
|
||||
if layerNumber in use_purpose:
|
||||
self.processLabelPins((layerNumber, use_purpose[layerNumber]))
|
||||
# if layerNumber not in no_pin_shape:
|
||||
if layerNumber in special_purposes:
|
||||
self.processLabelPins((layerNumber, special_purposes[layerNumber]))
|
||||
else:
|
||||
self.processLabelPins((layerNumber, 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