mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-09-07 19:28:08 +02:00
Found rotate bug in transformCoordinate. Cleaned up transFlags.
This commit is contained in:
+18
-13
@@ -15,22 +15,27 @@ class contact(hierarchy_design.hierarchy_design):
|
||||
necessary to import layouts into Magic which requires the select to be in the same GDS
|
||||
hierarchy as the contact.
|
||||
"""
|
||||
|
||||
unique_id = 1
|
||||
|
||||
def __init__(self, layer_stack, dimensions=[1,1], implant_type=None, well_type=None):
|
||||
if implant_type or well_type:
|
||||
name = "{0}_{1}_{2}_{3}x{4}_{5}{6}".format(layer_stack[0],
|
||||
layer_stack[1],
|
||||
layer_stack[2],
|
||||
dimensions[0],
|
||||
dimensions[1],
|
||||
implant_type,
|
||||
well_type)
|
||||
name = "{0}_{1}_{2}_{3}x{4}_{5}{6}_{7}".format(layer_stack[0],
|
||||
layer_stack[1],
|
||||
layer_stack[2],
|
||||
dimensions[0],
|
||||
dimensions[1],
|
||||
implant_type,
|
||||
well_type,
|
||||
contact.unique_id)
|
||||
else:
|
||||
name = "{0}_{1}_{2}_{3}x{4}".format(layer_stack[0],
|
||||
layer_stack[1],
|
||||
layer_stack[2],
|
||||
dimensions[0],
|
||||
dimensions[1])
|
||||
|
||||
name = "{0}_{1}_{2}_{3}x{4}_{5}".format(layer_stack[0],
|
||||
layer_stack[1],
|
||||
layer_stack[2],
|
||||
dimensions[0],
|
||||
dimensions[1],
|
||||
contact.unique_id)
|
||||
contact.unique_id += 1
|
||||
hierarchy_design.hierarchy_design.__init__(self, name)
|
||||
debug.info(4, "create contact object {0}".format(name))
|
||||
|
||||
|
||||
+40
-40
@@ -34,14 +34,14 @@ class geometry:
|
||||
# coordinate += [(x, y)]
|
||||
# return coordinate
|
||||
|
||||
def transform_coords(self, coords, offset, mirr, angle):
|
||||
"""Calculate coordinates after flip, rotate, and shift"""
|
||||
coordinate = []
|
||||
for item in coords:
|
||||
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]
|
||||
coordinate += [[x, y]]
|
||||
return coordinate
|
||||
# def transform_coords(self, coords, offset, mirr, angle):
|
||||
# """Calculate coordinates after flip, rotate, and shift"""
|
||||
# coordinate = []
|
||||
# for item in coords:
|
||||
# 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]
|
||||
# coordinate += [[x, y]]
|
||||
# return coordinate
|
||||
|
||||
def normalize(self):
|
||||
""" Re-find the LL and UR points after a transform """
|
||||
@@ -148,40 +148,40 @@ class instance(geometry):
|
||||
|
||||
debug.info(4, "creating instance: " + self.name)
|
||||
|
||||
def get_blockages(self, layer, top=False):
|
||||
""" Retrieve rectangular blockages of all modules in this instance.
|
||||
Apply the transform of the instance placement to give absolute blockages."""
|
||||
angle = math.radians(float(self.rotate))
|
||||
mirr = 1
|
||||
if self.mirror=="R90":
|
||||
angle += math.radians(90.0)
|
||||
elif self.mirror=="R180":
|
||||
angle += math.radians(180.0)
|
||||
elif self.mirror=="R270":
|
||||
angle += math.radians(270.0)
|
||||
elif self.mirror=="MX":
|
||||
mirr = -1
|
||||
elif self.mirror=="MY":
|
||||
mirr = -1
|
||||
angle += math.radians(180.0)
|
||||
elif self.mirror=="XY":
|
||||
mirr = 1
|
||||
angle += math.radians(180.0)
|
||||
# def get_blockages(self, layer, top=False):
|
||||
# """ Retrieve rectangular blockages of all modules in this instance.
|
||||
# Apply the transform of the instance placement to give absolute blockages."""
|
||||
# angle = math.radians(float(self.rotate))
|
||||
# mirr = 1
|
||||
# if self.mirror=="R90":
|
||||
# angle += math.radians(90.0)
|
||||
# elif self.mirror=="R180":
|
||||
# angle += math.radians(180.0)
|
||||
# elif self.mirror=="R270":
|
||||
# angle += math.radians(270.0)
|
||||
# elif self.mirror=="MX":
|
||||
# mirr = -1
|
||||
# elif self.mirror=="MY":
|
||||
# mirr = -1
|
||||
# angle += math.radians(180.0)
|
||||
# elif self.mirror=="XY":
|
||||
# mirr = 1
|
||||
# angle += math.radians(180.0)
|
||||
|
||||
if self.mod.is_library_cell:
|
||||
# For lib cells, block the whole thing except on metal3
|
||||
# since they shouldn't use metal3
|
||||
if layer==tech.layer["metal1"] or layer==tech.layer["metal2"]:
|
||||
return [self.transform_coords(self.mod.get_boundary(), self.offset, mirr, angle)]
|
||||
else:
|
||||
return []
|
||||
else:
|
||||
# if self.mod.is_library_cell:
|
||||
# # For lib cells, block the whole thing except on metal3
|
||||
# # since they shouldn't use metal3
|
||||
# if layer==tech.layer["metal1"] or layer==tech.layer["metal2"]:
|
||||
# return [self.transform_coords(self.mod.get_boundary(), self.offset, mirr, angle)]
|
||||
# else:
|
||||
# return []
|
||||
# else:
|
||||
|
||||
blockages = self.mod.get_blockages(layer)
|
||||
new_blockages = []
|
||||
for b in blockages:
|
||||
new_blockages.append(self.transform_coords(b,self.offset, mirr, angle))
|
||||
return new_blockages
|
||||
# blockages = self.mod.get_blockages(layer)
|
||||
# new_blockages = []
|
||||
# for b in blockages:
|
||||
# new_blockages.append(self.transform_coords(b,self.offset, mirr, angle))
|
||||
# return new_blockages
|
||||
|
||||
def gds_write_file(self, new_layout):
|
||||
"""Recursively writes all the sub-modules in this instance"""
|
||||
|
||||
@@ -379,12 +379,10 @@ class layout(lef.lef):
|
||||
dimensions=size,
|
||||
implant_type=implant_type,
|
||||
well_type=well_type)
|
||||
|
||||
debug.check(mirror=="R0","Use rotate to rotate vias instead of mirror.")
|
||||
|
||||
height = via.height
|
||||
width = via.width
|
||||
|
||||
debug.check(mirror=="R0","Use rotate to rotate vias instead of mirror.")
|
||||
|
||||
if rotate==0:
|
||||
corrected_offset = offset + vector(-0.5*width,-0.5*height)
|
||||
elif rotate==90:
|
||||
@@ -847,6 +845,7 @@ class layout(lef.lef):
|
||||
"""
|
||||
Add a single power pin from M3 down to M1 at the given center location
|
||||
"""
|
||||
debug.info(0,"Adding power pin {0} at {1} rotate={2}".format(name, loc, rotate))
|
||||
self.add_via_center(layers=("metal1", "via1", "metal2"),
|
||||
offset=loc,
|
||||
rotate=rotate)
|
||||
|
||||
@@ -36,16 +36,14 @@ class pin_layout:
|
||||
def __eq__(self, other):
|
||||
""" Check if these are the same pins for duplicate checks """
|
||||
if isinstance(other, self.__class__):
|
||||
return (self.name==other.name and self.layer==other.layer and self.rect == other.rect)
|
||||
return (self.layer==other.layer and self.rect == other.rect)
|
||||
else:
|
||||
return False
|
||||
|
||||
def overlaps(self, other):
|
||||
""" Check if a shape overlaps with a rectangle """
|
||||
ll = self.rect[0]
|
||||
ur = self.rect[1]
|
||||
oll = other.rect[0]
|
||||
our = other.rect[1]
|
||||
(ll,ur) = self.rect
|
||||
(oll,our) = other.rect
|
||||
# Start assuming no overlaps
|
||||
x_overlaps = False
|
||||
y_overlaps = False
|
||||
|
||||
Reference in New Issue
Block a user