diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/configuration/Appconfig.py | 14 | ||||
-rwxr-xr-x | src/frontEnd/Application.py | 9 | ||||
-rwxr-xr-x | src/frontEnd/Workspace.py | 10 | ||||
-rwxr-xr-x | src/maker/Appconfig.py | 6 | ||||
-rwxr-xr-x | src/maker/Maker.py | 2 | ||||
-rwxr-xr-x | src/maker/ModelGeneration.py | 42 | ||||
-rwxr-xr-x | src/maker/NgVeri.py | 18 | ||||
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 7 |
8 files changed, 66 insertions, 42 deletions
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 21fd717e..e41fc218 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -34,9 +34,14 @@ class Appconfig(QtWidgets.QWidget): """ # Home directory + if os.name == 'nt': + user_home = os.path.join('library', 'config') + else: + user_home = os.path.expanduser('~') + try: file = open(os.path.join( - os.path.expanduser("~"), ".esim/workspace.txt"), 'r' + user_home, ".esim/workspace.txt"), 'r' ) workspace_check, home = file.readline().split(' ', 1) file.close() @@ -65,11 +70,8 @@ class Appconfig(QtWidgets.QWidget): parser_esim = ConfigParser() parser_esim.read( - os.path.join( - os.path.expanduser("~"), - os.path.join( - '.esim', - 'config.ini'))) + os.path.join(user_home, '.esim', 'config.ini') + ) # Try catch added, since eSim cannot be accessed under parser for Win10 try: diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index ba971006..b852a941 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -926,9 +926,12 @@ def main(args): appView.obj_workspace.returnWhetherClickedOrNot(appView) try: - file = open(os.path.join( - os.path.expanduser("~"), ".esim/workspace.txt"), 'r' - ) + if os.name == 'nt': + user_home = os.path.join('library', 'config') + else: + user_home = os.path.expanduser('~') + + file = open(os.path.join(user_home, ".esim/workspace.txt"), 'r') work = int(file.read(1)) file.close() except IOError: diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 4d033539..fca73e39 100755 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -124,9 +124,13 @@ class Workspace(QtWidgets.QWidget): self.obj_appconfig.workspace_check = self.chkbox.checkState() print(self.workspace_loc.text()) - file = open(os.path.join( - os.path.expanduser("~"), ".esim/workspace.txt"), 'w' - ) + + if os.name == 'nt': + user_home = os.path.join('library', 'config') + else: + user_home = os.path.expanduser('~') + + file = open(os.path.join(user_home, ".esim/workspace.txt"), 'w') file.writelines( str(self.obj_appconfig.workspace_check) + " " + self.workspace_loc.text() diff --git a/src/maker/Appconfig.py b/src/maker/Appconfig.py index 45d28e62..06758898 100755 --- a/src/maker/Appconfig.py +++ b/src/maker/Appconfig.py @@ -3,7 +3,11 @@ from configparser import ConfigParser class Appconfig: - home = os.path.expanduser("~") + if os.name == 'nt': + home = os.path.join('library', 'config') + else: + home = os.path.expanduser('~') + # Reading all variables from eSim config.ini parser_esim = ConfigParser() parser_esim.read(os.path.join(home, os.path.join('.esim', 'config.ini'))) diff --git a/src/maker/Maker.py b/src/maker/Maker.py index 78fd13b2..60087018 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -82,7 +82,7 @@ class Maker(QtWidgets.QWidget): # This function is to Add new verilog file def addverilog(self): - init_path = '../../../' + init_path = '../../' if os.name == 'nt': init_path = '' self.verilogfile = QtCore.QDir.toNativeSeparators( diff --git a/src/maker/ModelGeneration.py b/src/maker/ModelGeneration.py index 54b91d50..0f0f5c58 100755 --- a/src/maker/ModelGeneration.py +++ b/src/maker/ModelGeneration.py @@ -51,23 +51,31 @@ class ModelGeneration(QtWidgets.QWidget): super().__init__() self.obj_Appconfig = Appconfig.Appconfig() print("Argument is : ", file) - self.file = file + + if os.name == 'nt': + self.file = file.replace('\\', '/') + else: + self.file = file + self.termedit = termedit self.cur_dir = os.getcwd() self.fname = os.path.basename(file) self.fname = self.fname.lower() print("Verilog/SystemVerilog/TL Verilog filename is : ", self.fname) - self.home = os.path.expanduser("~") + + if os.name == 'nt': + self.home = os.path.join('library', 'config') + else: + self.home = os.path.expanduser('~') + 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') - self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') - - self.digital_home = self.digital_home.split("/ghdl")[0] + "/Ngveri" + self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL') + "/Ngveri" # # #### Creating connection_info.txt file from verilog file #### # # Readinf the file and performing operations and copying it in the Ngspice @@ -441,7 +449,7 @@ and set the load for input ports */ cfunc.write("\n") # if os.name == 'nt': - # digital_home = parser.get('NGSPICE', 'DIGITAL_MODEL') + # digital_home = parser.get('NGHDL', 'DIGITAL_MODEL') # msys_home = parser.get('COMPILER', 'MSYS_HOME') # cmd_str2 = "/start_server.sh %d %s & read" + "\\" + "\"" + "\"" # cmd_str1 = os.path.normpath( @@ -458,7 +466,7 @@ and set the load for input ports */ # else: # cfunc.write( # '\t\tsnprintf(command,1024,"' + home + - # '/ngspice-nghdl/src/xspice/icm/ghdl/' + + # '/nghdl-simulator/src/xspice/icm/ghdl/' + # fname.split('.')[0] + # '/DUTghdl/start_server.sh %d %s &", sock_port, my_ip);' # ) @@ -803,7 +811,7 @@ and set the load for input ports */ wno += " -Wno-" + item.strip("\n") print("Running Verilator.............") os.chdir(self.modelpath) - self.release_home = self.parser.get('NGSPICE', 'RELEASE') + self.release_home = self.parser.get('NGHDL', 'RELEASE') # print(self.modelpath) self.cmd = "verilator -Wall " + wno + "\ @@ -865,8 +873,8 @@ and set the load for input ports */ self.cur_dir = os.getcwd() print("Copying the required files to Release Folder.............") os.chdir(self.modelpath) - self.release_home = self.parser.get('NGSPICE', 'RELEASE') - path_icm = os.path.join(self.release_home, "src/xspice/icm/Ngveri/") + self.release_home = self.parser.get('NGHDL', 'RELEASE') + path_icm = self.release_home + "/src/xspice/icm/Ngveri/" if not os.path.isdir(path_icm + self.fname.split('.')[0]): os.mkdir(path_icm + self.fname.split('.')[0]) path_icm = path_icm + self.fname.split('.')[0] @@ -918,7 +926,7 @@ and set the load for input ports */ # Running the make command for Ngspice 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) @@ -953,7 +961,7 @@ and set the load for input ports */ def runMakeInstall(self): self.cur_dir = os.getcwd() print("run Make Install 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) @@ -994,7 +1002,7 @@ and set the load for input ports */ def addfile(self): print("Adding the files required by the top level module file") - init_path = '../../../' + init_path = '../../' if os.name == 'nt': init_path = '' includefile = QtCore.QDir.toNativeSeparators( @@ -1037,7 +1045,7 @@ and set the load for input ports */ # self.cur_dir = os.getcwd() print("Adding the folder required by the top level module file") - init_path = '../../../' + init_path = '../../' if os.name == 'nt': init_path = '' # noqa:F841 includefolder = QtCore.QDir.toNativeSeparators( @@ -1152,7 +1160,7 @@ and set the load for input ports */ # Text += "</span>" # self.termedit.append(Text+"\n") - # init_path = '../../../' + # init_path = '../../' # if os.name == 'nt': # init_path = '' # includefile = QtCore.QDir.toNativeSeparators(\ diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py index 4e3e37da..496782f9 100755 --- a/src/maker/NgVeri.py +++ b/src/maker/NgVeri.py @@ -46,16 +46,21 @@ class NgVeri(QtWidgets.QWidget): QtWidgets.QWidget.__init__(self) # Maker.addverilog(self) self.obj_Appconfig = Appconfig() - self.home = os.path.expanduser("~") + + if os.name == 'nt': + self.home = os.path.join('library', 'config') + else: + self.home = os.path.expanduser('~') + 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') - self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL') - self.digital_home = self.digital_home.split("/ghdl")[0] + "/Ngveri" + self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL') + self.digital_home = self.digital_home + "/Ngveri" self.count = 0 self.text = "" self.entry_var = {} @@ -77,8 +82,7 @@ class NgVeri(QtWidgets.QWidget): # Adding the verilog file in Maker tab to Ngveri Tab automatically def addverilog(self): - - init_path = '../../../' + init_path = '../../' if os.name == 'nt': init_path = '' # b=Maker.Maker(self) diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 6d64181d..3c68148b 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -23,11 +23,10 @@ class NgspiceWidget(QtWidgets.QWidget): print("Argument to ngspice command : ", command) if os.name == 'nt': # For Windows OS - home = os.path.expanduser("~") - parser_nghdl = ConfigParser() - parser_nghdl.read(os.path.join( - home, os.path.join('.nghdl', 'config.ini'))) + parser_nghdl.read( + os.path.join('library', 'config', '.nghdl', 'config.ini') + ) msys_home = parser_nghdl.get('COMPILER', 'MSYS_HOME') |