mirror of https://github.com/VLSIDA/OpenRAM.git
Add customsim (xa) as optional simulator. Fix regex to support scientific notation. Go through list of preferred simulators in order. Always abort if command-line simulator not found.
This commit is contained in:
parent
054e4d3c28
commit
8071dcc0f3
|
|
@ -13,8 +13,10 @@ def relative_compare(value1,value2,error_tolerance=0.001):
|
|||
def parse_output(filename, key):
|
||||
"""Parses a hspice output.lis file for a key value"""
|
||||
if OPTS.spice_version == "xa" :
|
||||
# customsim has a different output file name
|
||||
full_filename="{0}xa.meas".format(OPTS.openram_temp)
|
||||
else :
|
||||
else:
|
||||
# ngspice/hspice using a .lis file
|
||||
full_filename="{0}{1}.lis".format(OPTS.openram_temp, filename)
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -279,13 +279,15 @@ def run_sim():
|
|||
|
||||
|
||||
if OPTS.spice_version == "xa":
|
||||
cmd = "{0} {1} -o {2}xa -mt 20".format(OPTS.spice_exe,temp_stim,OPTS.openram_temp)
|
||||
cmd = "{0} {1} -o {2}xa -mt 20".format(OPTS.spice_exe,
|
||||
temp_stim,
|
||||
OPTS.openram_temp)
|
||||
valid_retcode=0
|
||||
elif OPTS.spice_version == "hspice":
|
||||
# TODO: Should make multithreading parameter a configuration option
|
||||
cmd = "{0} -mt 2 -i {1} -o {2}timing".format(OPTS.spice_exe,
|
||||
temp_stim,
|
||||
OPTS.openram_temp)
|
||||
temp_stim,
|
||||
OPTS.openram_temp)
|
||||
valid_retcode=0
|
||||
else:
|
||||
cmd = "{0} -b -o {2}timing.lis {1}".format(OPTS.spice_exe,
|
||||
|
|
|
|||
|
|
@ -234,6 +234,16 @@ def setup_paths():
|
|||
|
||||
|
||||
|
||||
def find_spice(spice_exe):
|
||||
# Check if the preferred spice option exists in the path
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
spice_exe = os.path.join(path, OPTS.spice_version)
|
||||
# if it is found, then break and use first version
|
||||
if is_exe(spice_exe):
|
||||
debug.info(1, "Using spice: " + spice_exe)
|
||||
OPTS.spice_exe = spice_exe
|
||||
return True
|
||||
return False
|
||||
|
||||
def set_spice():
|
||||
debug.info(2,"Finding spice...")
|
||||
|
|
@ -247,46 +257,25 @@ def set_spice():
|
|||
|
||||
OPTS.spice_exe = ""
|
||||
|
||||
# Check if the preferred spice option exists in the path
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
spice_exe = os.path.join(path, OPTS.spice_version)
|
||||
# if it is found, then break and use first version
|
||||
if is_exe(spice_exe):
|
||||
debug.info(1, "Using spice: " + spice_exe)
|
||||
OPTS.spice_exe = spice_exe
|
||||
break
|
||||
|
||||
if not OPTS.force_spice and OPTS.spice_exe == "":
|
||||
# if we didn't find the preferred version, try the other version and warn
|
||||
prev_version=OPTS.spice_version
|
||||
if OPTS.spice_version == "hspice":
|
||||
OPTS.spice_version = "ngspice"
|
||||
else:
|
||||
OPTS.spice_version = "hspice"
|
||||
debug.warning("Unable to find {0} so trying {1}".format(prev_version,OPTS.spice_version))
|
||||
spice_preferences = ["xa", "hspice", "ngspice", "ngspice.exe"]
|
||||
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
spice_exe = os.path.join(path, OPTS.spice_version)
|
||||
# if it is found, then break and use first version
|
||||
if is_exe(spice_exe):
|
||||
found_spice = True
|
||||
debug.info(1, "Using spice: " + spice_exe)
|
||||
OPTS.spice_exe = spice_exe
|
||||
if OPTS.spice_version != "":
|
||||
if not find_spice(OPTS.spice_version):
|
||||
debug.error("{0} not found. Unable to perform characterization.".format(OPTS.spice_version),1)
|
||||
else:
|
||||
for spice_exe in spice_preferences:
|
||||
if find_spice(spice_exe):
|
||||
break
|
||||
else:
|
||||
debug.warning("Unable to find spice {0}, trying another.".format(spice_exe))
|
||||
|
||||
# set the input dir for spice files if using ngspice
|
||||
if OPTS.spice_version == "ngspice":
|
||||
os.environ["NGSPICE_INPUT_DIR"] = "{0}".format(OPTS.openram_temp)
|
||||
|
||||
if OPTS.spice_exe == "":
|
||||
# otherwise, give warning and procede
|
||||
if OPTS.force_spice:
|
||||
debug.error("{0} not found. Unable to perform characterization.".format(OPTS.spice_version),1)
|
||||
else:
|
||||
debug.error("Neither hspice/ngspice not found. Unable to perform characterization.",1)
|
||||
debug.error("No recognizable spice version found. Unable to perform characterization.",1)
|
||||
|
||||
if OPTS.analytical_delay:
|
||||
debug.warning("Using analytical delay models instead of characterization.")
|
||||
|
||||
|
||||
# imports correct technology directories for testing
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ class options(optparse.Values):
|
|||
check_lvsdrc = True
|
||||
# Variable to select the variant of spice (hspice or ngspice right now)
|
||||
spice_version = "hspice"
|
||||
# Should we fall back if we can't find our preferred spice?
|
||||
force_spice = False
|
||||
# Should we print out the banner at startup
|
||||
print_banner = True
|
||||
# The Calibre executable being used which is derived from the user PATH.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ class timing_sram_test(unittest.TestCase):
|
|||
# we will manually run lvs/drc
|
||||
OPTS.check_lvsdrc = False
|
||||
OPTS.spice_version="hspice"
|
||||
OPTS.force_spice = True
|
||||
OPTS.analytical_delay = False
|
||||
globals.set_spice()
|
||||
|
||||
|
|
@ -88,7 +87,6 @@ class timing_sram_test(unittest.TestCase):
|
|||
# reset these options
|
||||
OPTS.check_lvsdrc = True
|
||||
OPTS.spice_version="hspice"
|
||||
OPTS.force_spice = False
|
||||
OPTS.analytical_delay = True
|
||||
globals.set_spice()
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class timing_setup_test(unittest.TestCase):
|
|||
# we will manually run lvs/drc
|
||||
OPTS.check_lvsdrc = False
|
||||
OPTS.spice_version="hspice"
|
||||
OPTS.force_spice = True
|
||||
globals.set_spice()
|
||||
|
||||
import sram
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class timing_sram_test(unittest.TestCase):
|
|||
# we will manually run lvs/drc
|
||||
OPTS.check_lvsdrc = False
|
||||
OPTS.spice_version="ngspice"
|
||||
OPTS.force_spice = True
|
||||
OPTS.analytical_delay = False
|
||||
globals.set_spice()
|
||||
|
||||
|
|
@ -84,7 +83,6 @@ class timing_sram_test(unittest.TestCase):
|
|||
# reset these options
|
||||
OPTS.check_lvsdrc = True
|
||||
OPTS.spice_version="hspice"
|
||||
OPTS.force_spice = False
|
||||
OPTS.analytical_delay = True
|
||||
globals.set_spice()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ class timing_setup_test(unittest.TestCase):
|
|||
# we will manually run lvs/drc
|
||||
OPTS.check_lvsdrc = False
|
||||
OPTS.spice_version="ngspice"
|
||||
OPTS.force_spice = True
|
||||
globals.set_spice()
|
||||
|
||||
import sram
|
||||
|
|
@ -61,7 +60,6 @@ class timing_setup_test(unittest.TestCase):
|
|||
# reset these options
|
||||
OPTS.check_lvsdrc = True
|
||||
OPTS.spice_version="hspice"
|
||||
OPTS.force_spice = False
|
||||
globals.set_spice()
|
||||
globals.end_openram()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue