mirror of https://github.com/VLSIDA/OpenRAM.git
apply vector to hierchay_layout and geometry and contact
This commit is contained in:
parent
b51c124810
commit
7bae37c026
|
|
@ -40,8 +40,8 @@ class contact(design.design):
|
||||||
self.offset_attributes(coordinate)
|
self.offset_attributes(coordinate)
|
||||||
self.translate(coordinate)
|
self.translate(coordinate)
|
||||||
|
|
||||||
self.height = max(obj.offset[1] + obj.height for obj in self.objs)
|
self.height = max(obj.offset.y + obj.height for obj in self.objs)
|
||||||
self.width = max(obj.offset[0] + obj.width for obj in self.objs)
|
self.width = max(obj.offset.x + obj.width for obj in self.objs)
|
||||||
|
|
||||||
def setup_layers(self):
|
def setup_layers(self):
|
||||||
(first_layer, via_layer, second_layer) = self.layer_stack
|
(first_layer, via_layer, second_layer) = self.layer_stack
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ This provides a set of useful generic types for the gdsMill interface.
|
||||||
import tech
|
import tech
|
||||||
import debug
|
import debug
|
||||||
from utils import snap_to_grid
|
from utils import snap_to_grid
|
||||||
|
from vector import vector
|
||||||
|
|
||||||
class geometry:
|
class geometry:
|
||||||
"""
|
"""
|
||||||
|
|
@ -37,7 +38,7 @@ class instance(geometry):
|
||||||
self.mod = mod
|
self.mod = mod
|
||||||
self.gds = mod.gds
|
self.gds = mod.gds
|
||||||
self.rotate = rotate
|
self.rotate = rotate
|
||||||
self.offset = snap_to_grid(offset)
|
self.offset = vector(snap_to_grid(offset))
|
||||||
self.mirror = mirror
|
self.mirror = mirror
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,7 +105,7 @@ class label(geometry):
|
||||||
self.name = "label"
|
self.name = "label"
|
||||||
self.text = text
|
self.text = text
|
||||||
self.layerNumber = layerNumber
|
self.layerNumber = layerNumber
|
||||||
self.offset = snap_to_grid(offset)
|
self.offset = vector(snap_to_grid(offset))
|
||||||
self.zoom = zoom
|
self.zoom = zoom
|
||||||
self.size = 0
|
self.size = 0
|
||||||
|
|
||||||
|
|
@ -134,7 +135,7 @@ class rectangle(geometry):
|
||||||
geometry.__init__(self)
|
geometry.__init__(self)
|
||||||
self.name = "rect"
|
self.name = "rect"
|
||||||
self.layerNumber = layerNumber
|
self.layerNumber = layerNumber
|
||||||
self.offset = snap_to_grid(offset)
|
self.offset = vector(snap_to_grid(offset))
|
||||||
self.size = snap_to_grid([width, height])
|
self.size = snap_to_grid([width, height])
|
||||||
self.width = self.size[0]
|
self.width = self.size[0]
|
||||||
self.height = self.size[1]
|
self.height = self.size[1]
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@ class layout:
|
||||||
#***1,000,000 number is used to avoid empty sequences errors***
|
#***1,000,000 number is used to avoid empty sequences errors***
|
||||||
# FIXME Is this hard coded value ok??
|
# FIXME Is this hard coded value ok??
|
||||||
try:
|
try:
|
||||||
lowestx1 = min(rect.offset[0] for rect in self.objs)
|
lowestx1 = min(rect.offset.x for rect in self.objs)
|
||||||
lowesty1 = min(rect.offset[1] for rect in self.objs)
|
lowesty1 = min(rect.offset.y for rect in self.objs)
|
||||||
except:
|
except:
|
||||||
[lowestx1, lowesty1] = [1000000.0, 1000000.0]
|
[lowestx1, lowesty1] = [1000000.0, 1000000.0]
|
||||||
try:
|
try:
|
||||||
lowestx2 = min(inst.offset[0] for inst in self.insts)
|
lowestx2 = min(inst.offset.x for inst in self.insts)
|
||||||
lowesty2 = min(inst.offset[1] for inst in self.insts)
|
lowesty2 = min(inst.offset.y for inst in self.insts)
|
||||||
except:
|
except:
|
||||||
[lowestx2, lowesty2] = [1000000.0, 1000000.0]
|
[lowestx2, lowesty2] = [1000000.0, 1000000.0]
|
||||||
return vector(min(lowestx1, lowestx2), min(lowesty1, lowesty2))
|
return vector(min(lowestx1, lowestx2), min(lowesty1, lowesty2))
|
||||||
|
|
@ -77,21 +77,18 @@ class layout:
|
||||||
for i in range(len(attr_val)):
|
for i in range(len(attr_val)):
|
||||||
# each unit in the list is a list coordinates
|
# each unit in the list is a list coordinates
|
||||||
if isinstance(attr_val[i], (list,vector)):
|
if isinstance(attr_val[i], (list,vector)):
|
||||||
attr_val[i] = vector([attr_val[i][0] - coordinate.x,
|
attr_val[i] = vector(attr_val[i] - coordinate)
|
||||||
attr_val[i][1] - coordinate.y])
|
|
||||||
# the list itself is a coordinate
|
# the list itself is a coordinate
|
||||||
else:
|
else:
|
||||||
if len(attr_val)!=2: continue
|
if len(attr_val)!=2: continue
|
||||||
for val in attr_val:
|
for val in attr_val:
|
||||||
if not isinstance(val, (int, long, float)): continue
|
if not isinstance(val, (int, long, float)): continue
|
||||||
setattr(self,attr_key, vector([attr_val[0] - coordinate.x,
|
setattr(self,attr_key, vector(attr_val - coordinate))
|
||||||
attr_val[1] - coordinate.y]))
|
|
||||||
break
|
break
|
||||||
|
|
||||||
# if is a vector coordinate
|
# if is a vector coordinate
|
||||||
if isinstance(attr_val, vector):
|
if isinstance(attr_val, vector):
|
||||||
setattr(self, attr_key, vector(attr_val[0] - coordinate.x,
|
setattr(self, attr_key, vector(attr_val - coordinate))
|
||||||
attr_val[1] - coordinate.y))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,11 +96,9 @@ class layout:
|
||||||
"""Translates all 2d cartesian coordinates in a layout given
|
"""Translates all 2d cartesian coordinates in a layout given
|
||||||
the (x,y) offset"""
|
the (x,y) offset"""
|
||||||
for obj in self.objs:
|
for obj in self.objs:
|
||||||
obj.offset = snap_to_grid([obj.offset[0] - coordinate.x,
|
obj.offset = vector(snap_to_grid(obj.offset - coordinate))
|
||||||
obj.offset[1] - coordinate.y])
|
|
||||||
for inst in self.insts:
|
for inst in self.insts:
|
||||||
inst.offset = snap_to_grid([inst.offset[0] - coordinate.x,
|
inst.offset = vector(snap_to_grid(inst.offset - coordinate))
|
||||||
inst.offset[1] - coordinate.y])
|
|
||||||
|
|
||||||
# FIXME: Make name optional and pick a random one if not specified
|
# FIXME: Make name optional and pick a random one if not specified
|
||||||
def add_inst(self, name, mod, offset=[0,0], mirror="R0",rotate=0):
|
def add_inst(self, name, mod, offset=[0,0], mirror="R0",rotate=0):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue