summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmbikeshwar Srivastava2015-09-09 18:28:37 +0530
committerAmbikeshwar Srivastava2015-09-09 18:28:37 +0530
commitb3d86df388704e22373f10a472c0779d161f1f01 (patch)
tree9ecd6f8415758ed7e4a47a2c42f0d9e80620235a
parent8f4b21cc15ffb590449131f1e31dc57a66e2f888 (diff)
parent41a8b32f7e2167a591225df3dbb3f4fbd1f458af (diff)
downloadnghdl-b3d86df388704e22373f10a472c0779d161f1f01.tar.gz
nghdl-b3d86df388704e22373f10a472c0779d161f1f01.tar.bz2
nghdl-b3d86df388704e22373f10a472c0779d161f1f01.zip
Merge pull request #2 from FOSSEE/master
update
-rw-r--r--doc/readme.md6
-rwxr-xr-xinstall-nghdl.sh (renamed from install.sh)84
-rw-r--r--readme.md4
-rw-r--r--src/Appconfig.py2
-rwxr-xr-xsrc/ngspice_ghdl.py34
5 files changed, 103 insertions, 27 deletions
diff --git a/doc/readme.md b/doc/readme.md
index 0df4032..7aa0c6e 100644
--- a/doc/readme.md
+++ b/doc/readme.md
@@ -25,12 +25,12 @@ for that model it will actually call the ghdl to get the result.
##How to install?
1. Clone this repository.
-2. Run `./install.sh` It will install ngspice from source code and put it in $HOME.
+2. Run `./install-nghdl.sh` It will install ngspice from source code and put it in $HOME.
##Few words about installed code structure.
1. Ngspice will be installed in home directory $HOME. If you already have ngspice-26 directory there it will take its backup.
-2. Source code for all other file will be present in ~/.FreeEDA
+2. Source code for all other file will be present in ~/.esim-nghdl
3. symlink nghdl is stored in /usr/local/bin
##How to use?
@@ -47,5 +47,5 @@ for that model it will actually call the ghdl to get the result.
##FUTURE WORK
1. Make changes to have more than one output.
2. Making changes to include use of more than one code models.
-3. Interfacing it with FreeEDA formely known as Oscad so that we can use it in our schematic.
+3. Interfacing it with esim formely known as Oscad so that we can use it in our schematic.
diff --git a/install.sh b/install-nghdl.sh
index 04e7efb..af73fe8 100755
--- a/install.sh
+++ b/install-nghdl.sh
@@ -1,9 +1,9 @@
#!/bin/bash
#===============================================================================
#
-# FILE: install.sh
+# FILE: install-nghdl.sh
#
-# USAGE: ./install.sh
+# USAGE: ./install-nghdl.sh
#
# DESCRIPTION: It is installation script for ngspice and ghdl work (nghdl).
#
@@ -12,13 +12,13 @@
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan , fahim.elex@gmail.com
-# ORGANIZATION: FreeEDA, FOSSEE group at IIT Bombay
+# ORGANIZATION: eSim, FOSSEE group at IIT Bombay
# CREATED: Tuesday 02 December 2014 17:01
# REVISION: ---
#===============================================================================
ngspice="ngspice-26"
-src_loc=".FreeEDA"
+src_loc=".esim-nghdl"
config_file="config.ini"
cur_dir=`pwd`
@@ -27,6 +27,77 @@ sysdate="$(date)"
timestamp=`echo $sysdate|awk '{print $3"_"$2"_"$6"_"$4 }'`
+#All functions goes here
+function addghdlPPA
+{
+ echo "Adding ghdl PPA to install latest ghdl version"
+ sudo add-apt-repository ppa:pgavin/ghdl
+ sudo apt-get update
+}
+
+function installDependency
+{
+ echo "Installing ghdl.................................."
+ sudo apt-get install -y ghdl
+ echo "Installing flex.................................."
+ sudo apt-get install -y flex
+ echo "Installing bison................................."
+ sudo apt-get install -y bison
+}
+
+echo "Enter proxy details if you are connected to internet thorugh proxy"
+
+echo -n "Is your internet connection behind proxy? (y/n): "
+read getProxy
+if [ $getProxy == "y" -o $getProxy == "Y" ];then
+ echo -n 'Proxy hostname :'
+ read proxyHostname
+
+ echo -n 'Proxy Port :'
+ read proxyPort
+
+ echo -n username@$proxyHostname:$proxyPort :
+ read username
+
+ echo -n 'Password :'
+ read -s passwd
+
+ unset http_proxy
+ unset https_proxy
+ unset HTTP_PROXY
+ unset HTTPS_PROXY
+ unset ftp_proxy
+ unset FTP_PROXY
+
+ export http_proxy=http://$username:$passwd@$proxyHostname:$proxyPort
+ export https_proxy=http://$username:$passwd@$proxyHostname:$proxyPort
+ export HTTP_PROXY=http://$username:$passwd@$proxyHostname:$proxyPort
+ export HTTPS_PROXY=http://$username:$passwd@$proxyHostname:$proxyPort
+ export ftp_proxy=http://$username:$passwd@$proxyHostname:$proxyPort
+ export FTP_PROXY=http://$username:$passwd@$proxyHostname:$proxyPort
+
+ echo "Install with proxy"
+ #Calling functions
+ addghdlPPA
+ installDependency
+
+elif [ $getProxy == "n" -o $getProxy == "N" ];then
+ echo "Install without proxy"
+
+ #Calling functions
+ addghdlPPA
+ installDependency
+
+ if [ $? -ne 0 ];then
+ echo -e "\n\n\nERROR: Unable to install required packages. Please check your internet connection.\n\n"
+ exit 0
+ fi
+
+else
+ echo "Please select the right option"
+ exit 0
+
+fi
#Checking if ngspice-26 directory is already present in Home directory
if [ -d $HOME/$ngspice ];then
@@ -70,7 +141,7 @@ fi
#Creating directory to put source
if [ -d "$HOME/$src_loc" ];then
- echo "(.)FreeEDA directory already in $HOME,removing it and copying new code"
+ echo "(.)esim-nghdl directory already in $HOME,removing it and copying new code"
rm -rf ~/$src_loc
mkdir -p ~/$src_loc
else
@@ -81,6 +152,9 @@ fi
cd $cur_dir
cp -rv src/* ~/$src_loc/
+#Copying LICENSE file
+cp LICENSE ~/$src_loc/
+
#Creating config.ini file and adding configuration information
cd ~/$src_loc/
diff --git a/readme.md b/readme.md
index f708050..df4764d 100644
--- a/readme.md
+++ b/readme.md
@@ -25,12 +25,12 @@ for that model it will actually call the ghdl to get the result.
##How to install?
1. Clone this repository.
-2. Run `./install.sh` It will install ngspice from source code and put it in $HOME.
+2. Run `./install-nghdl.sh` It will install ngspice from source code and put it in $HOME.
##Few words about installed code structure.
1. Ngspice will be installed in home directory $HOME. If you already have ngspice-26 directory there it will take its backup.
-2. Source code for all other file will be present in ~/.FreeEDA
+2. Source code for all other file will be present in ~/.esim-nghdl
3. symlink nghdl is stored in /usr/local/bin
##How to use?
diff --git a/src/Appconfig.py b/src/Appconfig.py
new file mode 100644
index 0000000..51bd7c1
--- /dev/null
+++ b/src/Appconfig.py
@@ -0,0 +1,2 @@
+
+nghdl_src_loc = ".esim-nghdl"
diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py
index 3cab011..3f4990b 100755
--- a/src/ngspice_ghdl.py
+++ b/src/ngspice_ghdl.py
@@ -12,22 +12,19 @@ import subprocess
from PyQt4 import QtGui
from PyQt4 import QtCore
from ConfigParser import SafeConfigParser
-
+from Appconfig import nghdl_src_loc
class Mainwindow(QtGui.QWidget):
def __init__(self):
#super(Mainwindow, self).__init__()
QtGui.QMainWindow.__init__(self)
print "Initializing.........."
- cwd = os.getcwd()
- path, file = os.path.split(cwd)
- print "cwd n path------ >", cwd, path
- licensefile = os.path.join(path, "LICENSE")
+ self.home = os.path.expanduser("~")
+ licensefile = os.path.join(os.path.join(self.home,nghdl_src_loc), "LICENSE")
fileopen = open(licensefile, 'r')
print fileopen.read()
- self.home = os.path.expanduser("~")
self.parser = SafeConfigParser()
- self.parser.read(self.home+'/.FreeEDA/config.ini')
+ self.parser.read(os.path.join(self.home,nghdl_src_loc+'/config.ini'))
self.file_list = [] #to keep the supporting files
self.initUI()
@@ -71,7 +68,7 @@ class Mainwindow(QtGui.QWidget):
def closeWindow(self):
try:
- self.process.kill()
+ self.process.close()
except:
pass
print "Close button clicked"
@@ -163,7 +160,7 @@ class Mainwindow(QtGui.QWidget):
print "Create Model Files Called"
os.chdir(self.cur_dir)
print "Current Working directory changed to ",self.cur_dir
- cmd = "python ~/.FreeEDA/model_generation.py "+str(self.ledit.text())
+ cmd = "python ~/"+nghdl_src_loc+"/model_generation.py "+str(self.ledit.text())
stdouterr = os.popen4(cmd)[1].read()
print stdouterr
#Moving file to model directory
@@ -179,12 +176,12 @@ class Mainwindow(QtGui.QWidget):
shutil.move(self.modelname+"_tb.vhdl",path+"/DUTghdl/")
shutil.copy(str(self.filename),path+"/DUTghdl/")
- shutil.copy(self.home+"/.FreeEDA/ghdlserver/compile.sh",path+"/DUTghdl/")
- shutil.copy(self.home+"/.FreeEDA/ghdlserver/uthash.h",path+"/DUTghdl/")
- shutil.copy(self.home+"/.FreeEDA/ghdlserver/ghdlserver.c",path+"/DUTghdl/")
- shutil.copy(self.home+"/.FreeEDA/ghdlserver/ghdlserver.h",path+"/DUTghdl/")
- shutil.copy(self.home+"/.FreeEDA/ghdlserver/Utility_Package.vhdl",path+"/DUTghdl/")
- shutil.copy(self.home+"/.FreeEDA/ghdlserver/Vhpi_Package.vhdl",path+"/DUTghdl/")
+ shutil.copy(os.path.join(self.home,nghdl_src_loc)+"/ghdlserver/compile.sh",path+"/DUTghdl/")
+ shutil.copy(os.path.join(self.home,nghdl_src_loc)+"/ghdlserver/uthash.h",path+"/DUTghdl/")
+ shutil.copy(os.path.join(self.home,nghdl_src_loc)+"/ghdlserver/ghdlserver.c",path+"/DUTghdl/")
+ shutil.copy(os.path.join(self.home,nghdl_src_loc)+"/ghdlserver/ghdlserver.h",path+"/DUTghdl/")
+ shutil.copy(os.path.join(self.home,nghdl_src_loc)+"/ghdlserver/Utility_Package.vhdl",path+"/DUTghdl/")
+ shutil.copy(os.path.join(self.home,nghdl_src_loc)+"/ghdlserver/Vhpi_Package.vhdl",path+"/DUTghdl/")
for file in self.file_list:
shutil.copy(str(file), path+"/DUTghdl/")
@@ -215,8 +212,10 @@ class Mainwindow(QtGui.QWidget):
path = os.getcwd()
#subprocess.call(cmd,shell=True)
command = "cd "+path +";"+cmd +";"+"make install"
+ #command = "cd "+path +";"+cmd
self.args = ['-into', str(self.terminal.winId()),'-hold','+s','-e', command]
self.process.start('xterm', self.args)
+
print "pid ------ >",self.process.pid()
#stdouterr = os.popen4(cmd)[1].read()
@@ -242,11 +241,12 @@ class Mainwindow(QtGui.QWidget):
except:
print "There is error during in 'make install' "
quit()
+
def uploadModle(self):
print "Upload button clicked"
try:
- self.process.kill()
+ self.process.close()
except:
pass
try:
@@ -261,7 +261,7 @@ class Mainwindow(QtGui.QWidget):
self.addingModelInModpath()
self.createModelFiles()
self.runMake()
- self.runMakeInstall()
+ #self.runMakeInstall()
else:
QtGui.QMessageBox.about(self,'Message','''<b>Important Message.</b><br/><br/>This accepts only <b>.vhdl</b> file ''')
except: