Skip to content

Commit

Permalink
major change in ngspice model referencing, xschem testcases update, q…
Browse files Browse the repository at this point in the history
…ucs-s examples updated

Signed-off-by: KrzysztofHerman <herman@ihp-microelectronics.com>
  • Loading branch information
KrzysztofHerman committed Jul 16, 2024
1 parent 1099461 commit 8adedce
Show file tree
Hide file tree
Showing 27 changed files with 174 additions and 158 deletions.
21 changes: 21 additions & 0 deletions ihp-sg13g2/libs.tech/ngspice/.spiceinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
* a custom spiceinit file for IHP-Open-PDK

* export PDK_ROOT first
setcs sourcepath = ( $sourcepath $PDK_ROOT/ihp-sg13g2/libs.tech/ngspice/models $PDK_ROOT/ihp-sg13g2/libs.ref/sg13g2_stdcell/spice )
*echo $sourcepath

*option tnom=28
option list
option klu
option node
option list
option opts
option warn=1
option maxwarns=10
option savecurrents

set ngbehavior=hsa
set noinit

osdi '$PDK_ROOT/ihp-sg13g2/libs.tech/ngspice/openvaf/psp103_nqs.osdi'

9 changes: 9 additions & 0 deletions ihp-sg13g2/libs.tech/qucs/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
####################################################
IMPORTANT
####################################################

In order to use the SG13G3 PDK sample schematics, you must add the SG13G3 PDK library to the Qucs-S subcircuit search path:

