mirror of https://github.com/VLSIDA/OpenRAM.git
Add back LEF blockages. Remove "absolute" flags from GDS output
This commit is contained in:
parent
8ffdcdf277
commit
0f87ba742f
|
|
@ -34,14 +34,14 @@ class geometry:
|
||||||
# coordinate += [(x, y)]
|
# coordinate += [(x, y)]
|
||||||
# return coordinate
|
# return coordinate
|
||||||
|
|
||||||
# def transform_coords(self, coords, offset, mirr, angle):
|
def transform_coords(self, coords, offset, mirr, angle):
|
||||||
# """Calculate coordinates after flip, rotate, and shift"""
|
"""Calculate coordinates after flip, rotate, and shift"""
|
||||||
# coordinate = []
|
coordinate = []
|
||||||
# for item in coords:
|
for item in coords:
|
||||||
# x = item[0]*math.cos(angle) - item[1]*mirr*math.sin(angle) + offset[0]
|
x = item[0]*math.cos(angle) - item[1]*mirr*math.sin(angle) + offset[0]
|
||||||
# y = item[0]*math.sin(angle) + item[1]*mirr*math.cos(angle) + offset[1]
|
y = item[0]*math.sin(angle) + item[1]*mirr*math.cos(angle) + offset[1]
|
||||||
# coordinate += [[x, y]]
|
coordinate += [[x, y]]
|
||||||
# return coordinate
|
return coordinate
|
||||||
|
|
||||||
def normalize(self):
|
def normalize(self):
|
||||||
""" Re-find the LL and UR points after a transform """
|
""" Re-find the LL and UR points after a transform """
|
||||||
|
|
@ -148,40 +148,40 @@ class instance(geometry):
|
||||||
|
|
||||||
debug.info(4, "creating instance: " + self.name)
|
debug.info(4, "creating instance: " + self.name)
|
||||||
|
|
||||||
# def get_blockages(self, layer, top=False):
|
def get_blockages(self, layer, top=False):
|
||||||
# """ Retrieve rectangular blockages of all modules in this instance.
|
""" Retrieve rectangular blockages of all modules in this instance.
|
||||||
# Apply the transform of the instance placement to give absolute blockages."""
|
Apply the transform of the instance placement to give absolute blockages."""
|
||||||
# angle = math.radians(float(self.rotate))
|
angle = math.radians(float(self.rotate))
|
||||||
# mirr = 1
|
mirr = 1
|
||||||
# if self.mirror=="R90":
|
if self.mirror=="R90":
|
||||||
# angle += math.radians(90.0)
|
angle += math.radians(90.0)
|
||||||
# elif self.mirror=="R180":
|
elif self.mirror=="R180":
|
||||||
# angle += math.radians(180.0)
|
angle += math.radians(180.0)
|
||||||
# elif self.mirror=="R270":
|
elif self.mirror=="R270":
|
||||||
# angle += math.radians(270.0)
|
angle += math.radians(270.0)
|
||||||
# elif self.mirror=="MX":
|
elif self.mirror=="MX":
|
||||||
# mirr = -1
|
mirr = -1
|
||||||
# elif self.mirror=="MY":
|
elif self.mirror=="MY":
|
||||||
# mirr = -1
|
mirr = -1
|
||||||
# angle += math.radians(180.0)
|
angle += math.radians(180.0)
|
||||||
# elif self.mirror=="XY":
|
elif self.mirror=="XY":
|
||||||
# mirr = 1
|
mirr = 1
|
||||||
# angle += math.radians(180.0)
|
angle += math.radians(180.0)
|
||||||
|
|
||||||
# if self.mod.is_library_cell:
|
if self.mod.is_library_cell:
|
||||||
# # For lib cells, block the whole thing except on metal3
|
# For lib cells, block the whole thing except on metal3
|
||||||
# # since they shouldn't use metal3
|
# since they shouldn't use metal3
|
||||||
# if layer==tech.layer["metal1"] or layer==tech.layer["metal2"]:
|
if layer==tech.layer["metal1"] or layer==tech.layer["metal2"]:
|
||||||
# return [self.transform_coords(self.mod.get_boundary(), self.offset, mirr, angle)]
|
return [self.transform_coords(self.mod.get_boundary(), self.offset, mirr, angle)]
|
||||||
# else:
|
else:
|
||||||
# return []
|
return []
|
||||||
# else:
|
else:
|
||||||
|
|
||||||
# blockages = self.mod.get_blockages(layer)
|
blockages = self.mod.get_blockages(layer)
|
||||||
# new_blockages = []
|
new_blockages = []
|
||||||
# for b in blockages:
|
for b in blockages:
|
||||||
# new_blockages.append(self.transform_coords(b,self.offset, mirr, angle))
|
new_blockages.append(self.transform_coords(b,self.offset, mirr, angle))
|
||||||
# return new_blockages
|
return new_blockages
|
||||||
|
|
||||||
def gds_write_file(self, new_layout):
|
def gds_write_file(self, new_layout):
|
||||||
"""Recursively writes all the sub-modules in this instance"""
|
"""Recursively writes all the sub-modules in this instance"""
|
||||||
|
|
|
||||||
|
|
@ -280,18 +280,20 @@ class Gds2writer:
|
||||||
if(thisSref.transFlags!=""):
|
if(thisSref.transFlags!=""):
|
||||||
idBits=b'\x1A\x01'
|
idBits=b'\x1A\x01'
|
||||||
mirrorFlag = int(thisSref.transFlags[0])<<15
|
mirrorFlag = int(thisSref.transFlags[0])<<15
|
||||||
# FIXME: For some reason, Calibre doesn't like when this flag is set
|
# The rotate and magnify flags specify "absolute" rotate and magnify.
|
||||||
# but it will still pay attention to the rotate value!
|
# It is unclear what that is (ignore all further rotates/mags in the
|
||||||
#rotateFlag = int(thisSref.transFlags[2])<<1
|
# hierarchy? But anyway, calibre doesn't support it.
|
||||||
rotateFlag=0
|
rotateFlag=0
|
||||||
magnifyFlag = int(thisSref.transFlags[1])<<2
|
magnifyFlag = 0
|
||||||
|
#rotateFlag = int(thisSref.transFlags[2])<<1
|
||||||
|
#magnifyFlag = int(thisSref.transFlags[1])<<2
|
||||||
transFlags = struct.pack(">H",mirrorFlag|rotateFlag|magnifyFlag)
|
transFlags = struct.pack(">H",mirrorFlag|rotateFlag|magnifyFlag)
|
||||||
self.writeRecord(idBits+transFlags)
|
self.writeRecord(idBits+transFlags)
|
||||||
if(thisSref.transFlags[1]):
|
if(thisSref.magFactor!=""):
|
||||||
idBits=b'\x1B\x05'
|
idBits=b'\x1B\x05'
|
||||||
magFactor=self.ibmDataFromIeeeDouble(thisSref.magFactor)
|
magFactor=self.ibmDataFromIeeeDouble(thisSref.magFactor)
|
||||||
self.writeRecord(idBits+magFactor)
|
self.writeRecord(idBits+magFactor)
|
||||||
if(thisSref.transFlags[2]):
|
if(thisSref.rotateAngle!=""):
|
||||||
idBits=b'\x1C\x05'
|
idBits=b'\x1C\x05'
|
||||||
rotateAngle=self.ibmDataFromIeeeDouble(thisSref.rotateAngle)
|
rotateAngle=self.ibmDataFromIeeeDouble(thisSref.rotateAngle)
|
||||||
self.writeRecord(idBits+rotateAngle)
|
self.writeRecord(idBits+rotateAngle)
|
||||||
|
|
@ -330,15 +332,20 @@ class Gds2writer:
|
||||||
if(thisAref.transFlags):
|
if(thisAref.transFlags):
|
||||||
idBits=b'\x1A\x01'
|
idBits=b'\x1A\x01'
|
||||||
mirrorFlag = int(thisAref.transFlags[0])<<15
|
mirrorFlag = int(thisAref.transFlags[0])<<15
|
||||||
rotateFlag = int(thisAref.transFlags[2])<<1
|
# The rotate and magnify flags specify "absolute" rotate and magnify.
|
||||||
magnifyFlag = int(thisAref.transFlags[1])<<2
|
# It is unclear what that is (ignore all further rotates/mags in the
|
||||||
|
# hierarchy? But anyway, calibre doesn't support it.
|
||||||
|
rotateFlag=0
|
||||||
|
magnifyFlag = 0
|
||||||
|
#rotateFlag = int(thisAref.transFlags[2])<<1
|
||||||
|
#magnifyFlag = int(thisAref.transFlags[1])<<2
|
||||||
transFlags = struct.pack(">H",mirrorFlag|rotateFlag|magnifyFlag)
|
transFlags = struct.pack(">H",mirrorFlag|rotateFlag|magnifyFlag)
|
||||||
self.writeRecord(idBits+transFlags)
|
self.writeRecord(idBits+transFlags)
|
||||||
if(thisAref.transFlags[1]):
|
if(thisAref.magFactor!=""):
|
||||||
idBits=b'\x1B\x05'
|
idBits=b'\x1B\x05'
|
||||||
magFactor=self.ibmDataFromIeeeDouble(thisAref.magFactor)
|
magFactor=self.ibmDataFromIeeeDouble(thisAref.magFactor)
|
||||||
self.writeRecord(idBits+magFactor)
|
self.writeRecord(idBits+magFactor)
|
||||||
if(thisAref.transFlags[2]):
|
if(thisAref.rotateAngle!=""):
|
||||||
idBits=b'\x1C\x05'
|
idBits=b'\x1C\x05'
|
||||||
rotateAngle=self.ibmDataFromIeeeDouble(thisAref.rotateAngle)
|
rotateAngle=self.ibmDataFromIeeeDouble(thisAref.rotateAngle)
|
||||||
self.writeRecord(idBits+rotateAngle)
|
self.writeRecord(idBits+rotateAngle)
|
||||||
|
|
@ -377,15 +384,20 @@ class Gds2writer:
|
||||||
if(thisText.transFlags != ""):
|
if(thisText.transFlags != ""):
|
||||||
idBits=b'\x1A\x01'
|
idBits=b'\x1A\x01'
|
||||||
mirrorFlag = int(thisText.transFlags[0])<<15
|
mirrorFlag = int(thisText.transFlags[0])<<15
|
||||||
rotateFlag = int(thisText.transFlags[2])<<1
|
# The rotate and magnify flags specify "absolute" rotate and magnify.
|
||||||
magnifyFlag = int(thisText.transFlags[1])<<2
|
# It is unclear what that is (ignore all further rotates/mags in the
|
||||||
|
# hierarchy? But anyway, calibre doesn't support it.
|
||||||
|
rotateFlag=0
|
||||||
|
magnifyFlag = 0
|
||||||
|
#rotateFlag = int(thisText.transFlags[2])<<1
|
||||||
|
#magnifyFlag = int(thisText.transFlags[1])<<2
|
||||||
transFlags = struct.pack(">H",mirrorFlag|rotateFlag|magnifyFlag)
|
transFlags = struct.pack(">H",mirrorFlag|rotateFlag|magnifyFlag)
|
||||||
self.writeRecord(idBits+transFlags)
|
self.writeRecord(idBits+transFlags)
|
||||||
if(thisText.transFlags[1]):
|
if(thisText.magFactor!=""):
|
||||||
idBits=b'\x1B\x05'
|
idBits=b'\x1B\x05'
|
||||||
magFactor=self.ibmDataFromIeeeDouble(thisText.magFactor)
|
magFactor=self.ibmDataFromIeeeDouble(thisText.magFactor)
|
||||||
self.writeRecord(idBits+magFactor)
|
self.writeRecord(idBits+magFactor)
|
||||||
if(thisText.transFlags[2]):
|
if(thisText.rotateAngle!=""):
|
||||||
idBits=b'\x1C\x05'
|
idBits=b'\x1C\x05'
|
||||||
rotateAngle=self.ibmDataFromIeeeDouble(thisText.rotateAngle)
|
rotateAngle=self.ibmDataFromIeeeDouble(thisText.rotateAngle)
|
||||||
self.writeRecord(idBits+rotateAngle)
|
self.writeRecord(idBits+rotateAngle)
|
||||||
|
|
|
||||||
|
|
@ -328,16 +328,16 @@ class VlsiLayout:
|
||||||
if mirror=="R270":
|
if mirror=="R270":
|
||||||
rotate = 270.0
|
rotate = 270.0
|
||||||
if rotate:
|
if rotate:
|
||||||
layoutToAddSref.transFlags[2] = 1
|
#layoutToAddSref.transFlags[2] = 1
|
||||||
layoutToAddSref.rotateAngle = rotate
|
layoutToAddSref.rotateAngle = rotate
|
||||||
if mirror == "x" or mirror == "MX":
|
if mirror == "x" or mirror == "MX":
|
||||||
layoutToAddSref.transFlags[0] = 1
|
layoutToAddSref.transFlags[0] = 1
|
||||||
if mirror == "y" or mirror == "MY": #NOTE: "MY" option will override specified rotate angle
|
if mirror == "y" or mirror == "MY": #NOTE: "MY" option will override specified rotate angle
|
||||||
layoutToAddSref.transFlags[0] = 1
|
layoutToAddSref.transFlags[0] = 1
|
||||||
layoutToAddSref.transFlags[2] = 1
|
#layoutToAddSref.transFlags[2] = 1
|
||||||
layoutToAddSref.rotateAngle = 180.0
|
layoutToAddSref.rotateAngle = 180.0
|
||||||
if mirror == "xy" or mirror == "XY": #NOTE: "XY" option will override specified rotate angle
|
if mirror == "xy" or mirror == "XY": #NOTE: "XY" option will override specified rotate angle
|
||||||
layoutToAddSref.transFlags[2] = 1
|
#layoutToAddSref.transFlags[2] = 1
|
||||||
layoutToAddSref.rotateAngle = 180.0
|
layoutToAddSref.rotateAngle = 180.0
|
||||||
|
|
||||||
#add the sref to the root structure
|
#add the sref to the root structure
|
||||||
|
|
@ -404,10 +404,10 @@ class VlsiLayout:
|
||||||
if(len(text)%2 == 1):
|
if(len(text)%2 == 1):
|
||||||
text = text + '\x00'
|
text = text + '\x00'
|
||||||
textToAdd.textString = text
|
textToAdd.textString = text
|
||||||
textToAdd.transFlags[1] = 1
|
#textToAdd.transFlags[1] = 1
|
||||||
textToAdd.magFactor = magnification
|
textToAdd.magFactor = magnification
|
||||||
if rotate:
|
if rotate:
|
||||||
textToAdd.transFlags[2] = 1
|
#textToAdd.transFlags[2] = 1
|
||||||
textToAdd.rotateAngle = rotate
|
textToAdd.rotateAngle = rotate
|
||||||
#add the sref to the root structure
|
#add the sref to the root structure
|
||||||
self.structures[self.rootStructureName].texts.append(textToAdd)
|
self.structures[self.rootStructureName].texts.append(textToAdd)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue