From c1dcf941062f7c900d6cdb3a40205f3c77d949e4 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:22:05 +0530 Subject: Updated Ngspice 'make' commands for Windows OS --- src/maker/NgVeri.py | 94 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 29 deletions(-) diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py index 3a1cc845..c3c4d07c 100755 --- a/src/maker/NgVeri.py +++ b/src/maker/NgVeri.py @@ -32,6 +32,7 @@ from PyQt5 import QtCore, QtWidgets, QtGui from . import Maker from . import ModelGeneration import os +import shutil import subprocess from configuration.Appconfig import Appconfig from configparser import ConfigParser @@ -115,30 +116,53 @@ class NgVeri(QtWidgets.QWidget): return - model.verilogfile() - error = model.verilogParse() - if error != "Error": - model.getPortInfo() - model.cfuncmod() - model.ifspecwrite() - model.sim_main_header() - model.sim_main() - model.modpathlst() - model.run_verilator() - model.make_verilator() - model.copy_verilator() - model.runMake() - model.runMakeInstall() - txt = self.entry_var[0].toPlainText() - if "error" not in txt.lower(): - self.entry_var[0].append(''' -

- Model Created Successfully ! -

- ''') - else: - self.entry_var[0].append(''' -

+ try: + model.verilogfile() + error = model.verilogParse() + if error != "Error": + model.getPortInfo() + model.cfuncmod() + model.ifspecwrite() + model.sim_main_header() + model.sim_main() + model.modpathlst() + model.run_verilator() + model.make_verilator() + model.copy_verilator() + model.runMake() + + if os.name != 'nt': + model.runMakeInstall() + else: + try: + shutil.copy( + self.release_dir + "/src/xspice/icm/Ngveri/Ngveri.cm", + self.nghdl_home + "/lib/ngspice/" + ) + except FileNotFoundError as err: + self.entry_var[0].append( + "Error in copying Ngveri code model: " + str(err) + ) + + terminalLog = self.entry_var[0].toPlainText() + if "error" not in terminalLog.lower(): + self.entry_var[0].append(''' +

+ Model Created Successfully! +

+ ''') + + return + + except BaseException as err: + self.entry_var[0].append( + "Error in Ngspice code model generation from Verilog: " + str(err) + ) + + terminalLog = self.entry_var[0].toPlainText() + if "error" in terminalLog.lower(): + self.entry_var[0].append(''' +

There was an error during model creation,
Please rectify the error and try again ! @@ -256,12 +280,24 @@ class NgVeri(QtWidgets.QWidget): self.fname = Maker.verilogFile[self.filecount] model = ModelGeneration.ModelGeneration( self.fname, self.entry_var[0]) - model.runMake() - model.runMakeInstall() - return - # else: - # return + try: + model.runMake() + + if os.name != 'nt': + model.runMakeInstall() + else: + shutil.copy( + self.release_dir + "/src/xspice/icm/Ngveri/Ngveri.cm", + self.nghdl_home + "/lib/ngspice/" + ) + except BaseException as err: + QtWidgets.QMessageBox.critical( + None, "Error Message", + "The verilog model '" + str(text) + + "' could not be removed: " + str(err), + QtWidgets.QMessageBox.Ok) + # This is to remove lint_off comments needed by the verilator warnings # This function writes to the lint_off.txt here in the same folder -- cgit