1) Go to File ->Application Settings ...
2) Click on the "Locations" tab
3) On the bottom, click on the "Add Path With Subfolders" button and select the SG13G3 PDK library folder (/home/<username>/.qucs/user_lib)
7 changes: 3 additions & 4 deletions ihp-sg13g2/libs.tech/qucs/examples/ac_mim_cap.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-603,-96,2362,1375,0.827406,84,45>
<View=52,-2,1670,973,1.22451,269,33>
<Grid=10,10,1>
<DataSet=ac_mim_cap.dat>
<DataDisplay=ac_mim_cap.dpl>
Expand All @@ -16,18 +16,17 @@
<Symbol>
</Symbol>
<Components>
<INCLSCR INCLSCR1 1 120 50 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerRES.lib res_typ\n.LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerCAP.lib cap_typ\n.control\n\n.endc" 1 "" 0 "" 0>
<INCLSCR INCLSCR1 1 120 50 -60 16 0 0 "\n.LIB cornerRES.lib res_typ\n.LIB cornerCAP.lib cap_typ\n" 1 "" 0 "" 0>
<.AC AC1 1 70 190 0 40 0 0 "log" 1 "100k" 1 "300 GHz" 1 "101" 1 "no" 0>
<GND * 1 360 650 0 0 0 0>
<Vac V1 1 70 570 18 -26 0 1 "1 V" 1 "1 kHz" 0 "0" 0 "0" 0 "0" 0 "0" 0>
<GND * 1 70 650 0 0 0 0>
<Lib cap_cmim1 1 360 590 -120 -49 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_basic_components" 0 "cap_cmim" 0 "70u" 1 "70u" 1>
<GND * 1 360 930 0 0 0 0>
<GND * 1 330 930 0 0 0 0>
<Lib cap_rfcmim1 1 370 860 50 -16 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_basic_components" 0 "cap_rfcmim" 0 "70u" 1 "70u" 1>
<Lib rhigh1 1 240 500 -26 -122 0 1 "/home/herman/.qucs/user_lib/IHP_PDK_basic_components" 0 "rhigh" 0 "1.0u" 1 "10u" 1 "1" 1>
<Lib rhigh2 1 240 780 -26 -122 0 1 "/home/herman/.qucs/user_lib/IHP_PDK_basic_components" 0 "rhigh" 0 "1.0u" 1 "10u" 1 "1" 1>
<Lib rhigh3 1 -360 600 50 -26 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_basic_components" 0 "rhigh" 0 "1.0u" 1 "0.5u" 1 "1" 1>
<Lib cap_cmim1 1 360 590 -120 -49 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_basic_components" 0 "cap_cmim" 0 "70u" 1 "70u" 1>
</Components>
<Wires>
<360 610 360 650 "" 0 0 0 "">
Expand Down
7 changes: 3 additions & 4 deletions ihp-sg13g2/libs.tech/qucs/examples/dc_diode_op.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-86,-4,1624,1075,1.25348,0,181>
<View=-39,-4,1577,932,0.971123,0,1>
<Grid=10,10,1>
<DataSet=dc_diode_op.dat>
<DataDisplay=dc_diode_op.dpl>
Expand All @@ -19,14 +19,13 @@
<.SW SW1 1 90 280 0 68 0 0 "DC1" 1 "lin" 1 "V2" 1 "0" 1 "1" 1 "301" 1 "false" 0>
<GND * 1 270 840 0 0 0 0>
<IProbe Pr1 1 270 640 -37 -26 0 3>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 ".INCLUDE ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/diodes.lib\n.control\npre_osdi ../../.qucs/psp103_nqs.osdi\n.endc" 1 "" 0 "" 0>
<.DC DC1 1 90 180 0 41 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "no" 0 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 "\n.INCLUDE diodes.lib\n" 1 "" 0 "" 0>
<GND * 1 120 840 0 0 0 0>
<Vdc V2 1 120 750 18 -26 0 1 "1 V" 1>
<Lib dantenna1 1 270 750 40 -16 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "dantenna" 0 "8u" 1 "8u" 1>
<GND * 1 470 840 0 0 0 0>
<IProbe Pr2 1 470 640 -37 -26 0 3>
<Lib dpantenna1 1 470 750 40 -16 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "dpantenna" 0 "16u" 1 "16u" 1>
<Lib dantenna1 1 270 750 40 -16 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "dantenna" 0 "8u" 1 "8u" 1>
</Components>
<Wires>
<270 590 270 610 "" 0 0 0 "">
Expand Down
5 changes: 2 additions & 3 deletions ihp-sg13g2/libs.tech/qucs/examples/dc_hbt_13g2.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-201,-94,2082,1128,0.651338,0,0>
<View=-108,16,1637,1026,0.89901,0,0>
<Grid=10,10,1>
<DataSet=dc_hbt_13g2.dat>
<DataDisplay=dc_hbt_13g2.dpl>
Expand All @@ -16,8 +16,6 @@
<Symbol>
</Symbol>
<Components>
<INCLSCR INCLSCR1 1 160 70 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerHBT.lib hbt_typ\n" 1 "" 0 "" 0>
<.DC DC1 1 40 160 0 46 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "no" 0 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
<.SW SW1 1 50 250 0 77 0 0 "DC1" 1 "lin" 1 "V2" 1 "0" 1 "1.5" 1 "301" 1 "false" 0>
<.SW SW2 1 50 470 0 77 0 0 "SW1" 1 "lin" 1 "I1" 1 "0" 1 "5u" 1 "10" 1 "false" 0>
<IProbe Pr1 1 170 740 -37 -26 0 3>
Expand All @@ -28,6 +26,7 @@
<GND * 1 70 960 0 0 0 0>
<Idc I1 1 70 910 18 -26 0 1 "0" 1>
<Lib npn13G1 1 170 850 10 64 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "npn13G2" 0 "1" 1>
<INCLSCR INCLSCR1 1 100 100 -60 16 0 0 ".LIB cornerHBT.lib hbt_typ\n" 1 "" 0 "" 0>
</Components>
<Wires>
<170 770 170 800 "" 0 0 0 "">
Expand Down
4 changes: 2 additions & 2 deletions ihp-sg13g2/libs.tech/qucs/examples/dc_hv_nmos.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-27,-4,1565,985,0.944385,0,0>
<View=-39,-4,1577,932,0.971123,0,1>
<Grid=10,10,1>
<DataSet=dc_hv_nmos.dat>
<DataDisplay=dc_hv_nmos.dpl>
Expand All @@ -24,7 +24,7 @@
<GND * 1 450 840 0 0 0 0>
<Vdc V1 1 160 800 18 -26 0 1 "1 V" 1>
<GND * 1 160 840 0 0 0 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerMOShv.lib mos_tt\n.control\npre_osdi ../../.qucs/psp103_nqs.osdi\n.endc" 1 "" 0 "" 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 "\n.LIB cornerMOShv.lib mos_tt\n" 1 "" 0 "" 0>
<.DC DC1 1 90 180 0 41 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "no" 0 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
<.SW SW2 1 260 280 0 68 0 0 "SW1" 1 "lin" 1 "V1" 1 "0" 1 "0.9" 1 "10" 1 "false" 0>
<Lib sg13_hv_nmos1 1 270 750 55 -121 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "sg13_hv_nmos" 0 "1.0u" 1 "0.45u" 1 "1" 1 "1" 1 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0.346e-6" 0 "0.38e-6" 0 "0.15e-6" 0 "0" 0 "1" 0>
Expand Down
4 changes: 2 additions & 2 deletions ihp-sg13g2/libs.tech/qucs/examples/dc_hv_pmos.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-85,-4,1583,976,0.90102,0,0>
<View=-98,-4,1595,976,0.926531,0,0>
<Grid=10,10,1>
<DataSet=dc_hv_pmos.dat>
<DataDisplay=dc_hv_pmos.dpl>
Expand All @@ -26,7 +26,7 @@
<Vdc V2 1 370 820 -61 -26 0 3 "1 V" 1>
<Vdc V1 1 80 870 -61 -26 0 3 "1 V" 1>
<IProbe Pr1 1 190 710 16 -26 0 1>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerMOShv.lib mos_tt\n.control\npre_osdi ../../.qucs/psp103_nqs.osdi\n.endc" 1 "" 0 "" 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 "\n.LIB cornerMOShv.lib mos_tt\n" 1 "" 0 "" 0>
<Lib sg13_hv_pmos1 1 190 820 45 -101 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "sg13_hv_pmos" 0 "1.0u" 1 "0.45u" 1 "1" 0 "1" 1 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0.346e-6" 0 "0.38e-6" 0 "0.15e-6" 0 "0" 0 "1" 0>
</Components>
<Wires>
Expand Down
9 changes: 4 additions & 5 deletions ihp-sg13g2/libs.tech/qucs/examples/dc_lv_nmos.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-6,-4,1543,906,0.97033,0,0>
<View=12,36,1515,906,1.04368,0,0>
<Grid=10,10,1>
<DataSet=dc_lv_nmos.dat>
<DataDisplay=dc_lv_nmos.dpl>
Expand All @@ -24,10 +24,9 @@
<GND * 1 450 840 0 0 0 0>
<Vdc V1 1 160 800 18 -26 0 1 "1 V" 1>
<GND * 1 160 840 0 0 0 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerMOSlv.lib mos_tt\n.control\npre_osdi ../../.qucs/psp103_nqs.osdi\n.endc" 1 "" 0 "" 0>
<.DC DC1 1 90 180 0 41 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "no" 0 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
<.SW SW2 1 260 280 0 68 0 0 "SW1" 1 "lin" 1 "V1" 1 "0" 1 "0.9" 1 "10" 1 "false" 0>
<Lib sg13_lv_nmos1 1 270 750 55 -121 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "sg13_lv_nmos" 0 "0.35u" 1 "0.34u" 1 "1" 1 "1" 1 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0.346e-6" 0 "0.38e-6" 0 "0.15e-6" 0 "0" 0 "1" 0>
<INCLSCR INCLSCR1 1 120 90 -60 16 0 0 ".LIB cornerMOSlv.lib mos_tt\n" 1 "" 0 "" 0>
</Components>
<Wires>
<270 810 270 840 "" 0 0 0 "">
Expand All @@ -43,8 +42,8 @@
<160 830 160 840 "" 0 0 0 "">
</Wires>
<Diagrams>
<Rect 602 852 868 643 3 #c0c0c0 1 00 1 0 0.1 2 1 0 5e-05 0.000381884 1 -1 0.2 1 315 0 225 1 0 0 "" "" "">
<"ngspice/sw1.i(pr1)" #0000ff 0 3 0 0 0>
<Rect 602 852 868 643 3 #c0c0c0 1 00 1 0 0.5 10 1 -0.1 0.1 1 1 -1 0.2 1 315 0 225 1 0 0 "" "" "">
<"ngspice/i(pr1)" #ff00ff 0 3 0 0 0>
</Rect>
</Diagrams>
<Paintings>
Expand Down
4 changes: 2 additions & 2 deletions ihp-sg13g2/libs.tech/qucs/examples/dc_lv_pmos.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-85,-4,1583,976,0.90102,0,0>
<View=-98,-4,1595,976,0.926531,0,0>
<Grid=10,10,1>
<DataSet=dc_lv_pmos.dat>
<DataDisplay=dc_lv_pmos.dpl>
Expand All @@ -26,7 +26,7 @@
<Vdc V2 1 370 820 -61 -26 0 3 "1 V" 1>
<Vdc V1 1 80 870 -61 -26 0 3 "1 V" 1>
<IProbe Pr1 1 190 710 16 -26 0 1>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerMOSlv.lib mos_tt\n.control\npre_osdi ../../.qucs/psp103_nqs.osdi\n.endc" 1 "" 0 "" 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 "\n.LIB cornerMOSlv.lib mos_tt\n" 1 "" 0 "" 0>
<Lib sg13_lv_pmos1 1 190 820 45 -101 0 0 "/home/herman/.qucs/user_lib/IHP_PDK_nonlinear_components" 0 "sg13_lv_pmos" 0 "0.35u" 1 "0.34u" 1 "1" 0 "1" 1 "0" 0 "0" 0 "0" 0 "0" 0 "0" 0 "0.346e-6" 0 "0.38e-6" 0 "0.15e-6" 0 "0" 0 "1" 0>
</Components>
<Wires>
Expand Down
7 changes: 3 additions & 4 deletions ihp-sg13g2/libs.tech/qucs/examples/resistors.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=-288,-4,1765,1119,1.04363,0,0>
<View=-143,-4,1620,1016,0.890196,0,0>
<Grid=10,10,1>
<DataSet=resistors.dat>
<DataDisplay=resistors.dpl>
Expand All @@ -22,7 +22,7 @@
</Symbol>
<Components>
<.SW SW1 1 90 280 0 68 0 0 "DC1" 1 "lin" 1 "V2" 1 "0" 1 "10" 1 "301" 1 "false" 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 ".LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/ngspice/models/cornerRES.lib res_wcs\n.control\nop\n.endc" 1 "" 0 "" 0>
<INCLSCR INCLSCR1 1 130 50 -60 16 0 0 "\n.LIB cornerRES.lib res_wcs\n" 1 "" 0 "" 0>
<Vdc V2 1 110 800 18 -26 0 1 "1 V" 1>
<GND * 1 250 950 0 0 0 0>
<GND * 1 110 950 0 0 0 0>
Expand All @@ -43,7 +43,6 @@
<GND * 1 1040 920 0 0 0 0>
<Idc I1 1 790 890 18 -26 0 1 "1 mA" 1>
<Idc I2 1 1040 890 18 -26 0 1 "1 mA" 1>
<.DC DC1 1 90 180 0 41 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "yes" 1 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
</Components>
<Wires>
<110 830 110 950 "" 0 0 0 "">
Expand Down Expand Up @@ -71,7 +70,7 @@
<Diagrams>
<Rect 553 615 857 473 3 #c0c0c0 1 00 1 0 0.5 10 1 -0.622632 1 7 1 0 0.1 0.525694 315 0 225 1 0 0 "" "" "">
<"ngspice/v(div2)" #ff0000 2 3 0 0 0>
<Mkr 5.01661 503 -225 3 0 0>
<Mkr 5 503 -225 3 0 0>
<"ngspice/i(pr1)" #ff0000 2 3 0 0 0>
<"ngspice/v(div1)" #ff00ff 2 3 0 0 0>
<"ngspice/v(div3)" #00ff00 2 3 0 0 0>
Expand Down
2 changes: 1 addition & 1 deletion ihp-sg13g2/libs.tech/qucs/examples/symbols.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Qucs Schematic 24.2.0>
<Properties>
<View=56,105,1360,872,1.15274,0,0>
<View=46,106,1370,872,1.18538,0,0>
<Grid=10,10,1>
<DataSet=symbols.dat>
<DataDisplay=symbols.dpl>
Expand Down
66 changes: 45 additions & 21 deletions ihp-sg13g2/libs.tech/qucs/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ def copy_files(source_dir, destination_dir):

