summaryrefslogtreecommitdiff
path: root/src/model_generation.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/model_generation.py')
-rwxr-xr-xsrc/model_generation.py45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/model_generation.py b/src/model_generation.py
index ce05a7c..364c6ff 100755
--- a/src/model_generation.py
+++ b/src/model_generation.py
@@ -1,6 +1,6 @@
import re
import os
-from configparser import SafeConfigParser
+from configparser import ConfigParser
class ModelGeneration:
@@ -11,12 +11,17 @@ class ModelGeneration:
print("Arguement is : ", file)
self.fname = os.path.basename(file)
print("VHDL filename is : ", self.fname)
- self.home = os.path.expanduser("~")
- self.parser = SafeConfigParser()
+
+ 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')
@@ -157,8 +162,8 @@ class ModelGeneration:
cfunc = open('cfunc.mod', 'w')
print("Building content for cfunc.mod file")
- comment = '''/* This is cfunc.mod file auto generated by gen_con_info.py
- Developed by Fahim, Rahul at IIT Bombay */\n
+ comment = '''/* This is cfunc.mod file auto generated by \
+ model_generation.py \nDeveloped by Fahim, Rahul at IIT Bombay */\n
'''
header = '''
@@ -559,8 +564,9 @@ class ModelGeneration:
cfunc.write("\t\tchar command[1024];\n")
if os.name == 'nt':
- self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL')
- self.msys_home = self.parser.get('COMPILER', 'MSYS_HOME')
+ self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL')
+ self.digital_home = os.path.join(self.digital_home, "ghdl")
+
cmd_str2 = "/start_server.sh %d %s & read" + "\\" + "\"" + "\""
cmd_str1 = os.path.normpath(
"\"" + self.digital_home + "/" +
@@ -576,7 +582,7 @@ class ModelGeneration:
else:
cfunc.write(
'\t\tsnprintf(command,1024,"' + self.home +
- '/ngspice-nghdl/src/xspice/icm/ghdl/' +
+ '/nghdl-simulator/src/xspice/icm/ghdl/' +
self.fname.split('.')[0] +
'/DUTghdl/start_server.sh %d %s &", sock_port, my_ip);'
)
@@ -715,16 +721,6 @@ class ModelGeneration:
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
-
- PARAMETER_TABLE:
- Parameter_Name: Sumanto
- Description: "Sumanto"
- Data_Type: real
- Default_Value: 1.0e-9
- Limits: [1e-12 -]
- Vector: no
- Vector_Bounds: -
- Null_Allowed: yes
'''
static_table = '''
@@ -1064,14 +1060,15 @@ class ModelGeneration:
def createServerScript(self):
# ####### Creating and writing components in start_server.sh ####### #
- self.digital_home = self.parser.get('NGSPICE', 'DIGITAL_MODEL')
+ self.digital_home = self.parser.get('NGHDL', 'DIGITAL_MODEL')
+ self.digital_home = os.path.join(self.digital_home, "ghdl")
start_server = open('start_server.sh', 'w')
start_server.write("#!/bin/bash\n\n")
start_server.write(
- "###This server run ghdl testebench for infinite time till " +
- "ngspice send END signal to stop it\n\n"
+ "###This server run ghdl testbench for infinite time till " +
+ "Ngspice sends kill signal to stop it\n\n"
)
if os.name == 'nt':
@@ -1109,7 +1106,7 @@ class ModelGeneration:
start_server.write(
"gtkwave " +
self.fname.split('.')[0] +
- "_tb.vcd")
+ "_tb.vcd 2>/dev/null")
start_server.close()