"
- self.termtitle("MAKE INSTALL COMMAND")
- self.termtext("Current Directory: " + path_icm)
- self.termtext("Command: " + self.cmd)
- self.process \
- .readyReadStandardOutput.connect(self.readAllStandard)
- self.process \
- .readyReadStandardError.connect(self.readAllStandard)
- self.process.waitForFinished(50000)
- os.chdir(self.cur_dir)
-
- except BaseException as e:
- print(e)
- print("There is error in 'make install' ")
- # sys.exit()
+ self.entry_var[0].append('''
+
+ There was an error during model creation,
+
+ Please rectify the error and try again !
+
+ ''')
# This function is used to add additional files required by the verilog
# top module
- def addfile(self):
- print("Adding the files required by the top level module file")
- init_path = '../../../'
- if os.name == 'nt':
- init_path = ''
- includefile = QtCore.QDir.toNativeSeparators(
- QtWidgets.QFileDialog.getOpenFileName(
- self,
- "Open adding other necessary files to be included",
- init_path + "home")[0])
- if includefile == "":
+ def addfile(self):
+ if len(Maker.verilogFile) < (self.filecount + 1):
reply = QtWidgets.QMessageBox.critical(
- None, "Error Message",
- "Error: No File Chosen. Please chose a file",
- QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
- )
+ None,
+ "Error Message",
+ "Error: No Verilog File Chosen. \
+ Please chose a Verilog file in Makerchip Tab",
+ QtWidgets.QMessageBox.Ok)
if reply == QtWidgets.QMessageBox.Ok:
- self.addfile()
- self.obj_Appconfig.print_info('Add Other Files Called')
-
- elif reply == QtWidgets.QMessageBox.Cancel:
- self.obj_Appconfig.print_info('No File Chosen')
- filename = os.path.basename(includefile)
- self.modelpath = self.digital_home + \
- "/" + self.fname.split('.')[0] + "/"
-
- if not os.path.isdir(self.modelpath):
- os.mkdir(self.modelpath)
- text = open(includefile).read()
- text = text + '\n'
- f = open(self.modelpath + filename, 'w')
- for item in text:
- f.write(item)
- f.write("\n")
- f.close()
- print("Added the File:" + filename)
- self.termtitle("Added the File:" + filename)
+ self.obj_Appconfig.print_error(
+ 'No VerilogFile. Please chose\
+ a Verilog File in Makerchip Tab')
+ return
+ self.fname = Maker.verilogFile[self.filecount]
+ model = ModelGeneration.ModelGeneration(self.fname, self.entry_var[0])
+ # model.verilogfile()
+ model.addfile()
# This function is used to add additional folder required by the verilog
# top module
-
def addfolder(self):
- # self.cur_dir = os.getcwd()
- print("Adding the folder required by the top level module file")
-
- init_path = '../../../'
- if os.name == 'nt':
- init_path = '' # noqa:F841
- includefolder = QtCore.QDir.toNativeSeparators(
- QtWidgets.QFileDialog.getExistingDirectory(
- self, "open", "home"
- )
- )
- if includefolder == "":
+ if len(Maker.verilogFile) < (self.filecount + 1):
reply = QtWidgets.QMessageBox.critical(
- None, "Error Message",
- "Error: No Folder Chosen. Please chose a folder",
- QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
- )
+ None,
+ "Error Message",
+ "Error: No Verilog File Chosen. \
+ Please chose a Verilog file in Makerchip Tab",
+ QtWidgets.QMessageBox.Ok)
if reply == QtWidgets.QMessageBox.Ok:
- self.addfolder()
- self.obj_Appconfig.print_info('Add Folder Called')
-
- elif reply == QtWidgets.QMessageBox.Cancel:
- self.obj_Appconfig.print_info('No File Chosen')
-
- self.modelpath = self.digital_home + \
- "/" + self.fname.split('.')[0] + "/"
-
- reply = QtWidgets.QMessageBox.question(
- None, "Message",
- '''If you want only the contents\
- of the folder to be added press "Yes".\
- If you want complete folder \
- to be added, press "No". ''',
- QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
+ self.obj_Appconfig.print_error(
+ 'No VerilogFile. Please chose \
+ a Verilog File in Makerchip Tab')
+ return
+ self.fname = Maker.verilogFile[self.filecount]
+ model = ModelGeneration.ModelGeneration(self.fname, self.entry_var[0])
+ # model.verilogfile()
+ model.addfolder()
+
+ # This function is used to clear the terminal
+
+ def clearTerminal(self):
+ self.entry_var[0].setText("")
+
+ # This function is used to create buttons/options
+ def createoptionsBox(self):
+
+ self.optionsbox = QtWidgets.QGroupBox()
+ self.optionsbox.setTitle("Select Options")
+ self.optionsgrid = QtWidgets.QGridLayout()
+
+ self.optionsgroupbtn = QtWidgets.QButtonGroup()
+
+ self.addverilogbutton = QtWidgets.QPushButton(
+ "Run Verilog to NgSpice Converter")
+ self.optionsgroupbtn.addButton(self.addverilogbutton)
+ self.addverilogbutton.clicked.connect(self.addverilog)
+ self.optionsgrid.addWidget(self.addverilogbutton, 0, 1)
+ #self.optionsbox.setLayout(self.optionsgrid)
+ #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+
+ self.addfilebutton = QtWidgets.QPushButton("Add Other file")
+ self.optionsgroupbtn.addButton(self.addfilebutton)
+ self.addfilebutton.clicked.connect(self.addfile)
+ self.optionsgrid.addWidget(self.addfilebutton, 0, 2)
+ #self.optionsbox.setLayout(self.optionsgrid)
+ #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+
+ self.addfolderbutton = QtWidgets.QPushButton("Add Folder")
+ self.optionsgroupbtn.addButton(self.addfolderbutton)
+ self.addfolderbutton.clicked.connect(self.addfolder)
+ self.optionsgrid.addWidget(self.addfolderbutton, 0, 3)
+ #self.optionsbox.setLayout(self.optionsgrid)
+ #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+
+ self.clearTerminalBtn = QtWidgets.QPushButton("Clear Terminal")
+ self.optionsgroupbtn.addButton(self.clearTerminalBtn)
+ self.clearTerminalBtn.clicked.connect(self.clearTerminal)
+ self.optionsgrid.addWidget(self.clearTerminalBtn, 0, 4)
+ self.optionsbox.setLayout(self.optionsgrid)
+ #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+
+ return self.optionsbox
+
+ # This function is used to remove models in modlst of Ngspice folder if
+ # the user wants to remove a model.Note: files do not get removed
+ def edit_modlst(self, text):
+ if text == "Edit modlst":
+ return
+ index = self.entry_var[1].findText(text)
+ self.entry_var[1].removeItem(index)
+ self.entry_var[1].setCurrentIndex(0)
+ ret = QtWidgets.QMessageBox.warning(
+ None, "Warning", '''Do you want to remove model:''' +
+ text,
+ QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel
)
- if reply == QtWidgets.QMessageBox.Yes:
- self.cmd = "cp -a " + includefolder + "/. " + self.modelpath
- self.obj_Appconfig.print_info('Adding Contents of the Folder')
- elif reply == QtWidgets.QMessageBox.No:
- self.cmd = "cp -R " + includefolder + " " + self.modelpath
- self.obj_Appconfig.print_info('Adding the Folder')
-
- print("Adding the Folder:" + includefolder.split('/')[-1])
- self.termtitle("Adding the Folder:" + includefolder.split('/')[-1])
-
- self.process = QtCore.QProcess(self)
- self.process.start('sh', ['-c', self.cmd])
- self.termtext("Command: " + self.cmd)
- self.process \
- .readyReadStandardOutput.connect(self.readAllStandard)
- self.process.waitForFinished(50000)
- print("Added the folder")
- # os.chdir(self.cur_dir)
-
- # This function is used to print the titles in the terminal of Ngveri tab
-
- def termtitle(self, textin):
-
- Text = ""
- Text += "
================================
"
- Text += textin
- Text += "
================================
"
- Text += ""
- self.termedit.append(Text)
-
- # This function is used to print the text/commands in the terminal of
- # Ngveri tab
- def termtext(self, textin):
-
- Text = ""
- Text += textin
- Text += ""
- self.termedit.append(Text)
-
- # This function reads all the Standard output data and the errors from the
- # process that aree being run
- @QtCore.pyqtSlot()
- def readAllStandard(self):
- # self.termedit = termedit
- # self.termedit.append(str(self.process.readAll().data(),\
- # encoding='utf-8'))
- stdoutput = self.process.readAll()
- TextStdOut = ""
- for line in str(stdoutput.data(), encoding='utf-8').split("\n"):
- TextStdOut += "
" + line
- TextStdOut += ""
- self.termedit.append(TextStdOut)
- # print(str(self.process.readAll().data(), encoding='utf-8'))
-
- stderror = self.process.readAllStandardError()
- if stderror.toUpper().contains(b"ERROR"):
- self.errorFlag = True
- TextErr = ""
- for line in str(stderror.data(), encoding='utf-8').split("\n"):
- TextErr += "
" + line
- TextErr += ""
- self.termedit.append(TextErr)
- # @QtCore.pyqtSlot()
- # def readAllStandard(self):
- # #self.termedit = termedit
- # self.termedit.append(str(self.process.\
- # readAll().data(), encoding='utf-8'))
-
- # print(str(self.process.readAll().data(), encoding='utf-8'))
- # stderror = self.process.readAllStandardError()
- # if stderror.toUpper().contains(b"ERROR"):
- # self.errorFlag = True
- # Text = ""
- # for line in str(stderror.data(), encoding='utf-8').split("\n"):
- # Text += "
"+line+"
"
- # Text += ""
- # self.termedit.append(Text+"\n")
-
- # init_path = '../../../'
- # if os.name == 'nt':
- # init_path = ''
- # includefile = QtCore.QDir.toNativeSeparators(\
- # QtWidgets.QFileDialog.getOpenFileName(
- # self, "Open adding other necessary files to be included",
- # init_path + "home"
- # )[0]
- # )
- # if includefile=="":
- # reply=QtWidgets.QMessageBox.critical(
- # None, "Error Message",
- # "Error: No File Chosen. Please chose a file",
- # QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
- # )
- # if reply == QtWidgets.QMessageBox.Ok:
- # self.addfile()
- # self.obj_Appconfig.print_info('Add Other Files Called')
-
- # elif reply == QtWidgets.QMessageBox.Cancel:
- # self.obj_Appconfig.print_info('No File Chosen')
- # filename = os.path.basename(includefile)
- # self.modelpath=self.digital_home+"/"+self.fname.split('.')[0]+"/"
-
- # if not os.path.isdir(self.modelpath):
- # os.mkdir(self.modelpath)
- # text = open(includefile).read()
- # open(self.modelpath+filename,'w').write(text)
- # includefile.close()
+ if ret == QtWidgets.QMessageBox.Ok:
+ mod = open(self.digital_home + '/modpath.lst', 'r')
+ data = mod.readlines()
+ mod.close()
+
+ data.remove(text + "\n")
+ mod = open(self.digital_home + '/modpath.lst', 'w')
+ for item in data:
+ mod.write(item)
+ self.fname = Maker.verilogFile[self.filecount]
+ model = ModelGeneration.ModelGeneration(
+ self.fname, self.entry_var[0])
+ model.runMake()
+ model.runMakeInstall()
+ return
+
+ #else:
+ # return
+
+ # 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
+ def lint_off_edit(self, text):
+ if text == "Edit lint_off":
+ return
+ index = self.entry_var[2].findText(text)
+ self.entry_var[2].removeItem(index)
+ self.entry_var[2].setCurrentIndex(0)
+ ret = QtWidgets.QMessageBox.warning(
+ None,
+ "Warning",
+ '''Do you want to remove the lint off error:''' +
+ text,
+ QtWidgets.QMessageBox.Ok,
+ QtWidgets.QMessageBox.Cancel)
+ if ret == QtWidgets.QMessageBox.Ok:
+ file = open("../maker/lint_off.txt", 'r')
+ data = file.readlines()
+ file.close()
+
+ data.remove(text + "\n")
+ file = open("../maker/lint_off.txt", 'w')
+ for item in data:
+ file.write(item)
+ return
+
+ #else:
+ # return
+
+ # This is to add lint_off comments needed by the verilator warnings
+ # This function writes to the lint_off.txt here in the same folder
+ def add_lint_off(self):
+ text = self.entry_var[3].text()
+
+ if self.entry_var[2].findText(text) == -1:
+ self.entry_var[2].addItem(text)
+ file = open("../maker/lint_off.txt", 'a+')
+ file.write(text + "\n")
+ file.close()
+ self.entry_var[3].setText("")
+
+ # creating various other groups like terminal, edit modlst, edit lint_off
+ # and add lint_off
+
+ def creategroup(self):
+
+ self.trbox = QtWidgets.QGroupBox()
+ self.trbox.setTitle("Terminal")
+ # self.trbox.setDisabled(True)
+ # self.trbox.setVisible(False)
+ self.trgrid = QtWidgets.QGridLayout()
+ self.trbox.setLayout(self.trgrid)
+ self.count = 0
+
+ self.start = QtWidgets.QLabel("Terminal")
+ # self.trgrid.addWidget(self.start, 2,0)
+ self.entry_var[self.count] = QtWidgets.QTextEdit()
+ self.entry_var[self.count].setReadOnly(1)
+ self.trgrid.addWidget(self.entry_var[self.count], 1, 1, 5, 3)
+ self.entry_var[self.count].setMaximumWidth(1000)
+ self.entry_var[self.count].setMaximumHeight(1000)
+ self.count += 1
+
+ self.entry_var[self.count] = QtWidgets.QComboBox()
+ self.entry_var[self.count].addItem("Edit modlst")
+ self.modlst = open(self.digital_home + '/modpath.lst', 'r')
+ self.data = self.modlst.readlines()
+ self.modlst.close()
+ for item in self.data:
+ if item != "\n":
+ self.entry_var[self.count].addItem(item.strip())
+ self.entry_var[self.count].activated[str].connect(self.edit_modlst)
+ self.trgrid.addWidget(self.entry_var[self.count], 1, 4, 1, 2)
+ self.count += 1
+ self.entry_var[self.count] = QtWidgets.QComboBox()
+ self.entry_var[self.count].addItem("Edit lint_off")
+ self.lint_off = open("../maker/lint_off.txt", 'r')
+ self.data = self.lint_off.readlines()
+ self.lint_off.close()
+ for item in self.data:
+ if item != "\n":
+ self.entry_var[self.count].addItem(item.strip())
+ self.entry_var[self.count].activated[str].connect(self.lint_off_edit)
+ self.trgrid.addWidget(self.entry_var[self.count], 2, 4, 1, 2)
+ self.count += 1
+ self.entry_var[self.count] = QtWidgets.QLineEdit(self)
+ self.trgrid.addWidget(self.entry_var[self.count], 3, 4)
+ self.entry_var[self.count].setMaximumWidth(100)
+ self.count += 1
+ self.entry_var[self.count] = QtWidgets.QPushButton("Add Lint_Off")
+ self.entry_var[self.count].setMaximumWidth(100)
+ self.trgrid.addWidget(self.entry_var[self.count], 3, 5)
+ self.entry_var[self.count].clicked.connect(self.add_lint_off)
+
+ self.count += 1
+
+ # CSS
+ self.trbox.setStyleSheet(" \
+ QGroupBox { border: 1px solid gray; border-radius: \
+ 9px; margin-top: 0.5em; } \
+ QGroupBox::title { subcontrol-origin: margin; left: \
+ 10px; padding: 0 3px 0 3px; } \
+ ")
+
+ return self.trbox
--
cgit
From 16038b4c42d4aa49e2b06a93830e9d0afd1d85ea Mon Sep 17 00:00:00 2001
From: rohinthram
Date: Tue, 8 Feb 2022 18:11:39 +0530
Subject: Update NgVeri.py
---
src/maker/NgVeri.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'src')
diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py
index 71100cd6..56c4a4e5 100755
--- a/src/maker/NgVeri.py
+++ b/src/maker/NgVeri.py
@@ -191,21 +191,21 @@ class NgVeri(QtWidgets.QWidget):
self.optionsgroupbtn.addButton(self.addverilogbutton)
self.addverilogbutton.clicked.connect(self.addverilog)
self.optionsgrid.addWidget(self.addverilogbutton, 0, 1)
- #self.optionsbox.setLayout(self.optionsgrid)
+ # self.optionsbox.setLayout(self.optionsgrid)
#self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.addfilebutton = QtWidgets.QPushButton("Add Other file")
self.optionsgroupbtn.addButton(self.addfilebutton)
self.addfilebutton.clicked.connect(self.addfile)
self.optionsgrid.addWidget(self.addfilebutton, 0, 2)
- #self.optionsbox.setLayout(self.optionsgrid)
+ # self.optionsbox.setLayout(self.optionsgrid)
#self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.addfolderbutton = QtWidgets.QPushButton("Add Folder")
self.optionsgroupbtn.addButton(self.addfolderbutton)
self.addfolderbutton.clicked.connect(self.addfolder)
self.optionsgrid.addWidget(self.addfolderbutton, 0, 3)
- #self.optionsbox.setLayout(self.optionsgrid)
+ # self.optionsbox.setLayout(self.optionsgrid)
#self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.clearTerminalBtn = QtWidgets.QPushButton("Clear Terminal")
@@ -246,7 +246,7 @@ class NgVeri(QtWidgets.QWidget):
model.runMakeInstall()
return
- #else:
+ # else:
# return
# This is to remove lint_off comments needed by the verilator warnings
@@ -275,7 +275,7 @@ class NgVeri(QtWidgets.QWidget):
file.write(item)
return
- #else:
+ # else:
# return
# This is to add lint_off comments needed by the verilator warnings
--
cgit
From 62824b56e5f299064346c6422cfbf684e6687c54 Mon Sep 17 00:00:00 2001
From: rohinthram
Date: Tue, 8 Feb 2022 18:40:35 +0530
Subject: Update NgVeri.py
---
src/maker/NgVeri.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
(limited to 'src')
diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py
index 56c4a4e5..d26c9338 100755
--- a/src/maker/NgVeri.py
+++ b/src/maker/NgVeri.py
@@ -116,16 +116,16 @@ class NgVeri(QtWidgets.QWidget):
model.runMake()
model.runMakeInstall()
txt = self.entry_var[0].toPlainText()
- if not "error" in txt.lower():
+ if "error" not in txt.lower():
self.entry_var[0].append('''
-
+
Model Created Successfully !
''')
else:
self.entry_var[0].append('''
-
- There was an error during model creation,
+
+ There was an error during model creation,
Please rectify the error and try again !
@@ -192,28 +192,28 @@ class NgVeri(QtWidgets.QWidget):
self.addverilogbutton.clicked.connect(self.addverilog)
self.optionsgrid.addWidget(self.addverilogbutton, 0, 1)
# self.optionsbox.setLayout(self.optionsgrid)
- #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+ # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.addfilebutton = QtWidgets.QPushButton("Add Other file")
self.optionsgroupbtn.addButton(self.addfilebutton)
self.addfilebutton.clicked.connect(self.addfile)
self.optionsgrid.addWidget(self.addfilebutton, 0, 2)
# self.optionsbox.setLayout(self.optionsgrid)
- #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+ # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.addfolderbutton = QtWidgets.QPushButton("Add Folder")
self.optionsgroupbtn.addButton(self.addfolderbutton)
self.addfolderbutton.clicked.connect(self.addfolder)
self.optionsgrid.addWidget(self.addfolderbutton, 0, 3)
# self.optionsbox.setLayout(self.optionsgrid)
- #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+ # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.clearTerminalBtn = QtWidgets.QPushButton("Clear Terminal")
self.optionsgroupbtn.addButton(self.clearTerminalBtn)
self.clearTerminalBtn.clicked.connect(self.clearTerminal)
self.optionsgrid.addWidget(self.clearTerminalBtn, 0, 4)
self.optionsbox.setLayout(self.optionsgrid)
- #self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
+ # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
return self.optionsbox
--
cgit