def info():
msg = """
This script copies the Qucs-S user library files into
/home/$USER/.qucs/user_lib directory.
It also creates a symbolic link there and compiles and places
PSP103 model in ~/.qucs/ location.
This script:
- copies the Qucs-S user library files into /home/$USER/.qucs/user_lib directory.
- compiles and copy PSP103 model in ../ngspice/openvaf location
Please make sure that you have set up the PDK_ROOT env variable
export PDK_ROOT=your_location/IHP-Open-PDK
"""
Expand Down Expand Up @@ -82,28 +81,53 @@ def info():

copy_files(source_directory, destination_directory)

original_file = pdk_root
symbolic_link = "/home/" + username + "/.qucs/IHP-Open-PDK-main"
# Create the symbolic link
if not os.path.exists(symbolic_link):
try:
os.symlink(original_file, symbolic_link)
print(f"Symbolic link '{symbolic_link}' created successfully.")
except OSError as e:
print(f"Failed to create symbolic link: {e}")

# Copy examples to "Qucs Home" (/home/<username>/.qucs/)
print("Copying examples into Qucs-S Home...")
source_directory=pdk_root + "/ihp-sg13g2/libs.tech/qucs/examples"
destination_directory = "/home/" + username + "/.qucs/IHP-Open-PDK-SG13G2-Examples_prj"

