Make sram_config optional for sram

This commit is contained in:
Eren Dogan 2022-11-29 10:33:32 -08:00
parent 52b6804b93
commit e15454ebb9
2 changed files with 19 additions and 17 deletions

View File

@ -10,17 +10,31 @@ import shutil
import datetime
from openram import debug
from openram.characterizer import functional
from openram.modules import sram_config as config
from openram import OPTS, print_time
class sram():
"""
This is not a design module, but contains an SRAM design instance.
It could later try options of number of banks and oganization to compare
It could later try options of number of banks and organization to compare
results.
We can later add visualizer and other high-level functions as needed.
"""
def __init__(self, sram_config, name):
def __init__(self, sram_config=None, name=None):
# Create default configs if custom config isn't provided
if sram_config is None:
sram_config = config(word_size=OPTS.word_size,
num_words=OPTS.num_words,
write_size=OPTS.write_size,
num_banks=OPTS.num_banks,
words_per_row=OPTS.words_per_row,
num_spare_rows=OPTS.num_spare_rows,
num_spare_cols=OPTS.num_spare_cols)
if name is None:
name = OPTS.output_name
sram_config.set_local_config(self)

View File

@ -61,18 +61,7 @@ openram.print_time("Start", start_time)
# Output info about this run
openram.report_status()
from openram.modules import sram_config
# Configure the SRAM organization
c = sram_config(word_size=OPTS.word_size,
num_words=OPTS.num_words,
write_size=OPTS.write_size,
num_banks=OPTS.num_banks,
words_per_row=OPTS.words_per_row,
num_spare_rows=OPTS.num_spare_rows,
num_spare_cols=OPTS.num_spare_cols)
debug.print_raw("Words per row: {}".format(c.words_per_row))
debug.print_raw("Words per row: {}".format(OPTS.words_per_row))
output_extensions = ["lvs", "sp", "v", "lib", "py", "html", "log"]
# Only output lef/gds if back-end
@ -86,10 +75,9 @@ debug.print_raw("Output files are: ")
for path in output_files:
debug.print_raw(path)
# Create an SRAM (we can also pass sram_config, see documentation/tutorials for details)
from openram.modules import sram
s = sram(name=OPTS.output_name,
sram_config=c)
s = sram()
# Output the files for the resulting SRAM
s.save()