Sudharsan S
01/05/2022, 1:26 PM.dc V1 0 1.8 0.01
.control
let start_WN1 = 1e-6
let stop_WN1 = 100e-6
let delta_WN1 = 10e-6
let actual_WN1 = start_WN1
while actual_WN1 le stop_WN1
alter m.xm1.msky130_fd_pr__nfet_01v8 W = actual_WN1
dc V1 0 1.8 0.01
* plot v(Vout)
let actual_WN1 = actual_WN1 + delta_WN1
end
plot dc1.v(Vout) dc5.v(Vout) dc10.v(Vout)
.endc
But running this simulation I get:
*Error:* no model available for w=1.100000e-6 l=1.500000e-7
and so on for all the values iterated.
I understand that only certain parameter combinations are available and any other sizes result in interpolated models.
Any help regarding on how I can perform such a parametric sweep type simulation would really help.Tim Edwards
01/05/2022, 2:39 PM.option scale
line built into the library files. W and L (and all dimensions of length) need to be specified in microns, not meters (and area needs to be specified in microns squared, not meters squared).Sudharsan S
01/05/2022, 3:51 PMTim Edwards
01/05/2022, 6:04 PMFelipe Vianna
03/02/2022, 9:49 PMError: no model available for w= 9.0000000e+00 l= 1.5000000e-07.
I am aware that parameters must be supplied in microns, hence W is specified as 9, L is specified as 0.15. Still, the error changes the decimal for both parameters - seems to be the same as @User reported.
I'm only sweeping W in this case:
alter @m.xm1.msky130_fd_pr__nfet_01v8[w] = wn_loop
Even though the error happens, it seems that the alter statement has some effect, because I get different results that are appropriate in between each other.
I wouldn't have worried much about the error, but apparently, for a given width Wx, I'm getting slightly different (but non-negligible) results in a single DC simulation in comparison to multiple DC simulations that sweep the width with alter param (in which Wx is included).
Is anyone aware of this and can help? Thanks in advanceFelipe Vianna
03/02/2022, 10:17 PMStefan Schippers
03/03/2022, 9:44 AMTim Edwards
03/03/2022, 1:45 PMFelipe Vianna
03/04/2022, 12:46 AMxm0 ... w=1.6
) has some strange effect over the DC response of my inverter. Even though I alter the transistor width before I run the first DC analysis of my parametric sweep, I get different results depending on which W is defined in the transistor subckt element. Sometimes the simulation fails for some of the W sweep values, other times it just yields a different result than what would be expected if a single simulation were to be executed with that fixed W value in the element.
This behavior seems to have gotten even more out of hand in my case since I was sweeping Wp and Wn in nested while loops for a CMOS inverter, trying to find the optimal ratios that would result in Vin = Vout = VDD/2, hence larger noise margins, for different PMOS and NMOS widths.
Feel free to take a look, here's the spice netlist (+@Stefan Schippers):
'CMOS Inverter DC analysis'
**********************************
* Models
**********************************
.lib "/home/frbvianna/sky130/skywater-pdk-libs-sky130_fd_pr/models/sky130.lib.spice" tt
**********************************
* Parameters
**********************************
* .param <param>=<value>
.param wp = 1.5
.param wn = 0.6
**********************************
* Options
**********************************
.option temp=27C
* .option scale=1e-6
**********************************
* Circuit
**********************************
Vdd vdd gnd dc=1.8
xm0 out in vdd vdd sky130_fd_pr__pfet_01v8
+ w={wp} l=0.15
xm1 out in gnd gnd sky130_fd_pr__nfet_01v8
+ w={wn} l=0.15
**********************************
* Control
**********************************
.control
destroy all
* Loop Wp and Wn (op), ratio 1 to 5
let wp_step = 0.05
let wn_begin = 0.6
let wn_end = 1.8
let wn_step = 0.15
let wn_loop = wn_begin
while wn_loop le wn_end
let wp_loop = 1*wn_loop
alter @m.xm1.msky130_fd_pr__nfet_01v8[w] = wn_loop
while wp_loop le 5*wn_loop
alter @m.xm0.msky130_fd_pr__pfet_01v8[w] = wp_loop
op
let v_diff = v(out) - v(in)
let ratio = wp_loop/wn_loop
* $W_P/W_N$ $V_{OUT}-V_{IN}$
echo
+ $&ratio
+ $&v_diff
+ >> inverter/v_diff_w_l.dat
let wp_loop = wp_loop + wp_step
end
let wn_loop = wn_loop + wn_step
echo >> inverter/v_diff_w_l.dat
end
.endc
**********************************
* EOF
**********************************
.end
v_diff
gives v(out) - v(in)
which would be near 0 for a symmetric inverter with an optimal Wp/Wn ratio.
First Wp/Wn ratio of the sweep is 1, given by Wp = Wn = 0.6.
By changing to .param wp=1.5
in the circuit definition (larger than the initial sweep value of wp_loop=0.6
) you can already see v_diff
changing in that ratio 1 iteration.
Furthermore, even if wp and wn defined in .param
match the values for the first parametric sweep iteration, in my nested loop scenario, wn
is then altered and it seems that the subsequent iterations (wn != 0.6) will then yield incorrect results.
I am working on a Python wrapper to perform this same simulation without nested whiles to see if I can get the expected results.Tim Edwards
03/04/2022, 1:41 AMFelipe Vianna
03/04/2022, 10:50 PMFelipe Vianna
03/04/2022, 10:55 PMError: no model available for w= 4.0500000e+00 l= 1.5000000e-07.
Stefan Schippers
03/05/2022, 10:10 AMFelipe Vianna
03/05/2022, 4:41 PMStefan Schippers
03/05/2022, 9:23 PMFelipe Vianna
03/05/2022, 9:28 PM4.05u
) the simulation will actually failLinen is a search-engine friendly community platform. We offer integrations with existing Slack/Discord communities and make those conversations Google-searchable.
Powered by