if not os.path.exists(destination_directory):
os.makedirs(destination_directory)

copy_files(source_directory, destination_directory)
print("Examples copied")
print("\n\n#############################################")
print(" IMPORTANT NOTE")
print("#############################################\n")
print("Before using the PDK example schematics, you must add the PDK library path to the Qucs-S search path list.\n")
print("Please read the instructions provided in " + destination_directory + "/README.txt\n")
print("#############################################\n\n")



source_directory = pdk_root + "/ihp-sg13g2/libs.tech/ngspice/openvaf"
destination_directory = pdk_root + "/ihp-sg13g2/libs.tech/ngspice/openvaf"
program_name = "openvaf"
if is_program_installed(program_name):
command = "openvaf psp103_nqs.va --output " + "/home/" + username + "/.qucs/psp103_nqs.osdi"
directory = pdk_root + "/ihp-sg13g2/libs.tech/ngspice/openvaf"
print(f"{program_name} is installed and about to run the command '{command}' in a location: {directory} ")
exec_app_in_directory(command, directory)
command = "openvaf psp103_nqs.va --output " + destination_directory + "/psp103_nqs.osdi"
print(f"{program_name} is installed and about to run the command '{command}' in a location: {source_directory} ")
exec_app_in_directory(command, source_directory)
else:
print(f"{program_name} is not installed.")


