diff --git a/compiler/base/utils.py b/compiler/base/utils.py index b13f2f7e..28c5f997 100644 --- a/compiler/base/utils.py +++ b/compiler/base/utils.py @@ -3,6 +3,7 @@ import gdsMill import tech import math import globals +import debug from vector import vector from pin_layout import pin_layout @@ -65,6 +66,7 @@ def get_gds_size(name, gds_filename, units, layer): Open a GDS file and return the size from either the bounding box or a border layer. """ + debug.info(2,"Creating VLSI layout for {}".format(name)) cell_vlsi = gdsMill.VlsiLayout(units=units) reader = gdsMill.Gds2reader(cell_vlsi) reader.loadFromFile(gds_filename) @@ -72,6 +74,7 @@ def get_gds_size(name, gds_filename, units, layer): cell = {} measure_result = cell_vlsi.getLayoutBorder(layer) if measure_result == None: + debug.info(2,"Layout border failed. Trying to measure size for {}".format(name)) measure_result = cell_vlsi.measureSize(name) # returns width,height return measure_result diff --git a/compiler/example_config_scn4m_subm.py b/compiler/example_config_scn4m_subm.py index f8bc7437..92332fd5 100644 --- a/compiler/example_config_scn4m_subm.py +++ b/compiler/example_config_scn4m_subm.py @@ -11,9 +11,9 @@ output_path = "temp" output_name = "sram_{0}_{1}_{2}_{3}".format(word_size,num_words,num_banks,tech_name) #Setting for multiport -netlist_only = True -bitcell = "pbitcell" -replica_bitcell="replica_pbitcell" -num_rw_ports = 1 -num_r_ports = 1 -num_w_ports = 0 +# netlist_only = True +# bitcell = "pbitcell" +# replica_bitcell="replica_pbitcell" +# num_rw_ports = 1 +# num_r_ports = 1 +# num_w_ports = 0 diff --git a/compiler/gdsMill/gdsMill/vlsiLayout.py b/compiler/gdsMill/gdsMill/vlsiLayout.py index 5e12619c..99a1b9e5 100644 --- a/compiler/gdsMill/gdsMill/vlsiLayout.py +++ b/compiler/gdsMill/gdsMill/vlsiLayout.py @@ -155,10 +155,10 @@ class VlsiLayout: def traverseTheHierarchy(self, startingStructureName=None, delegateFunction = None, transformPath = [], rotateAngle = 0, transFlags = [0,0,0], coordinates = (0,0)): #since this is a recursive function, must deal with the default - #parameters explicitly + #parameters explicitly if startingStructureName == None: startingStructureName = self.rootStructureName - + #set up the rotation matrix if(rotateAngle == None or rotateAngle == ""): angle = 0 diff --git a/compiler/modules/bitcell_1rw_1r.py b/compiler/modules/bitcell_1rw_1r.py new file mode 100644 index 00000000..9cec7d8d --- /dev/null +++ b/compiler/modules/bitcell_1rw_1r.py @@ -0,0 +1,98 @@ +import design +import debug +import utils +from tech import GDS,layer + +class bitcell_1rw_1r(design.design): + """ + A single bit cell (6T, 8T, etc.) This module implements the + single memory cell used in the design. It is a hand-made cell, so + the layout and netlist should be available in the technology + library. + """ + + pin_names = ["bl0", "br0", "bl1", "br1", "wl0", "wl1", "vdd", "gnd"] + (width,height) = utils.get_libcell_size("cell_1rw_1r", GDS["unit"], layer["boundary"]) + pin_map = utils.get_libcell_pins(pin_names, "cell_1rw_1r", GDS["unit"], layer["boundary"]) + + def __init__(self): + design.design.__init__(self, "cell_1rw_1r") + debug.info(2, "Create bitcell with 1RW and 1R Port") + + self.width = bitcell.width + self.height = bitcell.height + self.pin_map = bitcell.pin_map + + def analytical_delay(self, slew, load=0, swing = 0.5): + # delay of bit cell is not like a driver(from WL) + # so the slew used should be 0 + # it should not be slew dependent? + # because the value is there + # the delay is only over half transsmission gate + from tech import spice + r = spice["min_tx_r"]*3 + c_para = spice["min_tx_drain_c"] + result = self.cal_delay_with_rc(r = r, c = c_para+load, slew = slew, swing = swing) + return result + + + def list_bitcell_pins(self, col, row): + """ Creates a list of connections in the bitcell, indexed by column and row, for instance use in bitcell_array """ + bitcell_pins = ["bl0[{0}]".format(col), + "br0[{0}]".format(col), + "bl1[{0}]".format(col), + "br1[{0}]".format(col), + "wl0[{0}]".format(row), + "wl1[{0}]".format(row), + "vdd", + "gnd"] + return bitcell_pins + + def list_all_wl_names(self): + """ Creates a list of all wordline pin names """ + row_pins = ["wl0", "wl1"] + return row_pins + + def list_all_bitline_names(self): + """ Creates a list of all bitline pin names (both bl and br) """ + column_pins = ["bl0", "br0", "bl1", "br1"] + return column_pins + + def list_all_bl_names(self): + """ Creates a list of all bl pins names """ + column_pins = ["bl0", "bl1"] + return column_pins + + def list_all_br_names(self): + """ Creates a list of all br pins names """ + column_pins = ["br0", "br1"] + return column_pins + + def list_read_bl_names(self): + """ Creates a list of bl pin names associated with read ports """ + column_pins = ["bl0", "bl1"] + return column_pins + + def list_read_br_names(self): + """ Creates a list of br pin names associated with read ports """ + column_pins = ["br0", "br1"] + return column_pins + + def list_write_bl_names(self): + """ Creates a list of bl pin names associated with write ports """ + column_pins = ["bl0"] + return column_pins + + def list_write_br_names(self): + """ Creates a list of br pin names asscociated with write ports""" + column_pins = ["br0"] + return column_pins + + def analytical_power(self, proc, vdd, temp, load): + """Bitcell power in nW. Only characterizes leakage.""" + from tech import spice + leakage = spice["bitcell_leakage"] + dynamic = 0 #temporary + total_power = self.return_power(dynamic, leakage) + return total_power + diff --git a/compiler/sram_config.py b/compiler/sram_config.py index e7c80fd8..3c3892a5 100644 --- a/compiler/sram_config.py +++ b/compiler/sram_config.py @@ -53,7 +53,7 @@ class sram_config: # Estimate the number of rows given the tentative words per row self.tentative_num_rows = self.num_bits_per_bank / (self.words_per_row*self.word_size) self.words_per_row = self.amend_words_per_row(self.tentative_num_rows, self.words_per_row) - + # Fix the number of columns and rows self.num_cols = int(self.words_per_row*self.word_size) self.num_rows = int(self.num_words_per_bank/self.words_per_row) diff --git a/compiler/tests/04_bitcell_1rw_1r_test.py b/compiler/tests/04_bitcell_1rw_1r_test.py new file mode 100755 index 00000000..567cd291 --- /dev/null +++ b/compiler/tests/04_bitcell_1rw_1r_test.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +""" +Run regresion tests on a parameterized bitcell +""" + +import unittest +from testutils import header,openram_test +import sys,os +sys.path.append(os.path.join(sys.path[0],"..")) +import globals +from globals import OPTS +import debug + +OPTS = globals.OPTS + +#@unittest.skip("SKIPPING 04_bitcell_1rw_1r_test") +class bitcell_1rw_1r_test(openram_test): + + def runTest(self): + OPTS.bitcell = "bitcell_1rw_1r" + globals.init_openram("config_20_{0}".format(OPTS.tech_name)) + from bitcell import bitcell + from bitcell_1rw_1r import bitcell_1rw_1r + import tech + OPTS.num_rw_ports=1 + OPTS.num_w_ports=0 + OPTS.num_r_ports=1 + debug.info(2, "Bitcell with 1 read/write and 1 read port") + #tx = bitcell_1rw_1r() + tx = bitcell() + self.local_check(tx) + + globals.end_openram() + + + +# instantiate a copy of the class to actually run the test +if __name__ == "__main__": + (OPTS, args) = globals.parse_args() + del sys.argv[1:] + header(__file__, OPTS.tech_name) + unittest.main() diff --git a/technology/freepdk45/gds_lib/cell_1rw_1r.gds b/technology/freepdk45/gds_lib/cell_1rw_1r.gds new file mode 100644 index 00000000..9f4e0650 Binary files /dev/null and b/technology/freepdk45/gds_lib/cell_1rw_1r.gds differ diff --git a/technology/freepdk45/sp_lib/cell_1rw_1r.sp b/technology/freepdk45/sp_lib/cell_1rw_1r.sp new file mode 100644 index 00000000..483a0b4b --- /dev/null +++ b/technology/freepdk45/sp_lib/cell_1rw_1r.sp @@ -0,0 +1,14 @@ + +.SUBCKT cell_1rw_1r bl0 br0 bl1 br1 wl0 wl1 vdd gnd +MM9 RA_to_R_right wl1 br1 gnd NMOS_VTG W=180.0n L=50n m=1 +MM8 RA_to_R_right Q gnd gnd NMOS_VTG W=180.0n L=50n m=1 +MM7 RA_to_R_left Q_bar gnd gnd NMOS_VTG W=180.0n L=50n m=1 +MM6 RA_to_R_left wl1 bl1 gnd NMOS_VTG W=180.0n L=50n m=1 +MM5 Q wl0 bl0 gnd NMOS_VTG W=135.00n L=50n m=1 +MM4 Q_bar wl0 br0 gnd NMOS_VTG W=135.00n L=50n m=1 +MM1 Q Q_bar gnd gnd NMOS_VTG W=270.0n L=50n m=1 +MM0 Q_bar Q gnd gnd NMOS_VTG W=270.0n L=50n m=1 +MM3 Q Q_bar vdd vdd PMOS_VTG W=90n L=50n m=1 +MM2 Q_bar Q vdd vdd PMOS_VTG W=90n L=50n m=1 +.ENDS + diff --git a/technology/scn4m_subm/mag_lib/cell_1rw_1r.mag b/technology/scn4m_subm/mag_lib/cell_1rw_1r.mag new file mode 100644 index 00000000..7d3823b8 --- /dev/null +++ b/technology/scn4m_subm/mag_lib/cell_1rw_1r.mag @@ -0,0 +1,146 @@ +magic +tech scmos +timestamp 1539900829 +<< nwell >> +rect -18 -1 32 26 +<< pwell >> +rect -18 -51 32 -6 +<< ntransistor >> +rect -6 -18 -4 -12 +rect 2 -24 4 -12 +rect 10 -24 12 -12 +rect 18 -18 20 -12 +rect -6 -36 -4 -28 +rect 2 -36 4 -28 +rect 10 -36 12 -28 +rect 18 -36 20 -28 +<< ptransistor >> +rect 2 5 4 9 +rect 10 5 12 9 +<< ndiffusion >> +rect -11 -14 -6 -12 +rect -7 -18 -6 -14 +rect -4 -18 -3 -12 +rect 1 -20 2 -12 +rect -3 -24 2 -20 +rect 4 -24 5 -12 +rect 9 -24 10 -12 +rect 12 -20 13 -12 +rect 17 -18 18 -12 +rect 20 -14 25 -12 +rect 20 -18 21 -14 +rect 12 -24 17 -20 +rect -11 -30 -6 -28 +rect -7 -34 -6 -30 +rect -11 -36 -6 -34 +rect -4 -36 2 -28 +rect 4 -36 5 -28 +rect 9 -36 10 -28 +rect 12 -36 18 -28 +rect 20 -30 25 -28 +rect 20 -34 21 -30 +rect 20 -36 25 -34 +<< pdiffusion >> +rect 1 5 2 9 +rect 4 5 5 9 +rect 9 5 10 9 +rect 12 5 13 9 +<< ndcontact >> +rect -11 -18 -7 -14 +rect -3 -20 1 -12 +rect 5 -24 9 -12 +rect 13 -20 17 -12 +rect 21 -18 25 -14 +rect -11 -34 -7 -30 +rect 5 -36 9 -28 +rect 21 -34 25 -30 +<< pdcontact >> +rect -3 5 1 9 +rect 5 5 9 9 +rect 13 5 17 9 +<< psubstratepcontact >> +rect 5 -44 9 -40 +<< nsubstratencontact >> +rect 5 19 9 23 +<< polysilicon >> +rect 2 9 4 11 +rect 10 9 12 11 +rect 2 -5 4 5 +rect 10 2 12 5 +rect 11 -2 12 2 +rect -6 -12 -4 -7 +rect 2 -9 3 -5 +rect 2 -12 4 -9 +rect 10 -12 12 -2 +rect 18 -12 20 -7 +rect -6 -20 -4 -18 +rect 18 -20 20 -18 +rect -6 -28 -4 -27 +rect 2 -28 4 -24 +rect 10 -28 12 -24 +rect 18 -28 20 -27 +rect -6 -38 -4 -36 +rect 2 -38 4 -36 +rect 10 -38 12 -36 +rect 18 -38 20 -36 +<< polycontact >> +rect 7 -2 11 2 +rect -10 -11 -6 -7 +rect 3 -9 7 -5 +rect 20 -11 24 -7 +rect -8 -27 -4 -23 +rect 18 -27 22 -23 +<< metal1 >> +rect -18 19 5 23 +rect 9 19 32 23 +rect -18 12 32 16 +rect -10 -7 -6 12 +rect -3 2 0 5 +rect -3 -2 7 2 +rect -3 -12 0 -2 +rect 14 -5 17 5 +rect 7 -9 17 -5 +rect 14 -12 17 -9 +rect 20 -7 24 12 +rect -14 -18 -11 -14 +rect 25 -18 28 -14 +rect 5 -28 9 -24 +rect 5 -40 9 -36 +rect -17 -44 5 -40 +rect 9 -44 31 -40 +rect -17 -51 -4 -47 +rect 0 -51 14 -47 +rect 18 -51 31 -47 +<< m2contact >> +rect 5 19 9 23 +rect 5 5 9 9 +rect -18 -18 -14 -14 +rect -4 -27 0 -23 +rect 28 -18 32 -14 +rect 14 -27 18 -23 +rect -11 -34 -7 -30 +rect 21 -34 25 -30 +rect -4 -51 0 -47 +rect 14 -51 18 -47 +<< metal2 >> +rect -18 -14 -14 23 +rect -18 -51 -14 -18 +rect -11 -30 -7 23 +rect 5 9 9 19 +rect -11 -51 -7 -34 +rect -4 -47 0 -27 +rect 14 -47 18 -27 +rect 21 -30 25 23 +rect 21 -51 25 -34 +rect 28 -14 32 23 +rect 28 -51 32 -18 +<< labels >> +rlabel metal1 7 -49 7 -49 1 wl1 +rlabel psubstratepcontact 7 -42 7 -42 1 gnd +rlabel m2contact 7 21 7 21 5 vdd +rlabel metal1 -1 14 -1 14 1 wl0 +rlabel metal2 -16 -46 -16 -46 2 bl0 +rlabel metal2 -9 -46 -9 -46 1 bl1 +rlabel metal2 23 -46 23 -46 1 br1 +rlabel metal2 30 -46 30 -46 8 br0 +<< end >>