Modified unit tests: one for analytical model, one for characterization.

This commit is contained in:
Matt Guthaus 2017-05-31 14:59:22 -07:00
parent 367d4168ad
commit 384e169b5b
2 changed files with 9 additions and 20 deletions

View File

@ -25,32 +25,24 @@ class lib_test(unittest.TestCase):
import lib import lib
debug.info(1, "Testing timing for sample 2 bit, 16 words SRAM with 1 bank") debug.info(1, "Testing timing for sample 2 bit, 16 words SRAM with 1 bank")
total_size = 1024 s = sram.sram(word_size=2,
for word_size in [1,2,4,8,16,32,64]: num_words=OPTS.config.num_words,
num_words = total_size/word_size# OPTS.config.num_words num_banks=OPTS.config.num_banks,
s = sram.sram(word_size=word_size, name="sram_2_16_1_{0}".format(OPTS.tech_name))
num_words=num_words,
num_banks=OPTS.config.num_banks,
name="sram_2_16_1_{0}".format(OPTS.tech_name))
delay = s.analytical_model(0.1)
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
s.sp_write(tempspice) s.sp_write(tempspice)
filename = s.name + ".lib" filename = s.name + "_analytical.lib"
libname = OPTS.openram_temp + filename libname = OPTS.openram_temp + filename
use_model = True lib.lib(libname,s,tempspice,use_model=True)
lib.lib(libname,s,tempspice,use_model)
# let's diff the result with a golden model # let's diff the result with a golden model
golden = "{0}/golden/{1}".format(os.path.dirname(os.path.realpath(__file__)),filename) golden = "{0}/golden/{1}".format(os.path.dirname(os.path.realpath(__file__)),filename)
# Randomly decided 10% difference between spice simulators is ok. # Randomly decided 1% difference between spice simulators is ok.
if use_model != True: self.assertEqual(isapproxdiff(libname,golden,0.01),True)
self.assertEqual(isapproxdiff(libname,golden,0.10),True)
os.system("rm {0}".format(libname)) os.system("rm {0}".format(libname))

View File

@ -34,10 +34,7 @@ class lib_test(unittest.TestCase):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
s.sp_write(tempspice) s.sp_write(tempspice)
if OPTS.analytical_delay == True: filename = s.name + ".lib"
filename = s.name + "_analytical.lib"
else:
filename = s.name + ".lib"
libname = OPTS.openram_temp + filename libname = OPTS.openram_temp + filename
lib.lib(libname,s,tempspice) lib.lib(libname,s,tempspice)