Exit with error when spice models not found. Use ngspice if no simulator defined.

This commit is contained in:
mrg 2021-06-21 13:14:08 -07:00
parent af31027504
commit d53bc98ff5
1 changed files with 8 additions and 6 deletions

View File

@ -301,16 +301,20 @@ class stimuli():
for item in self.device_libraries: for item in self.device_libraries:
if OPTS.spice_name: if OPTS.spice_name:
item[0] = item[0].replace("SIMULATOR", OPTS.spice_name.lower()) item[0] = item[0].replace("SIMULATOR", OPTS.spice_name.lower())
else:
item[0] = item[0].replace("SIMULATOR", "ngspice")
if os.path.isfile(item[0]): if os.path.isfile(item[0]):
self.sf.write(".lib \"{0}\" {1}\n".format(item[0], item[1])) self.sf.write(".lib \"{0}\" {1}\n".format(item[0], item[1]))
else: else:
debug.error("Could not find spice library: {0}\nSet SPICE_MODEL_DIR to over-ride path.\n".format(item[0])) debug.error("Could not find spice library: {0}\nSet SPICE_MODEL_DIR to over-ride path.\n".format(item[0]), -1)
includes = self.device_models + [circuit] includes = self.device_models + [circuit]
for item in list(includes): for item in list(includes):
if OPTS.spice_name: if OPTS.spice_name:
item = item.replace("SIMULATOR", OPTS.spice_name.lower()) item = item.replace("SIMULATOR", OPTS.spice_name.lower())
else:
item = item.replace("SIMULATOR", "ngspice")
self.sf.write(".include \"{0}\"\n".format(item)) self.sf.write(".include \"{0}\"\n".format(item))
def add_comment(self, msg): def add_comment(self, msg):
@ -407,5 +411,3 @@ class stimuli():
end_time = datetime.datetime.now() end_time = datetime.datetime.now()
delta_time = round((end_time - start_time).total_seconds(), 1) delta_time = round((end_time - start_time).total_seconds(), 1)
debug.info(2, "*** Spice: {} seconds".format(delta_time)) debug.info(2, "*** Spice: {} seconds".format(delta_time))