Read different modules overrides for different num ports

This commit is contained in:
mrg 2020-11-06 11:09:50 -08:00
parent 8be1436d51
commit 493c9125f1
7 changed files with 15 additions and 8 deletions

View File

@ -314,7 +314,7 @@ def read_config(config_file, is_unit_test=True):
try: try:
config = importlib.import_module(module_name) config = importlib.import_module(module_name)
except: except:
debug.error("Unable to read configuration file: {0}".format(config_file),2) debug.error("Unable to read configuration file: {0}".format(config_file), 2)
OPTS.overridden = {} OPTS.overridden = {}
for k, v in config.__dict__.items(): for k, v in config.__dict__.items():

View File

@ -11,6 +11,7 @@ from tech import drc, layer
from vector import vector from vector import vector
from sram_factory import factory from sram_factory import factory
from tech import cell_properties as cell_props from tech import cell_properties as cell_props
from globals import OPTS
class column_mux(pgate.pgate): class column_mux(pgate.pgate):
@ -64,7 +65,7 @@ class column_mux(pgate.pgate):
self.add_pn_wells() self.add_pn_wells()
def add_ptx(self): def add_ptx(self):
self.bitcell = factory.create(module_type="bitcell") self.bitcell = factory.create(module_type=OPTS.bitcell)
# Adds nmos_lower,nmos_upper to the module # Adds nmos_lower,nmos_upper to the module
self.ptx_width = self.tx_size * drc("minwidth_tx") self.ptx_width = self.tx_size * drc("minwidth_tx")

View File

@ -27,7 +27,7 @@ class pinv_dec(pinv.pinv):
"creating pinv_dec structure {0} with size of {1}".format(name, "creating pinv_dec structure {0} with size of {1}".format(name,
size)) size))
if not height: if not height:
b = factory.create(module_type="bitcell") b = factory.create(module_type=OPTS.bitcell)
self.cell_height = b.height self.cell_height = b.height
else: else:
self.cell_height = height self.cell_height = height

View File

@ -26,7 +26,7 @@ class precharge(design.design):
debug.info(2, "creating precharge cell {0}".format(name)) debug.info(2, "creating precharge cell {0}".format(name))
super().__init__(name) super().__init__(name)
self.bitcell = factory.create(module_type="bitcell") self.bitcell = factory.create(module_type=OPTS.bitcell)
self.beta = parameter["beta"] self.beta = parameter["beta"]
self.ptx_width = self.beta * parameter["min_tx_size"] self.ptx_width = self.beta * parameter["min_tx_size"]
self.ptx_mults = 1 self.ptx_mults = 1

View File

@ -25,15 +25,15 @@ class pwrite_driver(design.design):
super().__init__(name) super().__init__(name)
self.size = size self.size = size
self.beta = parameter["beta"] self.beta = parameter["beta"]
self.pmos_width = self.beta*self.size*parameter["min_tx_size"] self.pmos_width = self.beta * self.size * parameter["min_tx_size"]
self.nmos_width = self.size*parameter["min_tx_size"] self.nmos_width = self.size * parameter["min_tx_size"]
# The tech M2 pitch is based on old via orientations # The tech M2 pitch is based on old via orientations
self.m2_pitch = self.m2_space + self.m2_width self.m2_pitch = self.m2_space + self.m2_width
# Width is matched to the bitcell, # Width is matched to the bitcell,
# Height will be variable # Height will be variable
self.bitcell = factory.create(module_type="bitcell") self.bitcell = factory.create(module_type=OPTS.bitcell)
self.width = self.bitcell.width self.width = self.bitcell.width
# Creates the netlist and layout # Creates the netlist and layout

View File

@ -25,7 +25,7 @@ class wordline_driver(design.design):
super().__init__(name) super().__init__(name)
if height is None: if height is None:
b = factory.create(module_type="bitcell") b = factory.create(module_type=OPTS.bitcell)
self.height = b.height self.height = b.height
else: else:
self.height = height self.height = height

View File

@ -7,6 +7,7 @@
# #
from globals import OPTS from globals import OPTS
class sram_factory: class sram_factory:
""" """
This is a factory pattern to create modules for usage in an SRAM. This is a factory pattern to create modules for usage in an SRAM.
@ -39,6 +40,11 @@ class sram_factory:
try: try:
from tech import tech_modules from tech import tech_modules
real_module_type = tech_modules[module_type] real_module_type = tech_modules[module_type]
# If we are given a list of modules, it is indexed by number of ports starting from 1
if type(real_module_type) is list:
# For now we will just index by the number of ports (except can't have 0 ports)
num_ports = OPTS.num_rw_ports + OPTS.num_r_ports + OPTS.num_w_ports
real_module_type = real_module_type[num_ports - 1]
overridden = tech_modules.is_overridden(module_type) overridden = tech_modules.is_overridden(module_type)
except ImportError: except ImportError:
# If they didn't define these, then don't use the option types. # If they didn't define these, then don't use the option types.