From 1e5623110a735b75e6019ce9dc956704df9ded97 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Mon, 14 Dec 2020 20:29:55 +0530 Subject: removed 'make install' process for win os --- src/ngspice_ghdl.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index fd17d7f..7fc8c93 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -271,6 +271,11 @@ 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 +306,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 +346,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', '''Important Message.
''' + -- cgit From 0029b5d209d0187f29ba774ab3ef0f3ff04a3215 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Mon, 14 Dec 2020 20:33:34 +0530 Subject: changed temp location and updated server start command for win os --- src/model_generation.py | 21 ++++++++++++--------- src/outitf.c | 12 +++++++----- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/model_generation.py b/src/model_generation.py index f19a5c9..5b7ed5f 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,17 @@ 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/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 #include #include +#include /* 27.May.2020 - BM - Added the following #include */ #ifdef __linux__ #include #include - #include #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"); -- cgit From af4fe5b34e291cfe3bb1dadb967a8a049bf9ee64 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Wed, 16 Dec 2020 00:44:00 +0530 Subject: flake8 compliant --- src/createKicadLibrary.py | 10 +++++----- src/model_generation.py | 5 +++-- src/ngspice_ghdl.py | 3 ++- 3 files changed, 10 insertions(+), 8 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", '''Library files for this model ''' + - '''already exist. Do you want to overwrite it?
+ self.parent, "Warning", '''Library files for this model''' + + ''' already exist. Do you want to overwrite it?
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", '''A standard library already exists ''' + - '''with this name.
Please change the name ''' + - '''of your vhdl file and upload it again''', + self.parent, "Error", '''A standard library already ''' + + '''exists with this name.
Please change the ''' + + '''name of your vhdl file and upload it again''', QtWidgets.QMessageBox.Ok ) diff --git a/src/model_generation.py b/src/model_generation.py index 5b7ed5f..bd96bc2 100644 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -563,8 +563,9 @@ class ModelGeneration: cmd_str1 = cmd_str1.replace("\\", "/") 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);' + '\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( diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index 7fc8c93..4db8062 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -274,7 +274,8 @@ class Mainwindow(QtWidgets.QWidget): if os.name == "nt": self.process.finished.connect(self.createSchematicLib) - self.process.readyReadStandardOutput.connect(self.readAllStandard) + self.process \ + .readyReadStandardOutput.connect(self.readAllStandard) except BaseException: print("There is error in 'make' ") -- cgit From 6536595225331febcb60422a8b8d2dde1520c982 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Fri, 8 Jan 2021 00:46:16 +0530 Subject: update readme --- CONTRIBUTION.md | 25 +++++++++++++++++++++++++ README.md | 19 +++++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 CONTRIBUTION.md diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md new file mode 100644 index 0000000..dec42e8 --- /dev/null +++ b/CONTRIBUTION.md @@ -0,0 +1,25 @@ +## Contribution + +If you want to add any enhancement feature or have found any bug and want to work on it, please open a new issue regarding that and put a message "I would like to work on it." And make sure every pull request should reference to an issue. + +#### Points on how to make pull request +* You need to fork this repository to your account. + +* Clone it using ``` git clone https://github.com/FOSSEE/nghdl.git ``` + +* Always create a new branch before making any changes. You can create new branch using ```git branch ``` + +* Checkout into your new branch using ```git checkout ``` + +* Make changes to code and once you are done use ```git add ```. Now commit changes with proper message using ```git commit -m "Your message"```. + +* After commiting your changes push your changes to your forked repository using ```git push origin ``` +Finally create a pull request from github. +There should be only one commit per pull request. + + +* Please follow below guidelines for your commit message : + * Commit message should be like : Fixes issue #[issue_number] - one line message of work you did. + * After commit message, there should be a commit body where you can mention what you did in short or in detail. + +Please follow above method to file pull requests. diff --git a/README.md b/README.md index 8e7ef7d..d9cb62d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/fossee/nghdl?color=blueviolet) +![Python](https://img.shields.io/badge/python-v3.6+-blue.svg) +[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/) +[![GitHub forks](https://img.shields.io/github/forks/fossee/nghdl)](https://github.com/fossee/nghdl/network) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://github.com/fossee/nghdl) +![GitHub contributors](https://img.shields.io/github/contributors/fossee/nghdl) + + Ngspice Ghdl Interfacing Documentation ==== @@ -5,7 +13,7 @@ It contains all the documentation for Ngspice and GHDL related work. ## How is Ngspice interfaced with GHDL? -Ngspice supports mixed mode simulation. It can simulate both digital and analog components. +Ngspice supports mixed-signal simulation. It can simulate both digital and analog components. Ngspice has something called code-model which defines the behavior of your component and can be used in the netlist. For example you can create a full-adder's code-model in Ngspice and use it in any circuit netlist of Ngspice. @@ -20,7 +28,7 @@ GHDL's foreign language interface is used for this inter-process communication. * Ubuntu 16.04 OS and above LTS versions. * Microsoft Windows 7, 8 and 10. -> Note: Refer [`installers`](https://github.com/fossee/nghdl/tree/installers) branch for documentation on packaging for above mentioned platforms. + > Note for other distributions: You can refer [`installers`](https://github.com/fossee/nghdl/tree/installers) branch for documentation on packaging (for above mentioned distributions) to build installers for your operating system in a similar way. For providing your build, please check the `Contribution` section mentioned below. ## Features @@ -30,8 +38,8 @@ GHDL's foreign language interface is used for this inter-process communication. ## Pre-requisites -* GHDL (LLVM)-v0.37 -* Ngspice-v31 +* [GHDL (LLVM - v0.37)](http://ghdl.free.fr/) +* [Ngspice (v31+)](http://ngspice.sourceforge.net/) ## How to install? @@ -46,3 +54,6 @@ Refer https://esim.fossee.in/ for more information. 4. Open the desired example under `eSim/Examples/Mixed_Signal/` using the "Open Project" button, double click on the project when the project is loaded in the "Projects" window. 5. Click on the "Simulation" button on eSim Main window. + +## Contribution +Please refer [here](https://github.com/FOSSEE/nghdl/blob/master/CONTRIBUTION.md) for further details. -- cgit