2022-12-09 23:25:11 +01:00
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2021 Regents of the University of California and The Board
# 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
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-17 01:15:03 +01:00
def __init__ ( self , name = " " , route_layer = " m1 " ) :
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
super ( ) . __init__ ( name = name , bitline_layer = route_layer )
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# def create_netlist(self):
# self.add_pins()
# self.add_modules()
# self.create_tx()
2022-12-09 23:25:11 +01:00
def create_layout ( self ) :
2023-01-17 01:15:03 +01:00
super ( ) . create_layout ( )
self . extend_well ( )
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
def add_modules ( self ) :
2022-12-09 23:25:11 +01:00
self . pmos = factory . create ( module_type = " ptx " ,
module_name = " pre_pmos_mod " ,
tx_type = " pmos "
)
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 " ,
mod = self . pmos ,
)
2022-12-30 09:35:15 +01:00
self . connect_inst ( [ " bitline " , " gate " , " vdd " , " body " ] )
2022-12-09 23:25:11 +01:00
def add_pins ( self ) :
2022-12-30 09:35:15 +01:00
pin_list = [ " vdd " , " gate " , " bitline " , " body " ]
2023-01-17 01:15:03 +01:00
dir_list = [ " POWER " , " INPUT " , " OUTPUT " , " POWER " ]
2022-12-09 23:25:11 +01:00
self . add_pin_list ( pin_list , dir_list )
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 )
2022-12-09 23:25:11 +01:00
#contact to contact distance, minimum cell width before drc offsets
self . base_width = self . pmos . width - 2 * self . active_enclose_contact - self . pmos . contact_width
# width offset to account for poly-active spacing between base and dummy cells on the same bitline
self . poly_active_offset = 0.5 * ( self . base_width - ( self . poly_width + 2 * self . active_enclose_contact + self . pmos . contact_width ) ) - self . poly_to_active
#so that the poly taps are far enough apart
self . poly_tap_offset = ( self . base_width - self . poly_contact . width - self . poly_active_offset ) - drc ( " poly_to_poly " )
2023-01-17 01:15:03 +01:00
def extend_well ( self ) :
self . pmos
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
well_y = - ( 0.5 * self . nwell_width )
well_ll = vector ( 0 , well_y )
# height = self.active_width + 2 * self.well_enclose_active
height = self . height + 0.5 * self . nwell_width
self . add_rect ( " nwell " , well_ll , self . width , height )
# def place_tx(self):
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# pmos_offset = vector(self.pmos.poly_extend_active + self.pmos.height, 0)
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# self.cell_inst.place(pmos_offset, rotate=90)
# self.add_label("inst_zero", self.bitline_layer)
# self.add_layout_pin_rect_center("S", self.bitline_layer, self.cell_inst.get_pin("S").center())
# self.add_layout_pin_rect_center("D", self.bitline_layer, self.cell_inst.get_pin("D").center())
# def place_poly(self):
# poly_size = (self.cell_inst.width + self.active_space) - (self.cell_inst.rx() + self.poly_extend_active)
# poly_offset = vector(self.cell_inst.rx() + self.poly_extend_active, self.cell_inst.width * 0.5 )
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# start = poly_offset
# end = poly_offset + vector(poly_size, 0)
# self.add_segment_center("poly", start, end)
# def add_boundary(self):
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# #cell width with offsets applied, height becomes width when the cells are rotated
# self.width = self.pmos.height + self.poly_extend_active_spacing + 2 * self.pmos.poly_extend_active
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# # cell height with offsets applied, width becomes height when the cells are rotated, if the offsets are positive (greater than 0) they are not applied
# # self.height = self.base_width - min(self.poly_active_offset, 0) - min(self.poly_tap_offset, 0)
2022-12-09 23:25:11 +01:00
2023-01-17 01:15:03 +01:00
# super().add_boundary()
2022-12-09 23:25:11 +01:00