From e15454ebb9b7b0362242f0253561c8f278942ce3 Mon Sep 17 00:00:00 2001 From: Eren Dogan Date: Tue, 29 Nov 2022 10:33:32 -0800 Subject: [PATCH] Make sram_config optional for sram --- compiler/modules/sram.py | 18 ++++++++++++++++-- sram_compiler.py | 18 +++--------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/compiler/modules/sram.py b/compiler/modules/sram.py index bf3c14ba..27d1bef6 100644 --- a/compiler/modules/sram.py +++ b/compiler/modules/sram.py @@ -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) diff --git a/sram_compiler.py b/sram_compiler.py index 1be28df8..bc11d310 100755 --- a/sram_compiler.py +++ b/sram_compiler.py @@ -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()