def runTest(self): globals.init_openram("config_20_{0}".format(OPTS.tech_name)) # we will manually run lvs/drc OPTS.check_lvsdrc = False OPTS.spice_version = "ngspice" OPTS.force_spice = True globals.set_spice() import sram import setup_hold sh = setup_hold.setup_hold() [one_setup_time, zero_setup_time] = sh.hold_time() # reset these options OPTS.check_lvsdrc = True OPTS.spice_version = "hspice" OPTS.force_spice = False globals.set_spice() if OPTS.tech_name == "freepdk45": self.assertTrue(isclose(one_setup_time, -0.0048828125)) self.assertTrue(isclose(zero_setup_time, -0.010986328125)) elif OPTS.tech_name == "scn3me_subm": self.assertTrue(isclose(one_setup_time, 0.45654296875)) # diff than hspice self.assertTrue(isclose(zero_setup_time, -0.0830078125)) else: self.assertTrue(False) # other techs fail
def runTest(self): globals.init_openram("config_20_{0}".format(OPTS.tech_name)) # we will manually run lvs/drc OPTS.check_lvsdrc = False OPTS.spice_version = "hspice" OPTS.force_spice = True globals.set_spice() import sram import setup_hold sh = setup_hold.setup_hold() [one_setup_time, zero_setup_time] = sh.setup_time() OPTS.check_lvsdrc = True if OPTS.tech_name == "freepdk45": self.assertTrue(isclose(one_setup_time, 0.0146484375)) self.assertTrue(isclose(zero_setup_time, 0.008544921875)) elif OPTS.tech_name == "scn3me_subm": self.assertTrue(isclose(one_setup_time, 0.0927734375)) self.assertTrue(isclose(zero_setup_time, -0.0244140625)) else: self.assertTrue(False) # other techs fail globals.end_openram()
def __init__(self, libname, sram, spfile): self.name = sram.name self.num_words = sram.num_words self.word_size = sram.word_size self.addr_size = sram.addr_size self.sh = setup_hold.setup_hold() self.d = delay.delay(sram, spfile) debug.info(1,"Writing to {0}".format(libname)) self.lib = open(libname, "w") self.lib.write("library ({0}_lib)".format(self.name)) self.lib.write("{\n") self.lib.write(" delay_model : \"table_lookup\";\n") self.write_units() self.write_defaults() self.write_LUT() self.lib.write(" default_operating_conditions : TT; \n") self.write_bus() self.lib.write("cell ({0})".format(self.name)) self.lib.write("{\n") self.lib.write(" memory(){ \n") self.lib.write(" type : ram;\n") self.lib.write(" address_width : {0};\n".format(self.addr_size)) self.lib.write(" word_width : {0};\n".format(self.word_size)) self.lib.write(" }\n") self.lib.write(" interface_timing : true;\n") self.lib.write(" dont_use : true;\n") self.lib.write(" map_only : true;\n") self.lib.write(" dont_touch : true;\n") self.lib.write(" area : {0};\n\n".format(sram.width * sram.height)) times = self.sh.analyze() for i in times.keys(): times[i] = ch.round_time(times[i]) probe_address = "1" * self.addr_size probe_data = self.word_size - 1 data = self.d.analyze(probe_address, probe_data) for i in data.keys(): data[i] = ch.round_time(data[i]) self.write_data_bus(data, times) self.write_addr_bus(times) self.write_control_pins(times) self.write_clk(data) self.lib.close()
def compute_setup_hold(self): """ Do the analysis if we haven't characterized a FF yet """ # Do the analysis if we haven't characterized a FF yet try: self.sh except AttributeError: self.sh = setup_hold.setup_hold() if self.use_model: self.times = self.sh.analytical_model(self.slews, self.loads) else: self.times = self.sh.analyze(self.slews, self.slews)
def runTest(self): globals.init_openram("config_20_{0}".format(OPTS.tech_name)) # we will manually run lvs/drc OPTS.check_lvsdrc = False OPTS.spice_version = "ngspice" globals.set_spice() import sram import tech slews = [tech.spice["rise_time"] * 2] import setup_hold sh = setup_hold.setup_hold() data = sh.analyze(slews, slews) if OPTS.tech_name == "freepdk45": golden_data = { 'setup_times_LH': [0.01464844], 'hold_times_LH': [0.0024414059999999997], 'hold_times_HL': [-0.003662109], 'setup_times_HL': [0.008544922] } elif OPTS.tech_name == "scn3me_subm": golden_data = { 'setup_times_LH': [0.1000977], 'hold_times_LH': [0.02075195], 'hold_times_HL': [-0.08300781], 'setup_times_HL': [0.02075195] } else: self.assertTrue(False) # other techs fail # Check if no too many or too few results self.assertTrue(len(data.keys()) == len(golden_data.keys())) # Check each result for k in data.keys(): if type(data[k]) == list: for i in range(len(data[k])): self.assertTrue(isclose(data[k][i], golden_data[k][i])) else: self.assertTrue(isclose(data[k], golden_data[k])) # reset these options OPTS.check_lvsdrc = True OPTS.spice_version = "hspice" globals.set_spice() globals.end_openram()
def runTest(self): globals.init_openram("config_20_{0}".format(OPTS.tech_name)) # we will manually run lvs/drc OPTS.check_lvsdrc = False OPTS.spice_version = "ngspice" OPTS.force_spice = True globals.set_spice() import sram import tech slews = [tech.spice["rise_time"] * 2] import setup_hold sh = setup_hold.setup_hold() data = sh.analyze(slews, slews) # reset these options OPTS.check_lvsdrc = True OPTS.spice_version = "hspice" OPTS.force_spice = False globals.set_spice() one_setup_time = data['setup_times_LH'][0] zero_setup_time = data['setup_times_HL'][0] one_hold_time = data['hold_times_LH'][0] zero_hold_time = data['hold_times_HL'][0] if OPTS.tech_name == "freepdk45": self.assertTrue(isclose(one_setup_time, 0.0146)) self.assertTrue(isclose(zero_setup_time, 0.0085)) self.assertTrue(isclose(one_hold_time, 0.00244)) self.assertTrue(isclose(zero_hold_time, -0.00366)) elif OPTS.tech_name == "scn3me_subm": self.assertTrue(isclose(one_setup_time, 0.1001)) self.assertTrue(isclose(zero_setup_time, 0.0208)) self.assertTrue(isclose(one_hold_time, 0.02075)) self.assertTrue(isclose(zero_hold_time, -0.08301)) else: self.assertTrue(False) # other techs fail
def runTest(self): globals.init_openram("config_20_{0}".format(OPTS.tech_name)) # we will manually run lvs/drc OPTS.check_lvsdrc = False OPTS.use_pex = False import sram import setup_hold sh = setup_hold.setup_hold() [one_setup_time, zero_setup_time] = sh.hold_time() OPTS.check_lvsdrc = True if OPTS.tech_name == "freepdk45": self.assertTrue(isclose(one_setup_time, -0.0048828125)) self.assertTrue(isclose(zero_setup_time, -0.010986328125)) elif OPTS.tech_name == "scn3me_subm": self.assertTrue(isclose(one_setup_time, 0.04638671875)) self.assertTrue(isclose(zero_setup_time, -0.0830078125)) else: self.assertTrue(False) # other techs fail