original_file = pdk_root + "/ihp-sg13g2/libs.tech/ngspice/.spiceinit"
symbolic_link = "/home/" + username + "/.spiceinit"
# Create the symbolic link
if not os.path.exists(symbolic_link):
try:
os.symlink(original_file, symbolic_link)
print(f"Symbolic link '{symbolic_link}' created successfully.")
except OSError as e:
print(f"Failed to create symbolic link: {e}")





original_file = pdk_root
symbolic_link = "/home/" + username + "/.qucs/IHP-Open-PDK-main"
# Create the symbolic link
if not os.path.exists(symbolic_link):
try:
os.symlink(original_file, symbolic_link)
print(f"Symbolic link '{symbolic_link}' created successfully.")
except OSError as e:
print(f"Failed to create symbolic link: {e}")
23 changes: 14 additions & 9 deletions ihp-sg13g2/libs.tech/xschem/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def is_program_installed(program_name):

def info():
msg = """
This script compiles and places
PSP103 model in ./simulations/ location.
Please make sure that you have set up the PDK_ROOT env variable
export PDK_ROOT=your_location/IHP-Open-PDK
This script:
- compiles and places PSP103 model in ../ngspice/openvaf/ location.
- creates a symlink to the ../ngspice/.spiceinit file in your $HOME directory
Please make sure that you have set up the PDK_ROOT env variable export PDK_ROOT=your_location/IHP-Open-PDK
"""
print(msg)

Expand All @@ -57,16 +57,12 @@ def info():
source_directory=pdk_root + "/ihp-sg13g2/libs.tech/ngspice/openvaf"

username = os.environ.get("USER")
destination_directory = pdk_root + "/ihp-sg13g2/libs.tech/xschem/simulations"
destination_directory = pdk_root + "/ihp-sg13g2/libs.tech/ngspice/openvaf"

# Check if the source directory exists
if not os.path.exists(source_directory):
print(f"Source directory '{source_directory}' does not exist.")

# Check if the destination directory exists, if not, create it
if not os.path.exists(destination_directory):
os.makedirs(destination_directory)
print(f"Destination directory '{destination_directory}' created.")

program_name = "openvaf"
if is_program_installed(program_name):
Expand All @@ -77,6 +73,15 @@ def info():
print(f"{program_name} is not installed.")


original_file = pdk_root + "/ihp-sg13g2/libs.tech/ngspice/.spiceinit"
symbolic_link = "/home/" + username + "/.spiceinit"
# Create the symbolic link
if not os.path.exists(symbolic_link):
try:
os.symlink(original_file, symbolic_link)
print(f"Symbolic link '{symbolic_link}' created successfully.")
except OSError as e:
print(f"Failed to create symbolic link: {e}")



Expand Down
Loading

0 comments on commit 8adedce

Please sign in to comment.