Hi I am trying to generate an I/V curve for an nfe...
# sky130
g
Hi I am trying to generate an I/V curve for an nfet in xschem using ngspice. I am able to plot the current with ngspice in interactive mode using the following script: .lib /usr/local/share/pdk/sky130B/libs.tech/ngspice/sky130.lib.spice tt .DC V2 0 1.95 0.05 .probe I(XM1,3) .save all then from the terminal I do plot m1:s#branch. I was wondering if there is a way to do this using a control commands in the netlist instead. Follow up, what is the proper way to add control code to netlists generated with xschem; should you just edit the netlist using your text editor of choice?
s
to add arbitrary spice code in a xschem schematic just use a
code.sym
or
code_shown.sym
. All xschem_sky130 example circuits do this.
One of the test circuits
sky130_tests/test_nmos.sch
does characterize I/V curves of numeroius silicon nmos sky130 devices. The sky130_tests/test_pmos.sch does the same for p-channel devices.
1.png
g
Thank you so much, this is extremely helpful!
So, to be clear, you can write control statements in the code.sym file, and include stuff like plot directives?
s
Yes, you can add arbitrary spice code, including plot commands. In this case you get the plots drawn by ngspice. In the example above the plots are not drawn by ngspice, but directly by xschem. Xschem is now also a (rather complete) spice waveform viewer. To use xschem own wave rendering the flow is: • Write the spice commands to run the simulation, run the simulation (Typically press Simulate button). • Write the command to create the binary raw file (
write circuit.raw
if schematic name is circuit.sch) • Place a graph in xschem (
Simulation->Graphs -> Add waveform graph
) • Load the raw file (
Waves->tran
or
Waves->dc
, ...., depending on the simulation you have created). • Display signals in the graph. See this tutorial.