mirror of https://github.com/VLSIDA/OpenRAM.git
Add get_tx_insts and expand add_enclosure
This commit is contained in:
parent
93d65e84e1
commit
4bc3df8931
|
|
@ -269,6 +269,23 @@ class layout():
|
||||||
width,
|
width,
|
||||||
end.y - start.y)
|
end.y - start.y)
|
||||||
|
|
||||||
|
def get_tx_insts(self, tx_type=None):
|
||||||
|
"""
|
||||||
|
Return a list of the instances of given tx type.
|
||||||
|
"""
|
||||||
|
tx_list = []
|
||||||
|
for i in self.insts:
|
||||||
|
try:
|
||||||
|
if tx_type and i.mod.tx_type == tx_type:
|
||||||
|
tx_list.append(i)
|
||||||
|
elif not tx_type:
|
||||||
|
if i.mod.tx_type == "nmos" or i.mod.tx_type == "pmos":
|
||||||
|
tx_list.append(i)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return tx_list
|
||||||
|
|
||||||
def get_pin(self, text):
|
def get_pin(self, text):
|
||||||
"""
|
"""
|
||||||
Return the pin or list of pins
|
Return the pin or list of pins
|
||||||
|
|
@ -1301,25 +1318,47 @@ class layout():
|
||||||
height=ur.y - ll.y,
|
height=ur.y - ll.y,
|
||||||
width=ur.x - ll.x)
|
width=ur.x - ll.x)
|
||||||
|
|
||||||
def add_enclosure(self, insts, layer="nwell"):
|
def add_enclosure(self, insts, layer="nwell", extend=0, leftx=None, rightx=None, topy=None, boty=None):
|
||||||
""" Add a layer that surrounds the given instances. Useful
|
"""
|
||||||
|
Add a layer that surrounds the given instances. Useful
|
||||||
for creating wells, for example. Doesn't check for minimum widths or
|
for creating wells, for example. Doesn't check for minimum widths or
|
||||||
spacings."""
|
spacings. Extra arg can force a dimension to one side left/right top/bot.
|
||||||
|
"""
|
||||||
|
|
||||||
xmin = insts[0].lx()
|
if leftx != None:
|
||||||
ymin = insts[0].by()
|
xmin = leftx
|
||||||
xmax = insts[0].rx()
|
else:
|
||||||
ymax = insts[0].uy()
|
xmin = insts[0].lx()
|
||||||
for inst in insts:
|
for inst in insts:
|
||||||
xmin = min(xmin, inst.lx())
|
xmin = min(xmin, inst.lx())
|
||||||
ymin = min(ymin, inst.by())
|
xmin = xmin - extend
|
||||||
xmax = max(xmax, inst.rx())
|
if boty != None:
|
||||||
ymax = max(ymax, inst.uy())
|
ymin = boty
|
||||||
|
else:
|
||||||
|
ymin = insts[0].by()
|
||||||
|
for inst in insts:
|
||||||
|
ymin = min(ymin, inst.by())
|
||||||
|
ymin = ymin - extend
|
||||||
|
if rightx != None:
|
||||||
|
xmax = rightx
|
||||||
|
else:
|
||||||
|
xmax = insts[0].rx()
|
||||||
|
for inst in insts:
|
||||||
|
xmax = max(xmax, inst.rx())
|
||||||
|
xmax = xmax + extend
|
||||||
|
if topy != None:
|
||||||
|
ymax = topy
|
||||||
|
else:
|
||||||
|
ymax = insts[0].uy()
|
||||||
|
for inst in insts:
|
||||||
|
ymax = max(ymax, inst.uy())
|
||||||
|
ymax = ymax + extend
|
||||||
|
|
||||||
self.add_rect(layer=layer,
|
rect = self.add_rect(layer=layer,
|
||||||
offset=vector(xmin, ymin),
|
offset=vector(xmin, ymin),
|
||||||
width=xmax - xmin,
|
width=xmax - xmin,
|
||||||
height=ymax - ymin)
|
height=ymax - ymin)
|
||||||
|
return rect
|
||||||
|
|
||||||
def copy_power_pins(self, inst, name):
|
def copy_power_pins(self, inst, name):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue