From 8ceece2af6739ed890a450c37aa4d0903332dcfe Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 18 Jun 2021 14:21:02 -0700 Subject: [PATCH 1/6] check for valid dimensions instead of recalcuating --- compiler/modules/bank.py | 12 +++--------- compiler/modules/port_data.py | 21 +++++++-------------- compiler/sram/sram_config.py | 11 ++++++++++- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/compiler/modules/bank.py b/compiler/modules/bank.py index 99ad8350..0e8b833f 100644 --- a/compiler/modules/bank.py +++ b/compiler/modules/bank.py @@ -392,14 +392,12 @@ class bank(design.design): cols=self.num_cols + self.num_spare_cols, rows=self.num_rows) self.add_mod(self.bitcell_array) - if self.num_spare_cols == 0: - self.num_spare_cols = (self.bitcell_array.column_size % (self.word_size *self.words_per_row)) self.port_address = [] for port in self.all_ports: self.port_address.append(factory.create(module_type="port_address", - cols=self.bitcell_array.column_size, - rows=self.bitcell_array.row_size, + cols=self.num_cols + self.num_spare_cols, + rows=self.num_rows, port=port)) self.add_mod(self.port_address[port]) @@ -408,10 +406,6 @@ class bank(design.design): for port in self.all_ports: temp_pre = factory.create(module_type="port_data", sram_config=self.sram_config, - dimension_override=True, - cols=self.bitcell_array.column_size - self.num_spare_cols, - rows=self.bitcell_array.row_size, - num_spare_cols=self.num_spare_cols, port=port, bit_offsets=self.bit_offsets) self.port_data.append(temp_pre) @@ -500,7 +494,7 @@ class bank(design.design): mod=self.port_address[port]) temp = [] - for bit in range(ceil(log(self.bitcell_array.row_size, 2))): + for bit in range(self.row_addr_size): temp.append("addr{0}_{1}".format(port, bit + self.col_addr_size)) temp.append("wl_en{}".format(port)) wordline_names = self.bitcell_array.get_wordline_names(port) diff --git a/compiler/modules/port_data.py b/compiler/modules/port_data.py index 3fbb8696..fa0d5763 100644 --- a/compiler/modules/port_data.py +++ b/compiler/modules/port_data.py @@ -21,31 +21,24 @@ class port_data(design.design): Port 0 always has the RBL on the left while port 1 is on the right. """ - def __init__(self, sram_config, port, num_spare_cols=None, bit_offsets=None, name="", rows=None, cols=None, dimension_override=False): - sram_config.set_local_config(self) - if dimension_override: - self.num_rows = rows - self.num_cols = cols - self.word_size = sram_config.word_size + def __init__(self, sram_config, port, num_spare_cols=None, bit_offsets=None, name="",): + sram_config.set_local_config(self) self.port = port if self.write_size is not None: self.num_wmasks = int(math.ceil(self.word_size / self.write_size)) else: self.num_wmasks = 0 - - if num_spare_cols: - self.num_spare_cols = num_spare_cols - elif self.num_spare_cols is None: + + if num_spare_cols is not None: + self.num_spare_cols = num_spare_cols + self.num_spare_cols + if self.num_spare_cols is None: self.num_spare_cols = 0 - if not bit_offsets: bitcell = factory.create(module_type=OPTS.bitcell) if(cell_properties.use_strap == True and OPTS.num_ports == 1): strap = factory.create(module_type=cell_properties.strap_module, version=cell_properties.strap_version) precharge_width = bitcell.width + strap.width - else: - precharge_width = bitcell.width self.bit_offsets = [] for i in range(self.num_cols + self.num_spare_cols): self.bit_offsets.append(i * precharge_width) @@ -855,4 +848,4 @@ class port_data(design.design): def graph_exclude_precharge(self): """Precharge adds a loop between bitlines, can be excluded to reduce complexity""" if self.precharge_array_inst: - self.graph_inst_exclude.add(self.precharge_array_inst) + self.graph_inst_exclude.add(self.precharge_array_inst) \ No newline at end of file diff --git a/compiler/sram/sram_config.py b/compiler/sram/sram_config.py index b7e3cad4..640b2a8d 100644 --- a/compiler/sram/sram_config.py +++ b/compiler/sram/sram_config.py @@ -9,6 +9,8 @@ import debug from math import log, sqrt, ceil from globals import OPTS from sram_factory import factory +from tech import array_row_multiple +from tech import array_col_multiple class sram_config: @@ -46,7 +48,7 @@ class sram_config: self.num_words_per_bank = self.num_words / self.num_banks self.num_bits_per_bank = self.word_size * self.num_words_per_bank - + # If this was hard coded, don't dynamically compute it! if not self.words_per_row: # Compute the area of the bitcells and estimate a square bank (excluding auxiliary circuitry) @@ -96,6 +98,13 @@ class sram_config: + " Col addr size: {}".format(self.col_addr_size) + " Bank addr size: {}".format(self.bank_addr_size)) + num_ports = OPTS.num_rw_ports + OPTS.num_w_ports + OPTS.num_w_ports + if ((self.num_cols + num_ports + self.num_spare_cols) % array_col_multiple != 0): + debug.error("Invalid number of cols including rbl(s): {}. Total cols must be divisible by {}".format(self.num_cols + num_ports + self.num_spare_cols, array_col_multiple), -1) + + if ((self.num_rows + num_ports) % array_row_multiple != 0): + debug.error("invalid number of rows including dummy row(s): {}. Total cols must be divisible by {}".format(self.num_rows + num_ports, array_row_multiple), -1) + def estimate_words_per_row(self, tentative_num_cols, word_size): """ This provides a heuristic rounded estimate for the number of words From 8346ad736e6c68b20517b9ef73201bae4a39c1b0 Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 18 Jun 2021 14:36:15 -0700 Subject: [PATCH 2/6] add dimension contraints to other tech files --- technology/freepdk45/tech/tech.py | 3 +++ technology/scn3me_subm/tech/tech.py | 2 ++ technology/scn4m_subm/tech/tech.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/technology/freepdk45/tech/tech.py b/technology/freepdk45/tech/tech.py index f5decd3c..46dc67fd 100644 --- a/technology/freepdk45/tech/tech.py +++ b/technology/freepdk45/tech/tech.py @@ -465,3 +465,6 @@ lvs_name = "calibre" pex_name = "calibre" blackbox_bitcell = False + +array_row_multiple = 1 +array_col_multiple = 1 \ No newline at end of file diff --git a/technology/scn3me_subm/tech/tech.py b/technology/scn3me_subm/tech/tech.py index 018a15da..39ca0cfc 100755 --- a/technology/scn3me_subm/tech/tech.py +++ b/technology/scn3me_subm/tech/tech.py @@ -305,3 +305,5 @@ pex_name = "magic" ################################################### ##END Technology Tool Preferences ################################################### +array_row_multiple = 1 +array_col_multiple = 1 \ No newline at end of file diff --git a/technology/scn4m_subm/tech/tech.py b/technology/scn4m_subm/tech/tech.py index dc6cd866..e5f50bd8 100644 --- a/technology/scn4m_subm/tech/tech.py +++ b/technology/scn4m_subm/tech/tech.py @@ -412,3 +412,6 @@ lvs_name = "netgen" pex_name = "magic" blackbox_bitcell = False + +array_row_multiple = 1 +array_col_multiple = 1 \ No newline at end of file From 0008df0204681be1297aafc83cfa9c8fdfafc078 Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 18 Jun 2021 15:24:24 -0700 Subject: [PATCH 3/6] catch where strap size is zero --- compiler/modules/port_data.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/modules/port_data.py b/compiler/modules/port_data.py index fa0d5763..762e788e 100644 --- a/compiler/modules/port_data.py +++ b/compiler/modules/port_data.py @@ -39,6 +39,8 @@ class port_data(design.design): if(cell_properties.use_strap == True and OPTS.num_ports == 1): strap = factory.create(module_type=cell_properties.strap_module, version=cell_properties.strap_version) precharge_width = bitcell.width + strap.width + else: + precharge_width = bitcell.width self.bit_offsets = [] for i in range(self.num_cols + self.num_spare_cols): self.bit_offsets.append(i * precharge_width) From 46889884344a97eb753957fb75392f1e65c28877 Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 18 Jun 2021 17:46:39 -0700 Subject: [PATCH 4/6] only check dimensions on single port --- compiler/sram/sram_config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/sram/sram_config.py b/compiler/sram/sram_config.py index 640b2a8d..a5948cb2 100644 --- a/compiler/sram/sram_config.py +++ b/compiler/sram/sram_config.py @@ -99,12 +99,13 @@ class sram_config: + " Bank addr size: {}".format(self.bank_addr_size)) num_ports = OPTS.num_rw_ports + OPTS.num_w_ports + OPTS.num_w_ports - if ((self.num_cols + num_ports + self.num_spare_cols) % array_col_multiple != 0): - debug.error("Invalid number of cols including rbl(s): {}. Total cols must be divisible by {}".format(self.num_cols + num_ports + self.num_spare_cols, array_col_multiple), -1) + if num_ports == 1: + if ((self.num_cols + num_ports + self.num_spare_cols) % array_col_multiple != 0): + debug.error("Invalid number of cols including rbl(s): {}. Total cols must be divisible by {}".format(self.num_cols + num_ports + self.num_spare_cols, array_col_multiple), -1) - if ((self.num_rows + num_ports) % array_row_multiple != 0): - debug.error("invalid number of rows including dummy row(s): {}. Total cols must be divisible by {}".format(self.num_rows + num_ports, array_row_multiple), -1) - + if ((self.num_rows + num_ports) % array_row_multiple != 0): + debug.error("invalid number of rows including dummy row(s): {}. Total cols must be divisible by {}".format(self.num_rows + num_ports, array_row_multiple), -1) + def estimate_words_per_row(self, tentative_num_cols, word_size): """ This provides a heuristic rounded estimate for the number of words From 2dbe928c090fac2578300596731e362e67afe8c1 Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 18 Jun 2021 18:08:57 -0700 Subject: [PATCH 5/6] fix typo --- compiler/sram/sram_config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/sram/sram_config.py b/compiler/sram/sram_config.py index a5948cb2..e3b33359 100644 --- a/compiler/sram/sram_config.py +++ b/compiler/sram/sram_config.py @@ -99,7 +99,8 @@ class sram_config: + " Bank addr size: {}".format(self.bank_addr_size)) num_ports = OPTS.num_rw_ports + OPTS.num_w_ports + OPTS.num_w_ports - if num_ports == 1: + print(num_ports) + if num_ports != 1: if ((self.num_cols + num_ports + self.num_spare_cols) % array_col_multiple != 0): debug.error("Invalid number of cols including rbl(s): {}. Total cols must be divisible by {}".format(self.num_cols + num_ports + self.num_spare_cols, array_col_multiple), -1) From 56dc83de476ec7129b22304e44f8038646e90653 Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 18 Jun 2021 18:10:12 -0700 Subject: [PATCH 6/6] fix typo --- compiler/sram/sram_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/sram/sram_config.py b/compiler/sram/sram_config.py index e3b33359..35226932 100644 --- a/compiler/sram/sram_config.py +++ b/compiler/sram/sram_config.py @@ -98,9 +98,9 @@ class sram_config: + " Col addr size: {}".format(self.col_addr_size) + " Bank addr size: {}".format(self.bank_addr_size)) - num_ports = OPTS.num_rw_ports + OPTS.num_w_ports + OPTS.num_w_ports + num_ports = OPTS.num_rw_ports + OPTS.num_r_ports + OPTS.num_w_ports print(num_ports) - if num_ports != 1: + if num_ports == 1: if ((self.num_cols + num_ports + self.num_spare_cols) % array_col_multiple != 0): debug.error("Invalid number of cols including rbl(s): {}. Total cols must be divisible by {}".format(self.num_cols + num_ports + self.num_spare_cols, array_col_multiple), -1)