From 03f87cd6817860538eaa61ae4b77bfdfa3e0596f Mon Sep 17 00:00:00 2001 From: mrg Date: Tue, 7 Sep 2021 16:49:31 -0700 Subject: [PATCH] Add str function for sram_config --- compiler/sram/sram_config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/compiler/sram/sram_config.py b/compiler/sram/sram_config.py index d28f28a8..4c1bb117 100644 --- a/compiler/sram/sram_config.py +++ b/compiler/sram/sram_config.py @@ -43,6 +43,21 @@ class sram_config: self.compute_sizes() + def __str__(self): + """ override print function output """ + config_items = ["num_banks", + "word_size", + "num_words", + "words_per_row", + "write_size", + "num_spare_rows", + "num_spare_cols"] + str = "" + for item in config_items: + val = getattr(self, item) + str += "{} : {}\n".format(item, val) + return str + def set_local_config(self, module): """ Copy all of the member variables to the given module for convenience """