summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice/KicadtoNgspice.py
diff options
context:
space:
mode:
authorrahulp132022-09-18 08:13:12 +0530
committerrahulp132022-09-18 08:13:12 +0530
commit5666e6ed203889e27918415fb9302404d6c43561 (patch)
treebe97f7032c37dccf5f447955d0be8346085b99f9 /src/kicadtoNgspice/KicadtoNgspice.py
parent6e38b8cd9b8662a09a01765eb4c3b1ffaddd6ea3 (diff)
parent7c1f5eacbc233bd365d1fc42c11aa3163f7947e1 (diff)
downloadeSim-2.3.tar.gz
eSim-2.3.tar.bz2
eSim-2.3.zip
Merge branch 'master' into sky130-devv2.3
Diffstat (limited to 'src/kicadtoNgspice/KicadtoNgspice.py')
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py90
1 files changed, 56 insertions, 34 deletions
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index 28294be1..6a919de9 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.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: Wednesday 04 March 2015
-# REVISION: Saturday 25 July 2020
+# REVISION: Sunday 18 September 2022
# =========================================================================
import sys
@@ -376,9 +376,9 @@ class MainWindow(QtWidgets.QWidget):
if child.tag == "source":
attr_source = child
- count = 1
+ count = 0
grand_child_count = 0
- keys = list(obj_source.entry_var.keys())
+ entry_var_keys = list(obj_source.entry_var.keys())
for i in store_schematicInfo:
tmp_check = 0
@@ -390,7 +390,7 @@ class MainWindow(QtWidgets.QWidget):
for grand_child in child:
grand_child.text = \
str(obj_source.entry_var
- [keys[grand_child_count]].text())
+ [entry_var_keys[grand_child_count]].text())
grand_child_count += 1
if tmp_check == 0:
words = i.split(' ')
@@ -406,102 +406,124 @@ class MainWindow(QtWidgets.QWidget):
# attr_ac = ET.SubElement(attr_var, "ac")
ET.SubElement(
attr_var, "field1", name="Amplitude"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Phase"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "dc":
# attr_dc = ET.SubElement(attr_var, "dc")
ET.SubElement(
attr_var, "field1", name="Value"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "sine":
# attr_sine = ET.SubElement(attr_var, "sine")
ET.SubElement(
attr_var, "field1", name="Offset Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Amplitude"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field3", name="Frequency"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field4", name="Delay Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Damping Factor"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "pulse":
# attr_pulse=ET.SubElement(attr_var,"pulse")
ET.SubElement(
attr_var, "field1", name="Initial Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Pulse Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field3", name="Delay Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field4", name="Rise Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Fall Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Pulse width"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Period"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "pwl":
# attr_pwl=ET.SubElement(attr_var,"pwl")
ET.SubElement(
attr_var, "field1", name="Enter in pwl format"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "exp":
# attr_exp=ET.SubElement(attr_var,"exp")
ET.SubElement(
attr_var, "field1", name="Initial Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Pulsed Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field3", name="Rise Delay Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field4", name="Rise Time Constant"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
- attr_var, "field5", name="Fall TIme"
- ).text = str(obj_source.entry_var[count].text())
+ attr_var, "field5", name="Fall Time"
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field6", name="Fall Time Constant"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
if check == 0:
attr_model = ET.SubElement(attr_parent, "model")