diff options
-rwxr-xr-x | src/createKicadLibrary.py | 8 | ||||
-rwxr-xr-x | src/model_generation.py | 18 | ||||
-rwxr-xr-x | src/ngspice_ghdl.py | 27 |
3 files changed, 29 insertions, 24 deletions
diff --git a/src/createKicadLibrary.py b/src/createKicadLibrary.py index 174668c..c78d41e 100755 --- a/src/createKicadLibrary.py +++ b/src/createKicadLibrary.py @@ -16,7 +16,7 @@ class AutoSchematic(QtWidgets.QWidget): self.lib_loc = Appconfig.lib_loc
if os.name == 'nt':
eSim_src = Appconfig.src_home
- inst_dir = eSim_src.replace('\eSim', '')
+ inst_dir = eSim_src.replace('\\eSim', '')
self.kicad_nghdl_lib = \
inst_dir + '/KiCad/share/kicad/library/eSim_Nghdl.lib'
else:
@@ -245,12 +245,14 @@ class AutoSchematic(QtWidgets.QWidget): class PortInfo:
def __init__(self, model):
self.modelname = model.modelname
- self.model_loc = model.parser.get('NGSPICE', 'DIGITAL_MODEL')
+ self.model_loc = os.path.join(
+ model.parser.get('NGHDL', 'DIGITAL_MODEL'), 'ghdl'
+ )
self.bit_list = []
self.input_len = 0
def getPortInfo(self):
- info_loc = os.path.join(self.model_loc, self.modelname+'/DUTghdl/')
+ info_loc = os.path.join(self.model_loc, self.modelname + '/DUTghdl/')
input_list = []
output_list = []
read_file = open(info_loc + 'connection_info.txt', 'r')
diff --git a/src/model_generation.py b/src/model_generation.py index 2e4d54c..69f378e 100755 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -20,8 +20,8 @@ class ModelGeneration: self.parser = ConfigParser() self.parser.read(os.path.join( self.home, os.path.join('.nghdl', 'config.ini'))) - self.ngspice_home = self.parser.get('NGSPICE', 'NGSPICE_HOME') - self.release_dir = self.parser.get('NGSPICE', 'RELEASE') + self.nghdl_home = self.parser.get('NGHDL', 'NGHDL_HOME') + self.release_dir = self.parser.get('NGHDL', 'RELEASE') self.src_home = self.parser.get('SRC', 'SRC_HOME') self.licensefile = self.parser.get('SRC', 'LICENSE') @@ -564,8 +564,9 @@ class ModelGeneration: cfunc.write("\t\tchar command[1024];\n") if os.name == 'nt': - self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') - self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME') + self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL') + self.digital_home = os.path.join(self.digital_home, "ghdl") + cmd_str2 = "/start_server.sh %d %s & read" + "\\" + "\"" + "\"" cmd_str1 = os.path.normpath( "\"" + self.digital_home + "/" + @@ -581,7 +582,7 @@ class ModelGeneration: else: cfunc.write( '\t\tsnprintf(command,1024,"' + self.home + - '/ngspice-nghdl/src/xspice/icm/ghdl/' + + '/nghdl-simulator/src/xspice/icm/ghdl/' + self.fname.split('.')[0] + '/DUTghdl/start_server.sh %d %s &", sock_port, my_ip);' ) @@ -1059,14 +1060,15 @@ class ModelGeneration: def createServerScript(self): # ####### Creating and writing components in start_server.sh ####### # - self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') + self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL') + self.digital_home = os.path.join(self.digital_home, "ghdl") start_server = open('start_server.sh', 'w') start_server.write("#!/bin/bash\n\n") start_server.write( - "###This server run ghdl testebench for infinite time till " + - "ngspice send END signal to stop it\n\n" + "###This server run ghdl testbench for infinite time till " + + "Ngspice sends kill signal to stop it\n\n" ) if os.name == 'nt': diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index 97f1d06..6bc13ce 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -30,8 +30,8 @@ class Mainwindow(QtWidgets.QWidget): self.parser.read( os.path.join(self.home, os.path.join('.nghdl', 'config.ini')) ) - self.ngspice_home = self.parser.get('NGSPICE', 'NGSPICE_HOME') - self.release_dir = self.parser.get('NGSPICE', 'RELEASE') + self.nghdl_home = self.parser.get('NGHDL', 'NGHDL_HOME') + self.release_dir = self.parser.get('NGHDL', 'RELEASE') self.src_home = self.parser.get('SRC', 'SRC_HOME') self.licensefile = self.parser.get('SRC', 'LICENSE') # Printing LICENCE file on terminal @@ -78,7 +78,7 @@ class Mainwindow(QtWidgets.QWidget): self.setLayout(grid) self.setGeometry(300, 300, 600, 600) - self.setWindowTitle("Ngspice Digital Model Creator") + self.setWindowTitle("Ngspice Digital Model Creator (from VHDL)") # self.setWindowIcon(QtGui.QIcon('logo.png')) self.show() @@ -125,7 +125,8 @@ class Mainwindow(QtWidgets.QWidget): def createModelDirectory(self): print("Create Model Directory Called") - self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') + self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL') + self.digital_home = os.path.join(self.digital_home, "ghdl") os.chdir(self.digital_home) print("Current Working Directory Changed to", os.getcwd()) self.modelname = os.path.basename(str(self.filename)).split('.')[0] @@ -230,12 +231,12 @@ class Mainwindow(QtWidgets.QWidget): os.chdir(path + "/DUTghdl") if os.name == 'nt': # path to msys bin directory where bash is located - self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME') - subprocess.call(self.msys_bin+"/bash.exe " + + self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME') + subprocess.call(self.msys_home + "/usr/bin/bash.exe " + path + "/DUTghdl/compile.sh", shell=True) - subprocess.call(self.msys_bin+"/bash.exe -c " + + subprocess.call(self.msys_home + "/usr/bin/bash.exe -c " + "'chmod a+x start_server.sh'", shell=True) - subprocess.call(self.msys_bin+"/bash.exe -c " + + subprocess.call(self.msys_home + "/usr/bin/bash.exe -c " + "'chmod a+x sock_pkg_create.sh'", shell=True) else: subprocess.call("bash " + path + "/DUTghdl/compile.sh", shell=True) @@ -258,15 +259,15 @@ class Mainwindow(QtWidgets.QWidget): def runMake(self): print("run Make Called") - self.release_home = self.parser.get('NGSPICE', 'RELEASE') + self.release_home = self.parser.get('NGHDL', 'RELEASE') path_icm = os.path.join(self.release_home, "src/xspice/icm") os.chdir(path_icm) try: if os.name == 'nt': # path to msys bin directory where make is located - self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME') - cmd = self.msys_bin+"\\make.exe" + self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME') + cmd = self.msys_home + "/mingw64/bin/mingw32-make.exe" else: cmd = " make" @@ -289,8 +290,8 @@ class Mainwindow(QtWidgets.QWidget): print("run Make Install Called") try: if os.name == 'nt': - self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME') - cmd = self.msys_bin+"\\make.exe install" + self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME') + cmd = self.msys_home + "/mingw64/bin/mingw32-make.exe install" else: cmd = " make install" print("Running Make Install") |