2022-12-09 23:25:11 +01:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2023-02-28 00:56:24 +01:00
|
|
|
# Copyright (c) 2016-2023 Regents of the University of California and The Board
|
2022-12-09 23:25:11 +01:00
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
|
2023-01-17 01:15:03 +01:00
|
|
|
from .rom_base_cell import rom_base_cell
|
2023-02-02 21:46:07 +01:00
|
|
|
from .pgate import pgate
|
2022-12-13 01:35:23 +01:00
|
|
|
from openram.base import vector
|
|
|
|
|
from openram import OPTS
|
|
|
|
|
from openram.sram_factory import factory
|
|
|
|
|
from openram.tech import drc
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-17 01:15:03 +01:00
|
|
|
class rom_precharge_cell(rom_base_cell):
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
def __init__(self, name="", route_layer="m1", supply_layer="li"):
|
|
|
|
|
self.supply_layer = supply_layer
|
2023-01-17 01:15:03 +01:00
|
|
|
super().__init__(name=name, bitline_layer=route_layer)
|
2022-12-09 23:25:11 +01:00
|
|
|
|
|
|
|
|
def create_layout(self):
|
2023-01-17 01:15:03 +01:00
|
|
|
super().create_layout()
|
2023-03-01 06:10:52 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
self.place_tap()
|
2023-01-17 01:15:03 +01:00
|
|
|
self.extend_well()
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-17 01:15:03 +01:00
|
|
|
def add_modules(self):
|
2023-02-02 21:46:07 +01:00
|
|
|
width = pgate.nearest_bin("pmos", drc["minwidth_tx"])
|
2022-12-09 23:25:11 +01:00
|
|
|
self.pmos = factory.create(module_type="ptx",
|
|
|
|
|
module_name="pre_pmos_mod",
|
2023-01-23 03:34:11 +01:00
|
|
|
tx_type="pmos",
|
2023-02-02 21:46:07 +01:00
|
|
|
width=width,
|
2023-01-23 03:34:11 +01:00
|
|
|
add_source_contact=self.supply_layer,
|
|
|
|
|
add_drain_contact=self.bitline_layer
|
2022-12-09 23:25:11 +01:00
|
|
|
)
|
|
|
|
|
|
2023-01-17 01:15:03 +01:00
|
|
|
def create_tx(self):
|
2022-12-09 23:25:11 +01:00
|
|
|
self.cell_inst = self.add_inst( name="precharge_pmos",
|
2023-03-01 06:10:52 +01:00
|
|
|
mod=self.pmos,
|
2022-12-09 23:25:11 +01:00
|
|
|
)
|
2023-01-23 03:34:11 +01:00
|
|
|
self.connect_inst(["bitline", "gate", "vdd", "vdd"])
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-03-01 06:10:52 +01:00
|
|
|
def add_pins(self):
|
2023-01-23 03:34:11 +01:00
|
|
|
pin_list = ["vdd", "gate", "bitline"]
|
|
|
|
|
dir_list = ["POWER", "INPUT", "OUTPUT"]
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-03-01 06:10:52 +01:00
|
|
|
self.add_pin_list(pin_list, dir_list)
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-17 01:15:03 +01:00
|
|
|
def setup_drc_offsets(self):
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-17 01:15:03 +01:00
|
|
|
self.poly_size = (self.cell_inst.width + self.active_space) - (self.cell_inst.height + 2 * self.poly_extend_active)
|
|
|
|
|
|
|
|
|
|
def extend_well(self):
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
well_y = self.get_pin("vdd").cy() - 0.5 * self.nwell_width
|
2023-01-17 01:15:03 +01:00
|
|
|
well_ll = vector(0, well_y)
|
2023-01-23 03:34:11 +01:00
|
|
|
height = self.get_pin("D").cy() + 0.5 * self.nwell_width - well_y
|
2023-01-17 01:15:03 +01:00
|
|
|
self.add_rect("nwell", well_ll, self.width , height)
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
def place_tap(self):
|
|
|
|
|
source = self.cell_inst.get_pin("S")
|
2023-01-17 01:15:03 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
tap_y = source.cy() - self.contact_width - 2 * self.active_enclose_contact - self.active_space
|
2023-01-27 00:48:38 +01:00
|
|
|
self.tap_offset = abs(tap_y)
|
2023-01-23 03:34:11 +01:00
|
|
|
pos = vector(source.cx(), tap_y )
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
self.add_via_center(layers=self.active_stack,
|
|
|
|
|
offset=pos,
|
|
|
|
|
implant_type="n",
|
|
|
|
|
well_type="n",
|
|
|
|
|
directions="nonpref")
|
|
|
|
|
self.add_via_stack_center(offset=pos,
|
|
|
|
|
from_layer=self.active_stack[2],
|
2023-03-01 06:10:52 +01:00
|
|
|
to_layer=self.supply_layer)
|
2023-02-28 00:56:24 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
bitline_offset = vector( 2 * (drc("minwidth_{}".format(self.bitline_layer)) + drc("{0}_to_{0}".format(self.bitline_layer))) ,0)
|
2023-02-28 00:56:24 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
self.add_layout_pin_rect_center("vdd", self.supply_layer, pos - bitline_offset)
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
self.add_path(self.supply_layer, [self.get_pin("vdd").center(), pos, self.get_pin("S").center()])
|
2022-12-09 23:25:11 +01:00
|
|
|
|
2023-01-23 03:34:11 +01:00
|
|
|
self.remove_layout_pin("S")
|
2023-02-28 00:56:24 +01:00
|
|
|
|
2023-02-04 02:21:35 +01:00
|
|
|
def place_bitline(self):
|
2023-02-28 00:56:24 +01:00
|
|
|
pass
|