mirror of https://github.com/VLSIDA/OpenRAM.git
not applying snap_to_grid to all vectors
This commit is contained in:
parent
905f5cf28e
commit
8c4b97753a
|
|
@ -36,7 +36,7 @@ class instance(geometry):
|
|||
self.mod = mod
|
||||
self.gds = mod.gds
|
||||
self.rotate = rotate
|
||||
self.offset = vector(offset)
|
||||
self.offset = vector(offset).snap_to_grid()
|
||||
self.mirror = mirror
|
||||
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ class path(geometry):
|
|||
self.name = "path"
|
||||
self.layerNumber = layerNumber
|
||||
self.coordinates = map(lambda x: [x[0], x[1]], coordinates)
|
||||
self.coordinates = vector(self.coordinates)
|
||||
self.coordinates = vector(self.coordinates).snap_to_grid()
|
||||
self.path_width = path_width
|
||||
|
||||
# FIXME figure out the width/height. This type of path is not
|
||||
|
|
@ -103,7 +103,7 @@ class label(geometry):
|
|||
self.name = "label"
|
||||
self.text = text
|
||||
self.layerNumber = layerNumber
|
||||
self.offset = vector(offset)
|
||||
self.offset = vector(offset).snap_to_grid()
|
||||
self.zoom = zoom
|
||||
self.size = 0
|
||||
|
||||
|
|
@ -133,10 +133,10 @@ class rectangle(geometry):
|
|||
geometry.__init__(self)
|
||||
self.name = "rect"
|
||||
self.layerNumber = layerNumber
|
||||
self.offset = vector(offset)
|
||||
self.size = vector([width, height])
|
||||
self.width = self.size[0]
|
||||
self.height = self.size[1]
|
||||
self.offset = vector(offset).snap_to_grid()
|
||||
self.size = vector(width, height).snap_to_grid()
|
||||
self.width = self.size.x
|
||||
self.height = self.size.y
|
||||
|
||||
def gds_write_file(self, newLayout):
|
||||
"""Writes the rectangular shape to GDS"""
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ class vector():
|
|||
""" init function support two init method"""
|
||||
# will take single input as a coordinate
|
||||
if y==None:
|
||||
self.x = self.snap_to_grid(x[0])
|
||||
self.y = self.snap_to_grid(x[1])
|
||||
self.x = x[0]
|
||||
self.y = x[1]
|
||||
#will take two inputs as the values of a coordinate
|
||||
else:
|
||||
self.x = self.snap_to_grid(x)
|
||||
self.y = self.snap_to_grid(y)
|
||||
self.x = x
|
||||
self.y = y
|
||||
|
||||
def __str__(self):
|
||||
""" override print function output """
|
||||
|
|
@ -83,7 +83,12 @@ class vector():
|
|||
"""
|
||||
return vector(other[0]- self.x, other[1] - self.y)
|
||||
|
||||
def snap_to_grid(self, offset):
|
||||
def snap_to_grid(self):
|
||||
self.x = self.snap_offset_to_grid(self.x)
|
||||
self.y = self.snap_offset_to_grid(self.y)
|
||||
return self
|
||||
|
||||
def snap_offset_to_grid(self, offset):
|
||||
"""
|
||||
Changes the coodrinate to match the grid settings
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue