2016-11-08 18:57:35 +01:00
|
|
|
import design
|
|
|
|
|
import debug
|
|
|
|
|
from tech import drc
|
|
|
|
|
from vector import vector
|
|
|
|
|
from precharge import precharge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class precharge_array(design.design):
|
|
|
|
|
"""
|
|
|
|
|
Dynamically generated precharge array of all bitlines. Cols is number
|
|
|
|
|
of bit line columns, height is the height of the bit-cell array.
|
|
|
|
|
"""
|
|
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
def __init__(self, columns, ptx_width, beta=2):
|
|
|
|
|
design.design.__init__(self, "precharge_array")
|
|
|
|
|
debug.info(1, "Creating {0}".format(self.name))
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
self.columns = columns
|
|
|
|
|
self.ptx_width = ptx_width
|
|
|
|
|
self.beta = beta
|
|
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
self.pc_cell = precharge(name="precharge_cell",
|
|
|
|
|
ptx_width=self.ptx_width,
|
|
|
|
|
beta=self.beta)
|
|
|
|
|
self.add_mod(self.pc_cell)
|
|
|
|
|
|
|
|
|
|
self.width = self.columns * self.pc_cell.width
|
|
|
|
|
self.height = self.pc_cell.height
|
|
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
self.add_pins()
|
|
|
|
|
self.create_layout()
|
|
|
|
|
self.DRC_LVS()
|
|
|
|
|
|
|
|
|
|
def add_pins(self):
|
|
|
|
|
"""Adds pins for spice file"""
|
|
|
|
|
for i in range(self.columns):
|
|
|
|
|
self.add_pin("bl[{0}]".format(i))
|
|
|
|
|
self.add_pin("br[{0}]".format(i))
|
2017-09-11 23:30:52 +02:00
|
|
|
self.add_pin("en")
|
2016-11-08 18:57:35 +01:00
|
|
|
self.add_pin("vdd")
|
|
|
|
|
|
|
|
|
|
def create_layout(self):
|
2017-08-24 00:02:15 +02:00
|
|
|
self.add_insts()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
self.add_layout_pin(text="vdd",
|
|
|
|
|
layer="metal1",
|
2017-08-24 00:02:15 +02:00
|
|
|
offset=self.pc_cell.get_pin("vdd").ll(),
|
2016-11-08 18:57:35 +01:00
|
|
|
width=self.width,
|
|
|
|
|
height=drc["minwidth_metal1"])
|
2017-08-24 00:02:15 +02:00
|
|
|
|
2017-09-11 23:30:52 +02:00
|
|
|
self.add_layout_pin(text="en",
|
2016-11-08 18:57:35 +01:00
|
|
|
layer="metal1",
|
2017-08-24 00:02:15 +02:00
|
|
|
offset=self.pc_cell.get_pin("clk").ll(),
|
2016-11-08 18:57:35 +01:00
|
|
|
width=self.width,
|
|
|
|
|
height=drc["minwidth_metal1"])
|
2017-08-24 00:02:15 +02:00
|
|
|
|
|
|
|
|
#self.offset_all_coordinates()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
def add_insts(self):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""Creates a precharge array by horizontally tiling the precharge cell"""
|
|
|
|
|
for i in range(self.columns):
|
|
|
|
|
name = "pre_column_{0}".format(i)
|
|
|
|
|
offset = vector(self.pc_cell.width * i, 0)
|
2017-08-25 01:22:14 +02:00
|
|
|
inst=self.add_inst(name=name,
|
2016-11-08 18:57:35 +01:00
|
|
|
mod=self.pc_cell,
|
|
|
|
|
offset=offset)
|
2017-08-25 01:22:14 +02:00
|
|
|
bl_pin = inst.get_pin("BL")
|
2017-08-24 00:02:15 +02:00
|
|
|
self.add_layout_pin(text="bl[{0}]".format(i),
|
|
|
|
|
layer="metal2",
|
2017-08-25 01:22:14 +02:00
|
|
|
offset=bl_pin.ll(),
|
|
|
|
|
width=drc["minwidth_metal2"],
|
|
|
|
|
height=bl_pin.height())
|
|
|
|
|
br_pin = inst.get_pin("BR")
|
2017-08-24 00:02:15 +02:00
|
|
|
self.add_layout_pin(text="br[{0}]".format(i),
|
|
|
|
|
layer="metal2",
|
2017-08-25 01:22:14 +02:00
|
|
|
offset=br_pin.ll(),
|
|
|
|
|
width=drc["minwidth_metal2"],
|
|
|
|
|
height=bl_pin.height())
|
2016-11-08 18:57:35 +01:00
|
|
|
self.connect_inst(["bl[{0}]".format(i), "br[{0}]".format(i),
|
2017-09-11 23:30:52 +02:00
|
|
|
"en", "vdd"])
|
2016-11-08 18:57:35 +01:00
|
|
|
|