diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/createKicadLibrary.py | 10 | ||||
-rw-r--r-- | src/model_generation.py | 22 | ||||
-rwxr-xr-x | src/ngspice_ghdl.py | 13 | ||||
-rw-r--r-- | src/outitf.c | 12 |
4 files changed, 37 insertions, 20 deletions
diff --git a/src/createKicadLibrary.py b/src/createKicadLibrary.py index e98d0d0..eed8f6d 100644 --- a/src/createKicadLibrary.py +++ b/src/createKicadLibrary.py @@ -36,8 +36,8 @@ class AutoSchematic(QtWidgets.QWidget): elif (xmlFound == os.path.join(self.xml_loc, 'Nghdl')):
print('Library already exists...')
ret = QtWidgets.QMessageBox.warning(
- self.parent, "Warning", '''<b>Library files for this model ''' +
- '''already exist. Do you want to overwrite it?</b><br/>
+ self.parent, "Warning", '''<b>Library files for this model''' +
+ ''' already exist. Do you want to overwrite it?</b><br/>
If yes press ok, else cancel it and ''' +
'''change the name of your vhdl file.''',
QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel
@@ -54,9 +54,9 @@ class AutoSchematic(QtWidgets.QWidget): else:
print('Pre existing library...')
ret = QtWidgets.QMessageBox.critical(
- self.parent, "Error", '''<b>A standard library already exists ''' +
- '''with this name.</b><br/><b>Please change the name ''' +
- '''of your vhdl file and upload it again</b>''',
+ self.parent, "Error", '''<b>A standard library already ''' +
+ '''exists with this name.</b><br/><b>Please change the ''' +
+ '''name of your vhdl file and upload it again</b>''',
QtWidgets.QMessageBox.Ok
)
diff --git a/src/model_generation.py b/src/model_generation.py index f19a5c9..bd96bc2 100644 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -282,13 +282,14 @@ class ModelGeneration: int ip_count = 0; char* my_ip = malloc(16); - char ip_filename[40]; + char ip_filename[100]; ''' if os.name == 'nt': client_setup_ip += ''' - sprintf(ip_filename, ''' \ - '''"C:/Windows/Temp/NGHDL_COMMON_IP_%d.txt", getpid()); + sprintf(ip_filename, "''' + \ + os.getenv('LOCALAPPDATA').replace('\\', '/') + \ + '''/Temp/NGHDL_COMMON_IP_%d.txt", getpid()); ''' else: client_setup_ip += ''' @@ -554,15 +555,18 @@ class ModelGeneration: if os.name == 'nt': self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME') - cmd_str2 = "\\'start_server.sh %d %s\\'" + "\\" + "\"" + cmd_str2 = "/start_server.sh %d %s & read" + "\\" + "\"" + "\"" cmd_str1 = os.path.normpath( - "\"cd " + self.digital_home + "/" + - self.fname.split('.')[0] + "/DUTghdl/ && " + - self.msys_home + "/bash.exe -c " + "\"" + self.digital_home + "/" + + self.fname.split('.')[0] + "/DUTghdl/" ) cmd_str1 = cmd_str1.replace("\\", "/") - cfunc.write('\t\tsnprintf(command,1024, "start /min cmd /c ' + - '\\' + cmd_str1 + cmd_str2 + ' &", sock_port, my_ip);') + + cfunc.write( + '\t\tsnprintf(command,1024, "start mintty.exe -t ' + + '\\"VHDL-Testbench Logs\\" -h always bash.exe -c ' + + '\\' + cmd_str1 + cmd_str2 + ', sock_port, my_ip);' + ) else: cfunc.write( '\t\tsnprintf(command,1024,"' + self.home + diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index fd17d7f..4db8062 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -271,6 +271,12 @@ class Mainwindow(QtWidgets.QWidget): self.process = QtCore.QProcess(self) self.process.start(cmd) print("make command process pid ---------- >", self.process.pid()) + + if os.name == "nt": + self.process.finished.connect(self.createSchematicLib) + self.process \ + .readyReadStandardOutput.connect(self.readAllStandard) + except BaseException: print("There is error in 'make' ") sys.exit() @@ -301,6 +307,10 @@ class Mainwindow(QtWidgets.QWidget): sys.exit() def createSchematicLib(self): + if os.name == "nt": + shutil.copy("ghdl/ghdl.cm", "../../../../lib/ngspice/") + + os.chdir(self.cur_dir) if Appconfig.esimFlag == 1: if not self.errorFlag: print('Creating library files................................') @@ -337,7 +347,8 @@ class Mainwindow(QtWidgets.QWidget): self.addingModelInModpath() self.createModelFiles() self.runMake() - self.runMakeInstall() + if os.name != 'nt': + self.runMakeInstall() else: QtWidgets.QMessageBox.information( self, 'Message', '''<b>Important Message.</b><br/>''' + diff --git a/src/outitf.c b/src/outitf.c index 1ac92ab..3ccf209 100644 --- a/src/outitf.c +++ b/src/outitf.c @@ -55,12 +55,12 @@ Modified: 2000 AlansFixes, 2013/2015 patch by Krzysztof Blaszkowski #include <stdlib.h> #include <string.h> #include <errno.h> +#include <unistd.h> /* 27.May.2020 - BM - Added the following #include */ #ifdef __linux__ #include <sys/socket.h> #include <arpa/inet.h> - #include <unistd.h> #endif extern char *spice_analysis_get_name(int index); @@ -128,15 +128,17 @@ static bool savenone = FALSE; static void close_server() { FILE *fptr; - char ip_filename[48]; + char ip_filename[100]; #ifdef __linux__ sprintf(ip_filename, "/tmp/NGHDL_COMMON_IP_%d.txt", getpid()); #elif _WIN32 WSADATA WSAData; - SOCKADDR_IN addr; - WSAStartup(MAKEWORD(2, 2), &WSAData); - sprintf(ip_filename, "C:\\Windows\\Temp\\NGHDL_COMMON_IP_%d.txt", getpid()); + SOCKADDR_IN addr; + WSAStartup(MAKEWORD(2, 2), &WSAData); + char *base_path = getenv("LocalAppData"); + sprintf(ip_filename, "\\Temp\\NGHDL_COMMON_IP_%d.txt", getpid()); + sprintf(ip_filename, strcat(base_path, ip_filename)); #endif fptr = fopen(ip_filename, "r"); |