From 5000da993e5d83bc4306a556da4ccc254145bd31 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 00:15:25 +0530 Subject: Restructured Verilator libraries --- src/maker/Maker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index f4c696f6..78fd13b2 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -228,7 +228,7 @@ class Maker(QtWidgets.QWidget): code = code.replace(" reg ", " ") vlog_ex = vlog.VerilogExtractor() vlog_mods = vlog_ex.extract_objects_from_source(code) - lint_off = open("../maker/lint_off.txt").readlines() + lint_off = open(init_path + "library/tlv/lint_off.txt").readlines() string = '''\\TLV_version 1d: tl-x.org\n\\SV\n''' for item in lint_off: string += "/* verilator lint_off " + \ -- cgit From 1b42df112e9d13afd092d9f415e7e446a2102e85 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:07:20 +0530 Subject: Restructured config paths and other path issues --- src/maker/Maker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/maker/Maker.py') 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( -- cgit From 7aa5afaeb6ac078d233383663ec6f96e20420b43 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:15:43 +0530 Subject: Prompt ToS if Sandpiper-SaaS directly invoked --- src/maker/Maker.py | 61 ++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 36 deletions(-) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index 60087018..01095d91 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -50,9 +50,31 @@ home = expanduser("~") verilogFile = [] toggle_flag = [] -# beginning class Maker. This class create the Maker Tab + +# This function is called to accept TOS of makerchip +def makerchipTOSAccepted(display=True): + if not os.path.isfile(home + "/.makerchip_accepted"): + if display: + reply = QtWidgets.QMessageBox.warning( + None, "Terms of Service", "Please review the Makerchip \ + Terms of Service \ + (\ + https://www.makerchip.com/terms/). \ + Have you read and do you \ + accept these Terms of Service?", + QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No + ) + + if reply == QtWidgets.QMessageBox.Yes: + f = open(home + "/.makerchip_accepted", "w") + f.close() + return True + + return False + return True +# beginning class Maker. This class create the Maker Tab class Maker(QtWidgets.QWidget): # initailising the varaibles @@ -177,22 +199,9 @@ class Maker(QtWidgets.QWidget): if os.name == 'nt': init_path = '' # noqa:F841 try: - if not os.path.isfile(home + "/.makerchip_accepted"): - reply = QtWidgets.QMessageBox.warning( - None, "Terms of Services", "Please review the makerchip\ - Terms of Service \ - (\ - https://www.makerchip.com/terms/ ).\ - Have you read and do you accept \ - these Terms of Service? [y/N]:", - QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No - ) + if not makerchipTOSAccepted(True): + return - if reply == QtWidgets.QMessageBox.Yes: - f = open(home + "/.makerchip_accepted", "w") - f.close() - else: - return print("Running Makerchip..............................") # self.file = open(self.verilogfile,"w") # self.file.write(self.entry_var[1].toPlainText()) @@ -372,27 +381,7 @@ Please check if Verilog File Chosen.") self.optionsbox.setLayout(self.optionsgrid) return self.optionsbox - # This function is called to accept TOS of makerchip - - def makerchipaccepted(self): - reply = QtWidgets.QMessageBox.warning( - None, "Terms of Services", "Please review the makerchip\ - Terms of Service \ - (\ - https://www.makerchip.com/terms/ ).\ - Have you read and do you \ - accept these Terms of Service? [y/N]:", - QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No - ) - - if reply == QtWidgets.QMessageBox.Yes: - f = open(home + "/.makerchip_accepted", "w") - f.close() - # else: - # return - # This function adds the other parts of widget like text box - def creategroup(self): self.trbox = QtWidgets.QGroupBox() -- cgit From 9fcfe12644a7aa88d9f43025eb2065252d4d40e6 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:34:24 +0530 Subject: Check for ToS using defined function --- src/maker/Maker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index 01095d91..4e71d7fd 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -371,10 +371,10 @@ Please check if Verilog File Chosen.") self.optionsgrid.addWidget(self.runoptions, 0, 4) # self.optionsbox.setLayout(self.optionsgrid) # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) - if not os.path.isfile(home + "/.makerchip_accepted"): + if not makerchipTOSAccepted(False): self.acceptTOS = QtWidgets.QPushButton("Accept Makerchip TOS") self.optionsgroupbtn.addButton(self.acceptTOS) - self.acceptTOS.clicked.connect(self.makerchipaccepted) + self.acceptTOS.clicked.connect(lambda: makerchipTOSAccepted(True)) self.optionsgrid.addWidget(self.acceptTOS, 0, 5) # self.optionsbox.setLayout(self.optionsgrid) # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) -- cgit From b6dcef53727c4a216d7b80d3085c1c0e4651a95a Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:38:49 +0530 Subject: Fix crash issue due to recursive file/directory access --- src/maker/Maker.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index 4e71d7fd..f3f8b93e 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -125,6 +125,10 @@ class Maker(QtWidgets.QWidget): QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) if reply == QtWidgets.QMessageBox.Ok: self.addverilog() + + if self.verilogfile == "": + return + self.obj_Appconfig.print_info('Add Verilog File Called') elif reply == QtWidgets.QMessageBox.Cancel: -- cgit From ab7dd7ed89899e2a17f70262e83437f50f2a924f Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:42:24 +0530 Subject: Fixed saving empty file crash issue --- src/maker/Maker.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index f3f8b93e..6d97e4d3 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -194,8 +194,18 @@ class Maker(QtWidgets.QWidget): # This function is used to save the edited file in eSim def save(self): - wr = self.entry_var[1].toPlainText() - open(self.verilogfile, "w+").write(wr) + try: + wr = self.entry_var[1].toPlainText() + open(self.verilogfile, "w+").write(wr) + except BaseException as err: + self.msg = QtWidgets.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") + self.msg.showMessage( + "Error in saving verilog file. Please check if it is chosen." + ) + self.msg.exec_() + print("Error in saving verilog file: " + str(err)) # This is used to run the makerchip-app def runmakerchip(self): -- cgit From 272bf20219595c3c541797b1045ce9c400ab02d6 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 01:50:56 +0530 Subject: Added a note and tooltip for Makerchip requirements --- src/maker/Maker.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index 6d97e4d3..9f4263c2 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -224,14 +224,15 @@ class Maker(QtWidgets.QWidget): if self.verilogfile.split('.')[-1] != "tlv": reply = QtWidgets.QMessageBox.warning( None, - "Do you want to automate top module?", - "Click on YES if you want top module \ - to be automatically added. \ - NOTE: a .tlv file will be created \ - in the directory of current verilog file\ - and the makerchip will be running on \ - this file. Otherwise click on NO.
\ - To not open Makerchip, click CANCEL", + "Do you want to automate the top module? ", + "Click on YES button if you want the top module \ + to be added automatically. A .tlv file will be created \ + in the directory of current verilog file \ + and the Makerchip IDE will be running on \ + this file. Otherwise click on NO button. \ + To not open Makerchip IDE, click on CANCEL button. \ +

