summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRahul P2022-09-17 23:31:49 +0530
committerGitHub2022-09-17 23:31:49 +0530
commit6e38b8cd9b8662a09a01765eb4c3b1ffaddd6ea3 (patch)
tree298942db122882e247da05e7e7fa10cb3dd03d85 /src
parent2843e73ed81ac0bb5e685a5f1e045babb67083f0 (diff)
parent39632efe85fcfc781139442103269e90e0a29d3a (diff)
downloadeSim-6e38b8cd9b8662a09a01765eb4c3b1ffaddd6ea3.tar.gz
eSim-6e38b8cd9b8662a09a01765eb4c3b1ffaddd6ea3.tar.bz2
eSim-6e38b8cd9b8662a09a01765eb4c3b1ffaddd6ea3.zip
Merge pull request #221 from rahulp13/sky130-dev
Added IPs and subcircuits, fixed path issues
Diffstat (limited to 'src')
-rw-r--r--src/browser/UserManual.py2
-rw-r--r--src/configuration/Appconfig.py6
-rw-r--r--src/frontEnd/Application.py26
-rwxr-xr-xsrc/kicadtoNgspice/Convert.py44
-rwxr-xr-xsrc/kicadtoNgspice/DeviceModel.py172
5 files changed, 77 insertions, 173 deletions
diff --git a/src/browser/UserManual.py b/src/browser/UserManual.py
index bf9c4b2b..5f12bdc0 100644
--- a/src/browser/UserManual.py
+++ b/src/browser/UserManual.py
@@ -14,7 +14,7 @@ class UserManual(QtWidgets.QWidget):
self.vlayout = QtWidgets.QVBoxLayout()
- manual = 'library/browser/User-Manual/eSim_Manual_2.2.pdf'
+ manual = 'library/browser/User-Manual/eSim_Manual_2.3.pdf'
if os.name == 'nt':
os.startfile(os.path.realpath(manual))
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py
index ab19ada5..c3f14e6f 100644
--- a/src/configuration/Appconfig.py
+++ b/src/configuration/Appconfig.py
@@ -10,10 +10,10 @@
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
-# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
+# MODIFIED: Rahul Paknikar, rahulp@cse.iitb.ac.in
# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Tuesday 24 February 2015
-# REVISION: Sunday 02 August 2020
+# REVISION: Tuesday 13 September 2022
# =========================================================================
from PyQt5 import QtWidgets
@@ -105,7 +105,7 @@ class Appconfig(QtWidgets.QWidget):
# Application Details
self._APPLICATION = 'eSim'
- self._VERSION = '2.2'
+ self._VERSION = '2.3'
self._AUTHOR = 'Fahim'
self._REVISION = 'Rahul, Sumanto'
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index d3ef020f..1a887eaa 100644
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -160,6 +160,21 @@ class Application(QtWidgets.QMainWindow):
self.topToolbar.addAction(self.switchmode)
self.topToolbar.addAction(self.helpfile)
+ self.soc = QtWidgets.QToolButton(self)
+ self.soc.setText('Generate SoC')
+ self.soc.setToolTip(
+ '<b>SPICE to Verilog Conversion</b><br>' + \
+ '<br>The feature is under development.' + \
+ '<br>It will be released soon.' + \
+ '<br><br>Thank you for your patience!!!'
+ )
+ self.soc.setStyleSheet(" \
+ QWidget { border-radius: 15px; border: 1px \
+ solid gray; padding: 10px; margin-left: 20px; } \
+ ")
+ self.soc.clicked.connect(self.showSoCRelease)
+ self.topToolbar.addWidget(self.soc)
+
# This part is setting fossee logo to the right
# corner in the application window.
self.spacer = QtWidgets.QWidget()
@@ -247,6 +262,17 @@ class Application(QtWidgets.QMainWindow):
self.lefttoolbar.setOrientation(QtCore.Qt.Vertical)
self.lefttoolbar.setIconSize(QSize(40, 40))
+
+ def showSoCRelease(self):
+ msg = '<b>SPICE to Verilog Conversion</b><br>' + \
+ '<br>The feature is under development.' + \
+ '<br>It will be released soon.' + \
+ '<br><br>Thank you for your patience!!!'
+ QtWidgets.QMessageBox.information(
+ self, 'SoC Generation', msg, QtWidgets.QMessageBox.Ok
+ )
+
+
def closeEvent(self, event):
'''
This function closes the ongoing program (process).
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py
index c1209cd3..566182e0 100755
--- a/src/kicadtoNgspice/Convert.py
+++ b/src/kicadtoNgspice/Convert.py
@@ -525,47 +525,40 @@ class Convert:
# print("Library Path :", libpath)
# Copying library from devicemodelLibrary to Project Path
# Special case for MOSFET
- print(eachline[0:5])
+ tempStr = libname.split(':')
+ libname = tempStr[0]
+ libAbsPath = os.path.join(libpath, libname)
+
if eachline[0] == 'm':
# For mosfet library name come along with MOSFET
# dimension information
- tempStr = libname.split(':')
- libname = tempStr[0]
dimension = tempStr[1]
# Replace last word with library name
# words[-1] = libname.split('.')[0]
- words[-1] = self.getRefrenceName(libname, libpath)
+ words[-1] = self.getReferenceName(libname, libpath)
# Appending Dimension of MOSFET
words.append(dimension)
deviceLine[index] = words
includeLine.append(".include " + libname)
- # src = completeLibPath.split(':')[0] # <----- Not
- # working in Windows
-
- (src_path, src_lib) = os.path.split(completeLibPath)
- src_lib = src_lib.split(':')[0]
- src = os.path.join(src_path, src_lib)
- dst = projpath
- shutil.copy2(src, dst)
+ shutil.copy2(libAbsPath, projpath)
elif eachline[0:6] == 'scmode':
(filepath, filemname) = os.path.split(self.clarg1)
self.Fileopen = os.path.join(filepath, ".spiceinit")
- print("======================================================")
- print("Writing to the .spiceinit file to make ngspice SKY130 compatible")
+ print("==============================================")
+ print("Writing to the .spiceinit file to " +
+ "make ngspice SKY130 compatible")
self.writefile = open(self.Fileopen, "w")
self.writefile.write('''
set ngbehavior=hsa ; set compatibility for reading PDK libs
-set ng_nomodcheck ; don't check the model parameters
+set ng_nomodcheck ; don't check the model parameters
set num_threads=8 ; CPU hardware threads available
option noinit ; don't print operating point data
optran 0 0 0 100p 2n 0 ; don't use dc operating point, but transient op)
''')
- print("======================================================")
+ print("==============================================")
- tempStr = completeLibPath.split(':')
- print(tempStr)
libs = '''
sky130_fd_pr__model__diode_pd2nw_11v0.model.spice
sky130_fd_pr__model__diode_pw2nd_11v0.model.spice
@@ -575,31 +568,28 @@ sky130_fd_pr__model__pnp.model.spice
sky130_fd_pr__model__r+c.model.spice
'''
includeLine.append(
- ".lib \"" + tempStr[0] + "\" " + tempStr[1])
+ ".lib \"" + libAbsPath + "\" " + tempStr[1])
for i in libs.split():
includeLine.append(
- ".include \"" + tempStr[0].replace(
+ ".include \"" + libAbsPath.replace(
"sky130.lib.spice", i) + "\"")
deviceLine[index] = "*scmode"
# words.append(completeLibPath)
# deviceLine[index] = words
elif eachline[0:2] == 'sc' and eachline[0:6] != 'scmode':
- temp_str = words[0].replace('sc', 'xsc')
- words[0] = temp_str
+ words[0] = words[0].replace('sc', 'xsc')
words.append(completeLibPath)
deviceLine[index] = words
else:
# Replace last word with library name
# words[-1] = libname.split('.')[0]
- words[-1] = self.getRefrenceName(libname, libpath)
+ words[-1] = self.getReferenceName(libname, libpath)
deviceLine[index] = words
includeLine.append(".include " + libname)
- src = completeLibPath
- dst = projpath
- shutil.copy2(src, dst)
+ shutil.copy2(completeLibPath, projpath)
# Adding device line to schematicInfo
for index, value in deviceLine.items():
@@ -673,7 +663,7 @@ sky130_fd_pr__model__r+c.model.spice
return schematicInfo
- def getRefrenceName(self, libname, libpath):
+ def getReferenceName(self, libname, libpath):
libname = libname.replace('.lib', '.xml')
library = os.path.join(libpath, libname)
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py
index 604f814b..0967333c 100755
--- a/src/kicadtoNgspice/DeviceModel.py
+++ b/src/kicadtoNgspice/DeviceModel.py
@@ -1,11 +1,7 @@
from PyQt5 import QtWidgets, QtCore
-from PyQt5.QtCore import QThread, Qt
import os
-import wget
-import zipfile
from xml.etree import ElementTree as ET
from . import TrackWidget
-flag = 0
class DeviceModel(QtWidgets.QWidget):
@@ -55,6 +51,7 @@ class DeviceModel(QtWidgets.QWidget):
self.row = 0
self.count = 1 # Entry count
self.entry_var = {}
+
# For MOSFET
self.widthLabel = {}
self.lengthLabel = {}
@@ -77,54 +74,20 @@ class DeviceModel(QtWidgets.QWidget):
def eSim_sky130(self, schematicInfo):
sky130box = QtWidgets.QGroupBox()
sky130grid = QtWidgets.QGridLayout()
- i = self.count
- beg = self.count
- sky130box.setTitle(
- "Various Options for Sky130")
- self.row = self.row + 1
- self.downloadbtn = QtWidgets.QPushButton("Download Sky130_fd_pr PDK")
- self.downloadbtn.clicked.connect(self.downloadPDK)
- sky130grid.addWidget(self.downloadbtn, self.row, 1)
-
- self.SOCbtn = QtWidgets.QPushButton("Generate SoC")
- self.SOCbtn.clicked.connect(self.GenerateSOCbutton)
- sky130grid.addWidget(self.SOCbtn, self.row, 2)
- self.SOCbtn.setToolTip('''This is the Generate SoC \
-option to convert SPICE to verilog.
-Naming convention should be strictly:
-IP for Analog Design: IPAD
-IP for Digital Design: IPDD
-Net labels: pinname_pinno_mode_bridgetype
-For more info please see the documentation''')
- sky130box.setLayout(sky130grid)
- sky130box.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; } \
- ")
- self.grid.addWidget(sky130box)
- sky130box = QtWidgets.QGroupBox()
- sky130grid = QtWidgets.QGridLayout()
self.count = self.count+1
self.row = self.row + 1
self.devicemodel_dict_beg["scmode1"] = self.count
- i = self.count
beg = self.count
self.deviceDetail[self.count] = "scmode1"
- sky130box.setTitle(
- "Add parameters of SKY130 library ")
+ sky130box.setTitle("Add parameters of SKY130 library ")
# +
# " : " +
# words[6])
- self.parameterLabel[self.count] = QtWidgets.QLabel(
- "Enter the path ")
+ self.parameterLabel[self.count] = QtWidgets.QLabel("Enter the path ")
self.row = self.row + 1
sky130grid.addWidget(self.parameterLabel[self.count], self.row, 0)
self.entry_var[self.count] = QtWidgets.QLineEdit()
- init_path = '../../'
- if os.name == 'nt':
- init_path = ''
+ self.entry_var[self.count].setReadOnly(True)
for child in self.root:
if child.tag == "scmode1":
@@ -134,9 +97,16 @@ For more info please see the documentation''')
.setText(child[0].text)
path_name = child[0].text
else:
- path_name = os.path.abspath(
- init_path + "library/deviceModelLibrary/\
-sky130_fd_pr/models/sky130.lib.spice")
+ if os.name == 'nt':
+ path_name = os.path.abspath(
+ "library/" +
+ "sky130_fd_pr/models/sky130.lib.spice"
+ )
+ else:
+ path_name = os.path.abspath(
+ "/usr/share/local/" +
+ "sky130_fd_pr/models/sky130.lib.spice"
+ )
self.entry_var[self.count].setText(path_name)
# self.trackLibraryWithoutButton(self.count, path_name)
@@ -220,7 +190,6 @@ sky130_fd_pr/models/sky130.lib.spice")
self.deviceDetail[self.count] = words[0]
sky130box = QtWidgets.QGroupBox()
sky130grid = QtWidgets.QGridLayout()
- i = self.count
beg = self.count
sky130box.setTitle(
"Add parameters for " +
@@ -566,56 +535,19 @@ sky130_fd_pr/models/sky130.lib.spice")
self.show()
- def downloadPDK(self):
- init_path = '../../'
- if os.name == 'nt':
- init_path = ''
- path_name = os.path.abspath(init_path + "library/deviceModelLibrary/")
- global flag
- print("flag="+str(flag))
- if os.path.exists(path_name+'/sky130_fd_pr'):
- print("Sky130_fd_pr PDK already exists")
- self.msg = QtWidgets.QErrorMessage()
- self.msg.setModal(True)
- self.msg.setWindowTitle("PDK already exists")
- self.content = "Sky130_fd_pr PDK already exists.\n" + \
- "Hence no need to download."
- self.msg.showMessage(self.content)
- self.msg.exec_()
- return
- elif flag == 1:
- # print("Sky130_fd_pr PDK download in progress")
- self.msg = QtWidgets.QErrorMessage()
- self.msg.setModal(True)
- self.msg.setWindowTitle("Download in Progress")
- self.content = "PDK download in progress.\n" + \
- "Please see the eSim terminal " +\
- "to track the progress.\nClick on OK."
- self.msg.showMessage(self.content)
- self.msg.exec_()
- return
- else:
- self.msg = QtWidgets.QErrorMessage()
- self.msg.setModal(True)
- self.msg.setWindowTitle("PDK download started")
- self.content = "PDK download started.\n" + \
- "Please see the eSim terminal " +\
- "to track the progress.\nClick on OK."
- self.msg.showMessage(self.content)
- self.msg.exec_()
- flag = 1
- self.downloadThread = downloadThread(path_name)
- self.downloadThread.start()
-
def trackDefaultLib(self):
- init_path = '../../'
- if os.name == 'nt':
- init_path = ''
sending_btn = self.sender()
self.widgetObjCount = int(sending_btn.objectName())
- path_name = os.path.abspath(
- init_path + "library/deviceModelLibrary/sky130_fd_pr\
-/models/sky130.lib.spice")
+ if os.name == 'nt':
+ path_name = os.path.abspath(
+ "library/" +
+ "sky130_fd_pr/models/sky130.lib.spice"
+ )
+ else:
+ path_name = os.path.abspath(
+ "/usr/share/local/" +
+ "sky130_fd_pr/models/sky130.lib.spice"
+ )
self.entry_var[self.widgetObjCount].setText(path_name)
self.trackLibraryWithoutButton(self.widgetObjCount, path_name)
@@ -748,7 +680,6 @@ sky130_fd_pr/models/sky130.lib.spice")
self.obj_trac.deviceModelTrack[self.deviceName] = self.libfile
def GenerateSOCbutton(self):
-
#############################################################
# ***************** SPICE to Verilog Converter **************
@@ -758,7 +689,7 @@ sky130_fd_pr/models/sky130.lib.spice")
# Sumanto Kar, sumantokar@iitb.ac.in
# Nagesh Karmali, nags@cse.iitb.ac.in
# Firuza Karmali, firuza@cse.iitb.ac.in
- # Rahul Paknikar, rahulp@iitb.ac.in
+ # Rahul Paknikar, rahulp@cse.iitb.ac.in
# GUIDED BY:
# Kunal Ghosh, VLSI System Design Corp.Pvt.Ltd
# Anagha Ghosh, VLSI System Design Corp.Pvt.Ltd
@@ -839,7 +770,7 @@ sky130_fd_pr/models/sky130.lib.spice")
"\\\\Generated from SPICE to Verilog. \
Converter developed at FOSSEE, IIT Bombay\n")
parsedcontent.append(
- "\\\\The development is under progress and may not be accurate\n")
+ "\\\\The development is under progress and may not be accurate.\n")
for j in filelist:
parsedcontent.append('''`include "'''+j+'''.v"''')
@@ -862,8 +793,8 @@ Converter developed at FOSSEE, IIT Bombay\n")
parsedcontent.append(j)
parsedcontent.append("endmodule;")
- print('\n**************Generated Verilog File:' +
- filename+'.parsed.v***************\n')
+ print('\n**************Generated Verilog File: ' +
+ filename + '.parsed.v***************\n')
for j in parsedcontent:
print(j)
parsedfile.write(j+"\n")
@@ -873,51 +804,8 @@ Converter developed at FOSSEE, IIT Bombay\n")
self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Verilog File Generated")
- self.content = "The Verilog File has been successfully\
- generated from the SPICE file"
+ self.content = "The Verilog file has been successfully \
+ generated from the SPICE netlist"
self.msg.showMessage(self.content)
self.msg.exec_()
return
-
-
-class downloadThread(QThread):
- # initialising the threads
- # initialising the threads
- def __init__(self, path_name):
- QThread.__init__(self)
- self.path_name = path_name
-
- def __del__(self):
- self.wait()
-
- # running the thread to toggle
- def run(self):
- global flag
- try:
- print("\nSky130_fd_pr Download started at Location: "
- + self.path_name) # noqa
- print("\nYou will be notified once downloaded\n")
- wget.download("https://static.fossee.in/esim/installation\
- -files/sky130_fd_pr.zip",
- self.path_name+'/sky130_fd_pr.zip')
- print("\nSky130_fd_pr Downloaded Successfully \
- at Location: "+self.path_name)
-
- except Exception as e:
- print(e)
- print("Download process Failed")
-
- try:
- print("\nStarted Extracting................................\n")
- print("\nYou will be notified once extracted")
- zp = zipfile.ZipFile(self.path_name+'/sky130_fd_pr.zip')
- curr_dir = os.getcwd()
- os.chdir(self.path_name)
- zp.extractall()
- os.remove('sky130_fd_pr.zip')
- print("\nZip File Extracted Successfully\n")
- os.chdir(curr_dir)
- except Exception as e:
- print(e)
- print("Extraction process Failed")
- flag = 0