From d42cd9a281f0f1f96f3dc9a5979e882d1343c2be Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Mon, 27 Jan 2020 10:03:31 +0000 Subject: [PATCH] pbitcell working with bitline adjustments --- compiler/base/geometry.py | 18 ++++++------ compiler/characterizer/stimuli.py | 4 --- compiler/sram/sram_base.py | 48 +++++++++++++++++-------------- compiler/verify/magic.py | 6 +--- 4 files changed, 37 insertions(+), 39 deletions(-) diff --git a/compiler/base/geometry.py b/compiler/base/geometry.py index 175ec0d3..3b2eb2d3 100644 --- a/compiler/base/geometry.py +++ b/compiler/base/geometry.py @@ -333,22 +333,22 @@ class instance(geometry): if node.mirror == 'MX': Q_y = -1 * Q_y Q_bar_y = -1 * Q_bar_y + for pair in range(len(normalized_bl_offsets)): - for offset in range(len(offset)): - normalized_bl_offsets[pair][offset] = -1 * normalized_bl_offsets[pair][offset] + normalized_bl_offsets[pair] = (normalized_bl_offsets[pair][0], + -1 * normalized_bl_offsets[pair][1]) for pair in range(len(normalized_br_offsets)): - for offset in range(len(offset)): - normalized_br_offsets[pair][offset] = -1 * normalized_br_offsets[pair][offset] + normalized_br_offsets[pair] = (normalized_br_offsets[pair][0], + -1 * normalized_br_offsets[pair][1]) Q_offsets.append([Q_x, Q_y]) Q_bar_offsets.append([Q_bar_x, Q_bar_y]) - for offset in bl_offset: - bl_offsets.append(offset) - for offset in br.offset: - br_offsets.append(offset) + + bl_offsets.append(normalized_bl_offsets) + br_offsets.append(normalized_br_offsets) elif node.mod.insts is not []: for instance in node.mod.insts: @@ -360,7 +360,7 @@ class instance(geometry): vector_spaces = self.apply_path_transform(path) origin = vector_spaces[2] origin_offsets.append([origin[0], origin[1]]) - + return(origin_offsets, Q_offsets, Q_bar_offsets, bl_offsets, br_offsets) def __str__(self): diff --git a/compiler/characterizer/stimuli.py b/compiler/characterizer/stimuli.py index f413d97b..b4cd00f4 100644 --- a/compiler/characterizer/stimuli.py +++ b/compiler/characterizer/stimuli.py @@ -63,10 +63,6 @@ class stimuli(): self.sf.write("bitcell_Q_b{0}_r{1}_c{2} ".format(bank,row,col)) self.sf.write("bitcell_Q_bar_b{0}_r{1}_c{2} ".format(bank,row,col)) for col in range(OPTS.word_size): - if OPTS.num_banks == 1: - self.sf.write("bl_{2} ".format(bank, row,col)) - self.sf.write("br_{2} ".format(bank, row,col)) - else: self.sf.write("bl{0}_{2} ".format(bank, row,col)) self.sf.write("br{0}_{2} ".format(bank, row,col)) diff --git a/compiler/sram/sram_base.py b/compiler/sram/sram_base.py index 762295d4..2c66924a 100644 --- a/compiler/sram/sram_base.py +++ b/compiler/sram/sram_base.py @@ -19,6 +19,7 @@ from verilog import verilog from lef import lef from sram_factory import factory from tech import drc +import numpy as np import logical_effort class sram_base(design, verilog, lef): @@ -102,33 +103,38 @@ class sram_base(design, verilog, lef): bl_offsets = pex_offsets[3] br_offsets = pex_offsets[4] - storage_layer_name = "metal1" - bitline_layer_name = "metal2" - - Q = [bank_offset[bank_num][0] + Q_offset[bank_num][0], bank_offset[bank_num][1] + Q_offset[bank_num][1]] - Q_bar = [bank_offset[bank_num][0] + Q_bar_offset[bank_num][0], bank_offset[bank_num][1] + Q_bar_offset[bank_num][1]] - bl = [] br = [] - for i in range(len(bl_offsets)): - bl.append([bank_offset[bank_num][1] + bl_offsets[bank_num][2*(i)], bank_offset[bank_num][1] + bl_offsets[bank_num][2*(i)+1]]) + storage_layer_name = "metal1" + bitline_layer_name = "metal2" + + for cell in range(len(bank_offset)): + Q = [bank_offset[cell][0] + Q_offset[cell][0], bank_offset[cell][1] + Q_offset[cell][1]] + Q_bar = [bank_offset[cell][0] + Q_bar_offset[cell][0], bank_offset[cell][1] + Q_bar_offset[cell][1]] - for i in range(len(br_offsets)): - br.append([bank_offset[bank_num][1] + br_offsets[bank_num][2*(i)], bank_offset[bank_num][1] + br_offsets[bank_num][2*(i)+1]]) + self.add_layout_pin_rect_center("bitcell_Q_b{0}_r{1}_c{2}".format(bank_num, cell % OPTS.num_words, int(cell / OPTS.num_words)) , storage_layer_name, Q) + self.add_layout_pin_rect_center("bitcell_Q_bar_b{0}_r{1}_c{2}".format(bank_num, cell % OPTS.num_words, int(cell / OPTS.num_words)), storage_layer_name, Q_bar) + + for bitline in range(len(bl_offsets[cell])): + bitline_location = [float(bank_offset[cell][0]) + bl_offsets[cell][bitline][0], float(bank_offset[cell][1]) + bl_offsets[cell][bitline][1]] + bl.append(bitline_location) - self.add_layout_pin_rect_center("bitcell_Q_b{0}_r{1}_c{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)) , storage_layer_name, Q) - self.add_layout_pin_rect_center("bitcell_Q_bar_b{0}_r{1}_c{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)), storage_layer_name, Q_bar) + for bitline in range(len(br_offsets[0])): + bitline_location = [float(bank_offset[cell][0]) + br_offsets[cell][bitline][0], float(bank_offset[cell][1]) + br_offsets[cell][bitline][1]] + br.append(bitline_location) + + for col in range(len(bl)): + if OPTS.num_banks == 1: + self.add_layout_pin_rect_center("bl0_{0}".format(int(col / OPTS.num_words)), bitline_layer_name, bl[col]) + else: + self.add_layout_pin_rect_center("bl{0}_{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)) , bitline_layer_name, bl) - if OPTS.num_banks == 1: - for i in range(len(bl_offsets)): - self.add_layout_pin_rect_center("bl_{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)) , bitline_layer_name, bl) - - for i in range(len(br_offsets)): - self.add_layout_pin_rect_center("br_{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)), bitline_layer_name, br) - else: - self.add_layout_pin_rect_center("bl{0}_{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)) , bitline_layer_name, bl) - self.add_layout_pin_rect_center("br{0}_{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)), bitline_layer_name, br) + for col in range(len(br)): + if OPTS.num_banks == 1: + self.add_layout_pin_rect_center("br0_{0}".format(int(col / OPTS.num_words)), bitline_layer_name, br[col]) + else: + self.add_layout_pin_rect_center("br{0}_{2}".format(bank_num, i % OPTS.num_words, int(i / OPTS.num_words)) , bitline_layer_name, br) diff --git a/compiler/verify/magic.py b/compiler/verify/magic.py index 16f37bdc..d81255b6 100644 --- a/compiler/verify/magic.py +++ b/compiler/verify/magic.py @@ -420,12 +420,8 @@ def correct_port(name, output_file_name, ref_file_name): bitcell_list += "bitcell_Q_b{0}_r{1}_c{2} ".format(bank, row,col) bitcell_list += "bitcell_Q_bar_b{0}_r{1}_c{2} ".format(bank, row,col) for col in range(OPTS.word_size): - if OPTS.num_banks == 1: - bitcell_list += "bl_{2} ".format(bank, row,col) - bitcell_list += "br_{2} ".format(bank, row,col) - else: bitcell_list += "bl{0}_{2} ".format(bank, row,col) - bitcell_list += "br{0}_{2} ".format(bank, row,col) + bitcell_list += "br{0}_{2} ".format(bank, row,col) bitcell_list += "\n" control_list = "+ "