NOTE: Makerchip IDE requires an active \ + internet connection and a browser.", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Cancel) @@ -380,6 +381,10 @@ Please check if Verilog File Chosen.") # self.optionsbox.setLayout(self.optionsgrid) # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) self.runoptions = QtWidgets.QPushButton("Edit in Makerchip") + self.runoptions.setToolTip( + "Requires internet connection and a browser" + ) + self.runoptions.setToolTipDuration(5000) self.optionsgroupbtn.addButton(self.runoptions) self.runoptions.clicked.connect(self.runmakerchip) self.optionsgrid.addWidget(self.runoptions, 0, 4) -- cgit From 87bc2c82192c948ddb88c52dfcd5213920920c2f Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Tue, 22 Feb 2022 02:31:30 +0530 Subject: Fixed typos and resolved flake8 issues --- src/maker/Maker.py | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'src/maker/Maker.py') diff --git a/src/maker/Maker.py b/src/maker/Maker.py index 9f4263c2..c7a66204 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -27,17 +27,11 @@ # ========================================================================= # importing the files and libraries -from xml.etree import ElementTree as ET # noqa:F401 import hdlparse.verilog_parser as vlog -import time # noqa:F401 from PyQt5 import QtCore, QtWidgets -from PyQt5.QtCore import QThread, Qt # noqa:F401 -from PyQt5.QtWidgets \ - import QApplication, \ - QWidget, QLabel, QVBoxLayout # noqa:F401 +from PyQt5.QtCore import QThread from configuration.Appconfig import Appconfig import os -import subprocess # noqa:F401 import watchdog.events import watchdog.observers from os.path import expanduser @@ -101,7 +95,7 @@ class Maker(QtWidgets.QWidget): # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) self.show() - # This function is to Add new verilog file + # This function is to Add new verilog file def addverilog(self): init_path = '../../' @@ -109,7 +103,7 @@ class Maker(QtWidgets.QWidget): init_path = '' self.verilogfile = QtCore.QDir.toNativeSeparators( QtWidgets.QFileDialog.getOpenFileName( - self, "Open verilog Directory", + self, "Open Verilog Directory", init_path + "home", "*v" )[0] ) @@ -120,9 +114,10 @@ class Maker(QtWidgets.QWidget): reply = QtWidgets.QMessageBox.critical( None, "Error Message", - "Error: No Verilog File Chosen.\ - Please chose a Verilog file", + "No Verilog File Chosen. \ + Please choose a verilog file.", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) + if reply == QtWidgets.QMessageBox.Ok: self.addverilog() @@ -211,12 +206,12 @@ class Maker(QtWidgets.QWidget): def runmakerchip(self): init_path = '../../' if os.name == 'nt': - init_path = '' # noqa:F841 + init_path = '' try: if not makerchipTOSAccepted(True): return - print("Running Makerchip..............................") + print("Running Makerchip IDE...........................") # self.file = open(self.verilogfile,"w") # self.file.write(self.entry_var[1].toPlainText()) # self.file.close() @@ -246,13 +241,13 @@ class Maker(QtWidgets.QWidget): file = os.path.basename('.'.join( self.verilogfile.split('.')[:-1])) f = open(filename, 'w') - flag = 1 # noqa F841 - ports = "" # noqa F841 code = code.replace(" wire ", " ") code = code.replace(" reg ", " ") vlog_ex = vlog.VerilogExtractor() vlog_mods = vlog_ex.extract_objects_from_source(code) - lint_off = open(init_path + "library/tlv/lint_off.txt").readlines() + lint_off = open( + init_path + "library/tlv/lint_off.txt" + ).readlines() string = '''\\TLV_version 1d: tl-x.org\n\\SV\n''' for item in lint_off: string += "/* verilator lint_off " + \ @@ -281,11 +276,11 @@ output logic passed, output logic failed);\n''' "Error Message", "Error: File name and module \ name are not same. Please \ - ensure that they are same", + ensure that they are same.", QtWidgets.QMessageBox.Ok) self.obj_Appconfig.print_info( - 'NgVeri Stopped due to File \ + 'NgVeri stopped due to file \ name and module name not matching error') return string += "//The $random() can be replaced \ @@ -325,7 +320,7 @@ Add \\TLV here if desired\ print("File: " + filename) self.process.start(cmd) print( - "Makerchip command process pid ---------- >", + "Makerchip IDE command process pid ---------->", self.process.pid()) except BaseException as e: print(e) @@ -333,11 +328,11 @@ Add \\TLV here if desired\ self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( - "Error in running Makerchip. \ -Please check if Verilog File Chosen.") + "Error in running Makerchip IDE. \ +Please check if verilog file is chosen.") self.msg.exec_() - print("Error in running Makerchip. \ -Please check if Verilog File Chosen.") + print("Error in running Makerchip IDE. \ +Please check if verilog file is chosen.") # initial = self.read_file() # while True: @@ -402,7 +397,6 @@ Please check if Verilog File Chosen.") # This function adds the other parts of widget like text box def creategroup(self): - self.trbox = QtWidgets.QGroupBox() self.trbox.setTitle(".tlv file") # self.trbox.setDisabled(True) @@ -413,7 +407,7 @@ Please check if Verilog File Chosen.") self.start = QtWidgets.QLabel("Path to .tlv file") self.trgrid.addWidget(self.start, 1, 0) self.count = 0 - self.entry_var[self.count] = QtWidgets.QLabel(" - ") + self.entry_var[self.count] = QtWidgets.QLabel() self.trgrid.addWidget(self.entry_var[self.count], 1, 1) self.entry_var[self.count].setMaximumWidth(1000) self.count += 1 -- cgit