Stefan Schippers
11/24/2022, 11:32 PM.option savecurrents
is added to save all device internal currents.
To quickly see the syntax of mos internal parameters, add a .option savecurrents
, then in the .control
section do a save all
and a op
command, then at ngspice prompt, after simulation issue a display
command, you see the name of all device currents.
ngspice 17 -> display
Here are the vectors currently active:
Title: MOS Characteristic
Name: op5 (Operating Point)
Date: Fri Nov 25 00:32:13 2022
@m.xm0.msky130_fd_pr__nfet_01v8[ib]: current, real, 0 long
@m.xm0.msky130_fd_pr__nfet_01v8[id]: current, real, 1 long
@m.xm0.msky130_fd_pr__nfet_01v8[ig]: current, real, 0 long
@m.xm0.msky130_fd_pr__nfet_01v8[is]: current, real, 0 long
drain : voltage, real, 1 long
gate : voltage, real, 1 long [default scale]
m.xm0.msky130_fd_pr__nfet_01v8#body: voltage, real, 1 long
m.xm0.msky130_fd_pr__nfet_01v8#dbody: voltage, real, 1 long
m.xm0.msky130_fd_pr__nfet_01v8#sbody: voltage, real, 1 long
vd#branch : current, real, 1 long
vg#branch : current, real, 1 long
Nelson Rodriguez
11/25/2022, 12:39 AMm.instance_name.m_device_name
?
Another question about the line 37, why are you doing $&w_test
I was reading the manual and there says that it's used to convert a numerical value to a string, so why to use it here, I don't understand (fig 1)Stefan Schippers
11/25/2022, 9:18 AMNelson Rodriguez
11/25/2022, 1:35 PMStefan Schippers
11/25/2022, 1:59 PMStefan Schippers
11/25/2022, 2:07 PM.../share/pdk/sky130A/libs.ref/sky130_fd_pr/spice/sky130_fd_pr__nfet_01v8__tt.pm3.spice
the minimum w is 0.36:
...
+ lmin = 1.5e-07 lmax = 1.8e-07 wmin = 3.6e-07 wmax = 3.9e-7
...
There are various model bins, used for different W/L combinations.
May be the minimum W is used in special structures (SRAM cells) but not allowed for generic circuitry.Nelson Rodriguez
11/25/2022, 2:28 PMw_test
is 1u, 2u, 3u?Stefan Schippers
11/25/2022, 4:32 PMNelson Rodriguez
11/25/2022, 5:54 PMw_test
takes 1u, 2u, 3u?
Another question, I was cheking the minimum sizes in the file you mentioned (fig 1) and I saw that those models are sorted in a descendent order of W value, but why are there so many models?
And just to check, the Wmin for the pmos would be 0.42u isn't it? (fig 2)Nelson Rodriguez
11/25/2022, 9:18 PM.title Maximum and Minimum Rise and Fall Times
*************************************
* Model Import
*************************************
.lib /home/nelson/cad/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
*************************************
* Circuit Netlist
*************************************
v1 vin 0 PULSE(0 1.8 0 1n 1n 5n 10n)
v2 vdd 0 DC 1.8
xp vdd vin vout vdd sky130_fd_pr__pfet_01v8 l=0.15 w=0.42 $ w=wp_min
xn vout vin 0 0 sky130_fd_pr__nfet_01v8 l=0.15 w=0.36 $ w=wn_min
*************************************
* Control Section
*************************************
.control
let wp_start = 1 $ wp maximum possible for 12T and DRC
let wp_stop = 0.42 $ wp minimum possible according to pdk
let wn_start = 0.36 $ wn minimum possible according to pdk
let wn_stop = 0.94 $ wn maximum possible for 12T and DRC
let delta_w = 0.1
* initialize loop variable
let wp = wp_start $ wp starts in 1
* loop
while wp le wp_stop $ stops when wp is less or equal to 0.42
alter @m.xp.msky130_fd_pr__nfet_01v8[w] = $&wn
alter @m.xn.msky130_fd_pr__pfet_01v8[w] = $&wp
tran 0.1n 20n
let wn = wn_start + delta_w
let wp = wp_start - delta_w
print wp wn vout
end
.endc
*************************************
* End of file
*************************************
.end
Stefan Schippers
11/26/2022, 10:22 AMwhile wp ge wp_stop
There are various other errors in the code, this one works:Nelson Rodriguez
11/27/2022, 3:50 AMStefan Schippers
11/27/2022, 9:10 AMNelson Rodriguez
12/01/2022, 9:34 PMStefan Schippers
12/02/2022, 12:50 PMtr1.vout
, then tr2.vout
and so on.
You can plot individual signals, like plot tr1.vout tr3.vout
, and the reserved word all
means plot all: plot all.vout
.