Roberto Di Lorenzo
08/12/2023, 8:27 PMStefan Schippers
08/12/2023, 9:34 PMxschem -x -r -n -s -q /path/to/schematic.sch
the -x and -r are optional (do not open X windows and do not use tclreadline shell)
-n: generate a netlist
-s: spice netlist
-q: quit when done.
To run a simulation call ngspice directly on the netlist:
ngspice -i schematic.spiceRoberto Di Lorenzo
08/13/2023, 7:04 PMTim Edwards
08/14/2023, 12:56 PMsubprocess package for python, not os.system(). The subprocess.run() subroutine has options for setting the environment and setting the directory from where the application is launched. So you can run the xschem application from a directory containing the xschemrc file that you want to apply.Roberto Di Lorenzo
08/14/2023, 3:45 PMChris
08/14/2023, 8:08 PMngspice :
import os
os.system('ngspice -b -o <some_name>.log <some_name>.spice')Roberto Di Lorenzo
08/14/2023, 9:00 PMChris
08/14/2023, 9:30 PMStefan Schippers
08/15/2023, 7:22 AMxschem --rcfile /path/to/xschemrc -n -s -x -r -q -o /path/for/netlist -N netlist_filename /path/to/circuit.sch
example i just ran on my system:
xschem --rcfile /home/schippes/share/pdk/sky130A/libs.tech/xschem/xschemrc -n -s -x -r -q -o /tmp -N netlist.spice /home/schippes/share/pdk/sky130A/libs.tech/xschem/sky130_tests/test_ac.sch
it produces the file netlist.spice in /tmp of the schematic test_ac.sch
For the meaning of the various options do a xschem -h.
It is important to give the -q option so xschem quits after creating the netlist.Roberto Di Lorenzo
08/15/2023, 7:17 PMos.system("xschem --rcfile /home/roberto/Documents/circuits/ids_vds_test/xschemrc -n -s -x -r -q -o /home/roberto/Documents/circuits/ids_vds_test/ -N netlist.spice /home/roberto/Documents/circuits/ids_vds_test/ids_vds_2.sch")
But with subprocess i am not able to run netlist
subprocess.run(["/usr/local/bin/xschem", "-c","xschem --rcfile /home/roberto/Documents/circuits/ids_vds_test/xschemrc -n -s -x -r -q -o /home/roberto/Documents/circuits/ids_vds_test/ -N netlist.spice /home/roberto/Documents/circuits/ids_vds_test/ids_vds_2.sch"])
I really don't understand this command "subprocess"...Tim Edwards
08/15/2023, 7:29 PMsubprocess.run(["/usr/local/bin/xschem", "--rcfile /home/roberto/Documents/circuits/ids_vds_test/xschemrc", "-n", "-s", "-x", "-r", "-q", "-o /home/roberto/Documents/circuits/ids_vds_test/", "-N netlist.spice", "/home/roberto/Documents/circuits/ids_vds_test/ids_vds_2.sch"])
Since the point of using "subprocess" was that you could launch xschem in a specific directory, you might want to add at the end a 2nd argument
cwd='/home/roberto/Documents/circuits/ids_vds_test'
But I think setting the cwd means that you don't need to specify the startup file which is in the same directory, so that should reduce the call to:
subprocess.run(["/usr/local/bin/xschem", "-n", "-s", "-x", "-r", "-q", "-o .", "-N netlist.spice", "ids_vds_2.sch"], cwd='/home/roberto/Documents/circuits/ids_vds_test')
Possibly -o . isn't needed, either.Roberto Di Lorenzo
08/15/2023, 7:40 PM--xschemrc is missed? but i don't know where to take into account...Roberto Di Lorenzo
08/16/2023, 8:12 PMsubprocess.run(["/usr/local/bin/xschem", "-n", "-s", "-x", "-r", "-q", "-o", "-N netlist.spice", "ids_vds_2.sch"], cwd='/home/roberto/Documents/circuits/ids_vds_test')
Using this command, i get this answer.
Warning: PDK_ROOT env. var. not found or empty, trying to find an open_pdks install
open_pdks installation: using /usr/local/share/pdk
SKYWATER_MODELS: /usr/local/share/pdk/sky130A/libs.tech/ngspice
SKYWATER_STDCELLS: /usr/local/share/pdk/sky130A/libs.ref/sky130_fd_sc_hd/spice
load_schematic(): unable to open file: /home/roberto/ids_vds_2.sch, fname=/home/roberto/ids_vds_2.sch
global_spice_netlist(): problems opening netlist file
seems part of the path is lost. this is wrong path: fname=/home/roberto/ids_vds_2.sch
@Tim EdwardsTim Edwards
08/17/2023, 1:21 AM./ids_vds_2.sch or /home/roberto/Documents/circuits/ids_vds_test/ids_vds_2.sch. If you have to modify the xschemrc file to get it to add the current directory to xschem's search path, then I guess you do need the --rcfile= option, maybe --rcfile=./xschemrc. If all else fails, ask Stefan Schippers.Roberto Di Lorenzo
08/17/2023, 9:07 PMsubprocess.run(["/usr/local/bin/xschem", "--rcfile=xschemrc", "-n", "-s", "-x", "-r", "-q", "-N netlist.spice", "ids_vds_2.sch"], cwd='/home/roberto/Documents/circuits/ids_vds_test/')
in the folder of schematic I have also xschemrc file, how can i do a netlist with this specific xschem rc file that is in the same folder of the schematic?
I get this when I run this command.
runfile('/home/roberto/Documents/circuits/ids_vds_test/netlist_run.py', wdir='/home/roberto/Documents/circuits/ids_vds_test')
Unknown option: netlist.spice
Unknown option: etlist.spice
Unknown option: .spice
Unknown option: e
xschem: cant do a netlist without a filenameStefan Schippers
08/20/2023, 8:10 AM"-N", "netlist.spice"Roberto Di Lorenzo
08/20/2023, 8:16 PMprocess_1 =subprocess.run(["/usr/local/bin/xschem", "--rcfile=/home/roberto/Documents/circuits/ids_vds_test/xschemrc", "-n", "-s", "-q", "-N","netlist.spice","ids_vds_2.sch"],
cwd='/home/roberto/Documents/circuits/ids_vds_test/')
Still the path is wrong and i don't know why....Stefan Schippers
08/20/2023, 9:26 PMxschemrc file and see the list of paths assigned to XSCHEM_LIBRARY_PATH.If everything fails add [pwd] to the list of paths assigned to `XSCHEM_LIBRARY_PATH`:
append XSCHEM_LIBRARY_PATH :[pwd]Roberto Di Lorenzo
08/21/2023, 7:51 PM#### xschemrc system configuration file
#### Flush any previous definition
set XSCHEM_LIBRARY_PATH {}
#### include devices/*.sym
append XSCHEM_LIBRARY_PATH ${XSCHEM_SHAREDIR}/xschem_library
#### include skywater libraries. Here i use [pwd]. This works if i start xschem from here.
append XSCHEM_LIBRARY_PATH :$env(PWD)
#### add ~/.xschem/xschem_library (USER_CONF_DIR is normally ~/.xschem)
append XSCHEM_LIBRARY_PATH :$USER_CONF_DIR/xschem_library
################
append XSCHEM_LIBRARY_PATH :[pwd]
###########################################################################
#### list of tcl files to preload.
# lappend tcl_files ${XSCHEM_SHAREDIR}/change_index.tcl
lappend tcl_files ${XSCHEM_SHAREDIR}/ngspice_backannotate.tcl
Running this command with everything defined, still not produce the spice netlist.
subprocess.run(["/usr/local/bin/xschem", "--rcfile=/home/roberto/Documents/circuits/ids_vds_test/xschemrc", "-n", "-s", "-q", "-N", "netlist.spice","ids_vds_2.sch"],
cwd='/home/roberto/Documents/circuits/ids_vds_test/')Stefan Schippers
08/22/2023, 6:52 AM~/.xschem/simulations
subprocess.run(["/usr/local/bin/xschem", "--rcfile=/home/roberto/Documents/circuits/ids_vds_test/xschemrc", "-n", "-s", "-q", "-N", "netlist.spice", "ids_vds_2.sch", *"-o", "/home/roberto/Documents/circuits/ids_vds_test"*], cwd='/home/roberto/Documents/circuits/ids_vds_test/')Roberto Di Lorenzo
08/25/2023, 7:17 PM"ids_vds_2.sch" , but than how the command know that the spice netlist should be put in the next path? why the definition of the cwd is not took into account.Stefan Schippers
08/27/2023, 7:46 AM