Stefan Schippers
09/09/2022, 5:06 PMngspice
and (serial) Xyce
on a big design.
Note: this test circuit does not use sky130 models, but uses a generic 180nm Cmos process at 1.5V. Design has only 1 LV pmos and 1 LV nmos, only two models, BSIM3 level=49.
The example is in the standard (standalone) xschem test schematics, ..../share/xschem/xschem_library/rom8k/rom8k.sch
, it is a 16KByte Rom Macro cell.
Part of the rom array is populated with actual transistors so some read cycles are simulated and data is read out.
Circuit statistics:
***** Device Count Summary ...
C level 1 (Capacitor) 1035
M level 9 (BSIM3) 14287
V level 1 (Independent Voltage Source) 22
--------------------------------------------
Total Devices 15344
***** Setting up matrix structure...
***** Number of Unknowns = 6677
Xyce (serial) report:
***** Total Simulation Solvers Run Time: 977.709 seconds
***** Total Elapsed Run Time: 980.18 seconds
*****
***** End of Xyce(TM) Simulation
*****
Ngspice report:
Total elapsed time (seconds) = 771.449
So there is no much difference in execution time (at least no orders of magnitude).
Simulation results are absolutely correct for both.
I have set up the schematic such that it simulates unchanged both in ngspice and Xyce.
@Steven Bos it would be nice if you can test this on your parallel Xyce
installation.
You need to run xschem as standalone (so not in a directory with sky130 xschemrc file), get the above models file and place it in the simulation directory as explained in the COMMANDS element of the schematic. Also you need to place the stimuli file from
.../share/doc/xschem/rom8k/stimuli.rom8k
into the simulation directory and follow instructions in the COMMANDS element.
I have done some updates to xschem for better Xyce integration and more error checks (for example against corrupted or malformed .raw files) so please update if you want to try this test.
CC (@Eric Keiter @Harald Pretl @Tim Edwards)Steven Bos
09/09/2022, 5:45 PMStefan Schippers
09/09/2022, 8:57 PM--enable-openmp
From ngspice manual,
"To state it clearly: OpenMP is installed inside the model equations of a particular model.
It is available in BSIM3 versions 3.3.0 and 3.2.4, but not in any other BSIM3 model,
in BSIM4 versions 4.5, 4.6.5, 4.7 or 4.8, but not in any other BSIM4 model".Steven Bos
09/09/2022, 9:01 PMSteven Bos
09/09/2022, 9:03 PMStefan Schippers
09/09/2022, 9:07 PMSteven Bos
09/09/2022, 9:07 PMSteven Bos
09/09/2022, 9:08 PMStefan Schippers
09/09/2022, 9:10 PMStefan Schippers
09/09/2022, 9:11 PMSteven Bos
09/09/2022, 9:11 PMStefan Schippers
09/09/2022, 9:11 PMSteven Bos
09/09/2022, 9:12 PMSteven Bos
09/09/2022, 9:15 PMStefan Schippers
09/09/2022, 9:16 PMSteven Bos
09/09/2022, 9:19 PMSteven Bos
09/09/2022, 9:20 PMSteven Bos
09/09/2022, 9:20 PMStefan Schippers
09/09/2022, 9:20 PMStefan Schippers
09/09/2022, 9:21 PMStefan Schippers
09/09/2022, 9:23 PMStefan Schippers
09/09/2022, 9:23 PMSteven Bos
09/09/2022, 9:24 PMStefan Schippers
09/09/2022, 9:26 PMSteven Bos
09/09/2022, 9:28 PMSteven Bos
09/09/2022, 9:28 PMSteven Bos
09/09/2022, 9:29 PMStefan Schippers
09/09/2022, 9:29 PMSteven Bos
09/09/2022, 9:29 PMSteven Bos
09/09/2022, 9:29 PMStefan Schippers
09/09/2022, 9:30 PMStefan Schippers
09/09/2022, 9:32 PMSteven Bos
09/09/2022, 9:32 PMSteven Bos
09/09/2022, 9:32 PMSteven Bos
09/09/2022, 9:34 PMStefan Schippers
09/09/2022, 9:35 PMTranslate
Steven Bos
09/09/2022, 9:35 PMStefan Schippers
09/09/2022, 9:38 PMUtile
things is a side project i used to create complex stimuli for spice. You can describe waveforms in a more convenient way, declare busses and use macros. The help button in the Utile window explains the language. When doing Translate
everything is translated into single bit voltage sources with PWL functions. You can also set signals to Hi-Z state so it is quite useful for complex designs.Steven Bos
09/09/2022, 9:41 PMSteven Bos
09/09/2022, 9:43 PMStefan Schippers
09/09/2022, 9:43 PM; add en oe
;=====================
cycle 0000 1 1
Steven Bos
09/09/2022, 9:44 PMSteven Bos
09/09/2022, 9:44 PMSteven Bos
09/09/2022, 9:45 PMStefan Schippers
09/09/2022, 9:45 PMStefan Schippers
09/09/2022, 9:46 PMSteven Bos
09/09/2022, 9:47 PMStefan Schippers
09/09/2022, 9:47 PMStefan Schippers
09/09/2022, 9:48 PMSteven Bos
09/09/2022, 9:48 PMEric Keiter
09/09/2022, 9:49 PMStefan Schippers
09/09/2022, 9:49 PMStefan Schippers
09/09/2022, 9:49 PMStefan Schippers
09/09/2022, 9:50 PMEric Keiter
09/09/2022, 9:50 PMEric Keiter
09/09/2022, 9:50 PMSteven Bos
09/09/2022, 9:50 PMStefan Schippers
09/09/2022, 9:50 PMEric Keiter
09/09/2022, 9:50 PMSteven Bos
09/09/2022, 9:51 PMEric Keiter
09/09/2022, 9:51 PMSteven Bos
09/09/2022, 9:51 PMEric Keiter
09/09/2022, 9:51 PMStefan Schippers
09/09/2022, 9:51 PMEric Keiter
09/09/2022, 9:51 PMEric Keiter
09/09/2022, 9:53 PMEric Keiter
09/09/2022, 9:55 PMSteven Bos
09/09/2022, 9:56 PMEric Keiter
09/09/2022, 9:56 PMSteven Bos
09/09/2022, 9:56 PMStefan Schippers
09/09/2022, 9:56 PMStefan Schippers
09/09/2022, 9:58 PMStefan Schippers
09/09/2022, 9:58 PMEric Keiter
09/09/2022, 9:59 PMSteven Bos
09/09/2022, 9:59 PMStefan Schippers
09/09/2022, 9:59 PMStefan Schippers
09/09/2022, 10:00 PMEric Keiter
09/09/2022, 10:00 PMStefan Schippers
09/09/2022, 10:00 PMStefan Schippers
09/09/2022, 10:03 PM.options SCALE=0.1
i didn't see any mention of it in the manual but i believe it works. SImularion would not succeed with 10x sizes.
BTW also sky130 uses a SCALE factor, so it definitely is accepted by Xyce.Eric Keiter
09/09/2022, 10:04 PMSteven Bos
09/09/2022, 10:05 PMStefan Schippers
09/09/2022, 10:06 PMSteven Bos
09/09/2022, 10:06 PMSteven Bos
09/09/2022, 10:07 PMSteven Bos
09/09/2022, 10:08 PMStefan Schippers
09/09/2022, 10:10 PMStefan Schippers
09/09/2022, 10:11 PMSteven Bos
09/09/2022, 10:12 PMStefan Schippers
09/09/2022, 10:13 PMStefan Schippers
09/09/2022, 10:13 PMSteven Bos
09/09/2022, 10:15 PMSteven Bos
09/09/2022, 10:16 PMSteven Bos
09/09/2022, 10:16 PMStefan Schippers
09/09/2022, 10:16 PMEric Keiter
09/09/2022, 10:17 PMStefan Schippers
09/09/2022, 10:17 PMStefan Schippers
09/09/2022, 10:18 PMSteven Bos
09/09/2022, 10:18 PMSteven Bos
09/09/2022, 10:18 PMEric Keiter
09/09/2022, 10:19 PMSteven Bos
09/09/2022, 10:19 PMStefan Schippers
09/09/2022, 10:19 PMSteven Bos
09/09/2022, 10:19 PMStefan Schippers
09/09/2022, 10:20 PMSteven Bos
09/09/2022, 10:20 PMEric Keiter
09/09/2022, 10:20 PMEric Keiter
09/09/2022, 10:21 PMEric Keiter
09/09/2022, 10:21 PMStefan Schippers
09/09/2022, 10:21 PMEric Keiter
09/09/2022, 10:21 PMSteven Bos
09/09/2022, 10:21 PMEric Keiter
09/09/2022, 10:22 PMEric Keiter
09/09/2022, 10:22 PMEric Keiter
09/09/2022, 10:22 PMEric Keiter
09/09/2022, 10:23 PMSteven Bos
09/09/2022, 10:25 PMEric Keiter
09/09/2022, 10:25 PMStefan Schippers
09/09/2022, 10:25 PMSteven Bos
09/09/2022, 10:26 PMStefan Schippers
09/09/2022, 10:26 PMEric Keiter
09/09/2022, 10:26 PMStefan Schippers
09/09/2022, 10:27 PMStefan Schippers
09/09/2022, 10:27 PMSteven Bos
09/09/2022, 10:28 PMEric Keiter
09/09/2022, 10:28 PMStefan Schippers
09/09/2022, 10:28 PMSteven Bos
09/09/2022, 10:28 PMStefan Schippers
09/09/2022, 10:29 PMSteven Bos
09/09/2022, 10:30 PMSteven Bos
09/09/2022, 10:31 PMEric Keiter
09/09/2022, 10:31 PMSteven Bos
09/09/2022, 10:31 PMEric Keiter
09/09/2022, 10:32 PMStefan Schippers
09/09/2022, 10:32 PMEric Keiter
09/09/2022, 10:33 PMStefan Schippers
09/09/2022, 10:33 PMSteven Bos
09/09/2022, 10:33 PMEric Keiter
09/09/2022, 10:33 PMSteven Bos
09/09/2022, 10:34 PMEric Keiter
09/09/2022, 10:34 PMStefan Schippers
09/09/2022, 10:36 PMEric Keiter
09/09/2022, 10:36 PMSteven Bos
09/09/2022, 10:36 PMEric Keiter
09/09/2022, 10:37 PMEric Keiter
09/09/2022, 10:38 PMSteven Bos
09/09/2022, 10:39 PMEric Keiter
09/09/2022, 10:39 PMSteven Bos
09/09/2022, 10:40 PMEric Keiter
09/09/2022, 10:40 PMEric Keiter
09/09/2022, 10:41 PMEric Keiter
09/09/2022, 10:41 PMSteven Bos
09/09/2022, 10:42 PMStefan Schippers
09/09/2022, 10:42 PMSteven Bos
09/09/2022, 10:42 PMSteven Bos
09/09/2022, 10:43 PMEric Keiter
09/09/2022, 10:43 PMSteven Bos
09/09/2022, 10:44 PMEric Keiter
09/09/2022, 10:45 PMEric Keiter
09/09/2022, 10:45 PMSteven Bos
09/09/2022, 10:45 PMSteven Bos
09/09/2022, 10:47 PMStefan Schippers
09/09/2022, 10:47 PMSteven Bos
09/09/2022, 10:49 PMSteven Bos
09/09/2022, 11:04 PMStefan Schippers
09/09/2022, 11:34 PMStefan Schippers
09/09/2022, 11:47 PMSteven Bos
09/09/2022, 11:52 PMSteven Bos
09/09/2022, 11:56 PMSteven Bos
09/09/2022, 11:56 PMSteven Bos
09/10/2022, 12:05 AMStefan Schippers
09/10/2022, 12:12 AMStefan Schippers
09/10/2022, 12:13 AMSteven Bos
09/10/2022, 12:15 AMStefan Schippers
09/10/2022, 12:15 AMStefan Schippers
09/10/2022, 12:16 AMSteven Bos
09/10/2022, 12:16 AMStefan Schippers
09/10/2022, 12:17 AMSteven Bos
09/10/2022, 12:18 AMStefan Schippers
09/10/2022, 12:27 AMSteven Bos
09/10/2022, 12:29 AMSteven Bos
09/10/2022, 12:30 AMStefan Schippers
09/10/2022, 12:33 AMStefan Schippers
09/10/2022, 12:34 AMSteven Bos
09/10/2022, 12:36 AMStefan Schippers
09/10/2022, 12:36 AMStefan Schippers
09/10/2022, 12:37 AMSteven Bos
09/10/2022, 12:37 AMStefan Schippers
09/10/2022, 12:37 AMSteven Bos
09/10/2022, 12:38 AMStefan Schippers
09/10/2022, 12:38 AMSteven Bos
09/10/2022, 12:39 AMStefan Schippers
09/10/2022, 12:39 AMSteven Bos
09/10/2022, 12:41 AMSteven Bos
09/10/2022, 12:42 AMSteven Bos
09/10/2022, 12:45 AMStefan Schippers
09/10/2022, 1:01 AMStefan Schippers
09/10/2022, 1:12 AMStefan Schippers
09/10/2022, 8:05 AMuic
in the .tran
lines.
Also to speed up things i simulated only the first 128usec.
ngspice report:
Transient analysis time = 269.679
Total analysis time (seconds) = 271.359
Xyce serial report:
***** Total Simulation Solvers Run Time: 831.252 seconds
***** Total Elapsed Run Time: 1277.15 seconds
*****
***** End of Xyce(TM) Simulation
Results are correct for both ( out voltage = 3.3 * decimal(D[9:0]) / 1024 )
Ngspice used 2 cores (max 140% cpu usage) for solver and equation calculations. Xyce used only one core (max 100%).
Simulation time on Xyce serial was significantly higher. (cc @Eric Keiter)Stefan Schippers
09/10/2022, 8:22 AM"ERROR;
d0
d1 2 * +
d2 4 * +
d3 8 * +
d4 16 * +
d5 32 * +
d6 64 * +
d7 128 * +
d8 256 * +
d9 512 * +
1.8 /
1024 /
3.3 *
out -
"
calculates the ADC error: it calculates the theroretical voltage by summing the weighted binary bits, normalized to 1V dividing by the VCC level (1.8) and by 1024 and then normalized to 3.3V. the out
node is subtracted from the result. This error will be significant if you do mismatch simulations.Steven Bos
09/10/2022, 11:06 AMSteven Bos
09/10/2022, 11:53 AMlinsol klu
): 26s
my ngspice sims are done with your .spiceinit file in the netlist directory. But without any of the sky130 lib and corner optimization mentioned in an earlier thread.Steven Bos
09/10/2022, 12:00 PMSteven Bos
09/10/2022, 12:04 PMSteven Bos
09/10/2022, 12:14 PMSteven Bos
09/10/2022, 5:07 PMSteven Bos
09/10/2022, 5:09 PMSteven Bos
09/10/2022, 5:18 PMSteven Bos
09/10/2022, 5:19 PMSteven Bos
09/10/2022, 5:22 PMStefan Schippers
09/10/2022, 8:49 PM-r file.raw
given on command line. Without this i specify with .prin tran format=raw ...
the variables i want to save (the xschem spice_probe.sym
attached to the nets does exactly that). FOr currents i explictly save the ones i need as in:
.print tran format=raw i(vvcc) i(vsa) i(vl) i(vdec)
and these currents retain the name given on the .print line. If you remember the rom8k reloads all variables including currents, either from ngspice raw and from Xyce raw. However another thing i will do is to look for V1#branch (either upper/lower case) if search of i(v1) / I(V1) fails.Steven Bos
09/11/2022, 2:02 AMSteven Bos
09/11/2022, 2:04 AMSteven Bos
09/11/2022, 2:06 AMSteven Bos
09/11/2022, 2:17 AMStefan Schippers
09/11/2022, 7:18 AM***** Total Simulation Solvers Run Time: 51.5038 seconds
***** Total Elapsed Run Time: 89.2508 seconds
*****
***** End of Xyce(TM) Simulation
*****
However, in the ngspice file you did a '`save all`' while only selected variables are saved in Xyce. Moreover the .tran 1n 160u uic
causes Xyce to simulate and save 3164
timesteps in the raw file while ngspice saves 160000
points! (No. of Data Rows : 160819)
I changed the ngspice commands to save same variables as Xyce, set tran 50n 160u uic
and simulation completed in 55 seconds:
Total analysis time (seconds) = 24.99
Total elapsed time (seconds) = 55.076
In above run i also added .option chgtol=4e-16 method=gear
to increase precision and better integration method. This way ngspice saved 5233
points in raw file, a number that is comparable to Xyce. The simulators take different timesteps decisions. ngspice tends to use the given time step in saved file, while Xyce takes its own decision regardless of this parameter.Stefan Schippers
09/11/2022, 7:28 AMStefan Schippers
09/11/2022, 7:32 AMSteven Bos
09/11/2022, 2:13 PMSteven Bos
09/11/2022, 2:51 PMStefan Schippers
09/11/2022, 4:40 PMxky130_fd_pr/corner.sym
which feeds to ngspice only the desired corner things speed up considerably. This is of course a dirty workaround for something ngspice should fix.Stefan Schippers
09/11/2022, 4:44 PM.print tran format=raw file=... v(*)
Steven Bos
09/11/2022, 8:34 PMi(vvcc) i(vsa) i(vl) i(vdec)
by removing all the .print tran format=raw v(xctrl:LDCPB)
from the xyce spice file.
The raw file sizes are now more or less equal (~23MB), and both report almost similar variables and datapoints.
The runtime statistics reported earlier do not change, meaning Xyce serial is a fair bit slower than ngspice at 2 thread, while Xyce parallel is just as fast.Steven Bos
09/11/2022, 8:43 PMSteven Bos
09/11/2022, 8:48 PMSteven Bos
09/11/2022, 9:09 PM.tran 1ns 160us
will not result in 160k samples by xyce. This is quite magical. How is this dynamic time stepping done while at first glance, no loss of data (does it ignore redundant data points?). Can it be switched on with ngspice as well?
Changing the stepsize in the netlist such that ngspice and xyce will have the same amount of datapoints seems cheating for the comparison. The ROM_8k test has identical .tran settings which gave good results for both ngspice and xyce. Maybe that circuit has much more signal variation and thus xyce cannot do dynamic stepsize?Stefan Schippers
09/11/2022, 9:39 PMSteven Bos
09/11/2022, 9:41 PMSteven Bos
09/11/2022, 9:45 PMStefan Schippers
09/11/2022, 9:48 PMSteven Bos
09/11/2022, 9:49 PMSteven Bos
09/11/2022, 9:52 PMStefan Schippers
09/11/2022, 9:53 PM4.0220587039e-07 4.0714201077e-07 4.1701429154e-07 4.3675882466e-07 4.7624794774e-07 4.7999998287e-07
the time points in the same interval saved by ngspice are:
4.0035197912e-07 4.0055198269e-07 4.0075198626e-07 4.0095196141e-07 4.0115196498e-07 4.0135196855e-07 4.0155197212e-07 4.0175197569e-07 4.0195197926e-07 4.0215198283e-07 4.0235198639e-07 4.0255196154e-07 4.0275196511e-07 4.0295196868e-07 4.0315197225e-07 4.0335197582e-07 4.0355197939e-07 4.0375198296e-07 4.0395198653e-07 4.0415196167e-07 4.0435196524e-07 4.0455196881e-07 4.0475197238e-07 4.0495197595e-07 4.0515197952e-07 4.0535198309e-07 4.0555198666e-07 4.0575196181e-07 4.0595196538e-07 4.0615196895e-07 4.0635197252e-07 4.0655197608e-07 4.0675197965e-07 4.0695198322e-07 4.0715198679e-07 4.0735196194e-07 4.0755196551e-07 4.0775196908e-07 4.0795197265e-07 4.0815197622e-07 4.0835197979e-07 4.0855198336e-07 4.0875198692e-07 4.0895196207e-07 4.0915196564e-07 4.0935196921e-07 4.0955197278e-07 4.0975197635e-07 4.0995197992e-07 4.1015198349e-07 4.1035198706e-07 4.1055196220e-07 4.1075196577e-07 4.1095196934e-07 4.1115197291e-07 4.1135197648e-07 4.1155198005e-07 4.1175198362e-07 4.1195198719e-07 4.1215196234e-07 4.1235196591e-07 4.1255196948e-07 4.1275197304e-07 4.1295197661e-07 4.1315198018e-07 4.1335198375e-07 4.1355195890e-07 4.1375196247e-07 4.1395196604e-07 4.1415196961e-07 4.1435197318e-07 4.1455197675e-07 4.1475198032e-07 4.1495198388e-07 4.1515195903e-07 4.1535196260e-07 4.1555196617e-07 4.1575196974e-07 4.1595197331e-07 4.1615197688e-07 4.1635198045e-07 4.1655198402e-07 4.1675195916e-07 4.1695196273e-07 4.1715196630e-07 4.1735196987e-07 4.1755197344e-07 4.1775197701e-07 4.1795198058e-07 4.1815198415e-07 4.1835195930e-07 4.1855196287e-07 4.1875196644e-07 4.1895197000e-07 4.1915197357e-07 4.1935197714e-07 4.1955198071e-07 4.1975198428e-07 4.1995195943e-07 4.2015196300e-07 4.2035196657e-07 4.2055197014e-07 4.2075197371e-07 4.2095197728e-07 4.2115198085e-07 4.2135198441e-07 4.2155195956e-07 4.2175196313e-07 4.2195196670e-07 4.2215197027e-07 4.2235197384e-07 4.2255197741e-07 4.2275198098e-07 4.2295198455e-07 4.2315195969e-07 4.2335196326e-07 4.2355196683e-07 4.2375197040e-07 4.2395197397e-07 4.2415197754e-07 4.2435198111e-07 4.2455198468e-07 4.2475195983e-07 4.2495196340e-07 4.2515196697e-07 4.2535197053e-07 4.2555197410e-07 4.2575197767e-07 4.2595198124e-07 4.2615198481e-07 4.2635195996e-07 4.2655196353e-07 4.2675196710e-07 4.2695197067e-07 4.2715197424e-07 4.2735197781e-07 4.2755198137e-07 4.2775198494e-07 4.2795196009e-07 4.2815196366e-07 4.2835196723e-07 4.2855197080e-07 4.2875197437e-07 4.2895197794e-07 4.2915198151e-07 4.2935198508e-07 4.2955196022e-07 4.2975196379e-07 4.2995196736e-07 4.3015197093e-07 4.3035197450e-07 4.3055197807e-07 4.3075198164e-07 4.3095198521e-07 4.3115196036e-07 4.3135196393e-07 4.3155196749e-07 4.3175197106e-07 4.3195197463e-07 4.3215197820e-07 4.3235198177e-07 4.3255198534e-07 4.3275196049e-07 4.3295196406e-07 4.3315196763e-07 4.3335197120e-07 4.3355197477e-07 4.3375197833e-07 4.3395198190e-07 4.3415198547e-07 4.3435196062e-07 4.3455196419e-07 4.3475196776e-07 4.3495197133e-07 4.3515197490e-07 4.3535197847e-07 4.3555198204e-07 4.3575198561e-07 4.3595196075e-07 4.3615196432e-07 4.3635196789e-07 4.3655197146e-07 4.3675197503e-07 4.3695197860e-07 4.3715198217e-07 4.3735198574e-07 4.3755196089e-07 4.3775196445e-07 4.3795196802e-07 4.3815197159e-07 4.3835197516e-07 4.3855197873e-07 4.3875198230e-07 4.3895198587e-07 4.3915196102e-07 4.3935196459e-07 4.3955196816e-07 4.3975197173e-07 4.3995197530e-07 4.4015197886e-07 4.4035198243e-07 4.4055198600e-07 4.4075196115e-07 4.4095196472e-07 4.4115196829e-07 4.4135197186e-07 4.4155197543e-07 4.4175197900e-07 4.4195198257e-07 4.4215198614e-07 4.4235196128e-07 4.4255196485e-07 4.4275196842e-07 4.4295197199e-07 4.4315197556e-07 4.4335197913e-07 4.4355198270e-07 4.4375198627e-07 4.4395196142e-07 4.4415196498e-07 4.4435196855e-07 4.4455197212e-07 4.4475197569e-07 4.4495197926e-07 4.4515198283e-07 4.4535198640e-07 4.4555196155e-07 4.4575196512e-07 4.4595196869e-07 4.4615197226e-07 4.4635197582e-07 4.4655197939e-07 4.4675198296e-07 4.4695198653e-07 4.4715196168e-07 4.4735196525e-07 4.4755196882e-07 4.4775197239e-07 4.4795197596e-07 4.4815197953e-07 4.4835198310e-07 4.4855198666e-07 4.4875196181e-07 4.4895196538e-07 4.4915196895e-07 4.4935197252e-07 4.4955197609e-07 4.4975197966e-07 4.4995198323e-07 4.5015198680e-07 4.5035196194e-07 4.5055196551e-07 4.5075196908e-07 4.5095197265e-07 4.5115197622e-07 4.5135197979e-07 4.5155198336e-07 4.5175198693e-07 4.5195196208e-07 4.5215196565e-07 4.5235196922e-07 4.5255197278e-07 4.5275197635e-07 4.5295197992e-07 4.5315198349e-07 4.5335198706e-07 4.5355196221e-07 4.5375196578e-07 4.5395196935e-07 4.5415197292e-07 4.5435197649e-07 4.5455198006e-07 4.5475198363e-07 4.5495198719e-07 4.5515196234e-07 4.5535196591e-07 4.5555196948e-07 4.5575197305e-07 4.5595197662e-07 4.5615198019e-07 4.5635198376e-07 4.5655195891e-07 4.5675196247e-07 4.5695196604e-07 4.5715196961e-07 4.5735197318e-07 4.5755197675e-07 4.5775198032e-07 4.5795198389e-07 4.5815195904e-07 4.5835196261e-07 4.5855196618e-07 4.5875196975e-07 4.5895197331e-07 4.5915197688e-07 4.5935198045e-07 4.5955198402e-07 4.5975195917e-07 4.5995196274e-07 4.6015196631e-07 4.6035196988e-07 4.6055197345e-07 4.6075197702e-07 4.6095198059e-07 4.6115198415e-07 4.6135195930e-07 4.6155196287e-07 4.6175196644e-07 4.6195197001e-07 4.6215197358e-07 4.6235197715e-07 4.6255198072e-07 4.6275198429e-07 4.6295195943e-07 4.6315196300e-07 4.6335196657e-07 4.6355197014e-07 4.6375197371e-07 4.6395197728e-07 4.6415198085e-07 4.6435198442e-07 4.6455195957e-07 4.6475196314e-07 4.6495196671e-07 4.6515197027e-07 4.6535197384e-07 4.6555197741e-07 4.6575198098e-07 4.6595198455e-07 4.6615195970e-07 4.6635196327e-07 4.6655196684e-07 4.6675197041e-07 4.6695197398e-07 4.6715197755e-07 4.6735198111e-07 4.6755198468e-07 4.6775195983e-07 4.6795196340e-07 4.6815196697e-07 4.6835197054e-07 4.6855197411e-07 4.6875197768e-07 4.6895198125e-07 4.6915198482e-07 4.6935195996e-07 4.6955196353e-07 4.6975196710e-07 4.6995197067e-07 4.7015197424e-07 4.7035197781e-07 4.7055198138e-07 4.7075198495e-07 4.7095196010e-07 4.7115196367e-07 4.7135196724e-07 4.7155197080e-07 4.7175197437e-07 4.7195197794e-07 4.7215198151e-07 4.7235198508e-07 4.7255196023e-07 4.7275196380e-07 4.7295196737e-07 4.7315197094e-07 4.7335197451e-07 4.7355197808e-07 4.7375198164e-07 4.7395198521e-07 4.7415196036e-07 4.7435196393e-07 4.7455196750e-07 4.7475197107e-07 4.7495197464e-07 4.7515197821e-07 4.7535198178e-07 4.7555198535e-07 4.7575196049e-07 4.7595196406e-07 4.7615196763e-07 4.7635197120e-07 4.7655197477e-07 4.7675197834e-07 4.7695198191e-07 4.7715195706e-07 4.7735198905e-07 4.7755196420e-07 4.7775199619e-07 4.7795197133e-07 4.7815194648e-07 4.7835197847e-07 4.7855195362e-07 4.7875198561e-07 4.7895196076e-07 4.7915199275e-07 4.7935196790e-07 4.7955199989e-07 4.7975197504e-07 4.7995195018e-07 4.7999998287e-07
Steven Bos
09/11/2022, 9:55 PM.print tran format=raw v(xctrl:LDCPB)
Steven Bos
09/11/2022, 9:58 PMSteven Bos
09/11/2022, 10:01 PMStefan Schippers
09/11/2022, 10:04 PMSteven Bos
09/11/2022, 10:06 PM.print tran format=raw v(xctrl:LDCPB)
otherwise the xyce raw file exploded to 222 MB (10x), see earlier threads. Without these lines, both have near identical variables and datapointsStefan Schippers
09/11/2022, 10:06 PMSteven Bos
09/11/2022, 10:07 PMStefan Schippers
09/11/2022, 10:12 PMSteven Bos
09/11/2022, 10:15 PMStefan Schippers
09/11/2022, 10:17 PMStefan Schippers
09/11/2022, 10:18 PMSteven Bos
09/11/2022, 10:19 PMSteven Bos
09/11/2022, 10:21 PMuse simulation dir under current schemtatic dir
Steven Bos
09/11/2022, 10:33 PM.print tran format=raw i(vvcc) i(vsa) i(vl) i(vdec)
Steven Bos
09/11/2022, 10:34 PMsave tran i(vvcc) i(vsa) i(vl) i(vdec)
used in the ngspice netlistStefan Schippers
09/11/2022, 10:38 PMSteven Bos
09/11/2022, 10:43 PMStefan Schippers
09/12/2022, 1:10 PMsky130_tests/test_carry_lookahead.sch
. This example does a comparison between a ripple carry 32 bit and 256 bit adder vs 32 bit and 256 bit carry lookahead adders.
The design has 27k devices and 80k unknowns:
***** Device Count Summary ...
C level 1 (Capacitor) 3763
M level 14 (BSIM4) 23010
V level 1 (Independent Voltage Source) 515
--------------------------------------------
Total Devices 27288
***** Setting up matrix structure...
***** Number of Unknowns = 80343
ngspice and Xyce take approx the same time for simulating this.
Ngspice:
Total analysis time (seconds) = 2710.63
Total elapsed time (seconds) = 4191.515
Xyce:
***** Total Simulation Solvers Run Time: 2103.34 seconds
***** Total Elapsed Run Time: 4147.71 seconds
*****
***** End of Xyce(TM) Simulation
Steven Bos
09/12/2022, 3:55 PMStefan Schippers
09/12/2022, 4:20 PMsky130_tests/test_comparator,.sch
Eric Keiter
09/12/2022, 4:31 PMEric Keiter
09/12/2022, 4:32 PMSteven Bos
09/12/2022, 4:33 PMEric Keiter
09/12/2022, 4:34 PM.print tran format=raw v(…)
in the netlist, you can reduce the number of outputs to only be the ones you want. Also, you can then include outputs that aren’t in the solution vector (like a lot of lead currents).Eric Keiter
09/12/2022, 4:36 PMEric Keiter
09/12/2022, 4:37 PMSteven Bos
09/12/2022, 4:38 PMSteven Bos
09/12/2022, 4:41 PMEric Keiter
09/12/2022, 4:42 PM.OPTIONS OUTPUT INITIAL_INTERVAL=1e-3
If you do this, then it will output every 1e-3 seconds. It is also possible to have different intervals for different windows of time (although I don’t recall the precise command at the moment)Eric Keiter
09/12/2022, 4:46 PMEric Keiter
09/12/2022, 4:46 PMEric Keiter
09/12/2022, 4:49 PMEric Keiter
09/12/2022, 4:50 PMEric Keiter
09/12/2022, 4:51 PMEric Keiter
09/12/2022, 4:51 PMEric Keiter
09/12/2022, 4:52 PMEric Keiter
09/12/2022, 4:53 PMSteven Bos
09/12/2022, 4:55 PMEric Keiter
09/12/2022, 4:55 PMEric Keiter
09/12/2022, 4:56 PMSteven Bos
09/12/2022, 4:57 PMSteven Bos
09/12/2022, 4:57 PMEric Keiter
09/12/2022, 4:58 PMEric Keiter
09/12/2022, 4:58 PMSteven Bos
09/12/2022, 5:27 PMEric Keiter
09/12/2022, 11:39 PMEric Keiter
09/12/2022, 11:42 PMEric Keiter
09/12/2022, 11:42 PMEric Keiter
09/12/2022, 11:43 PMEric Keiter
09/12/2022, 11:44 PMSteven Bos
09/13/2022, 2:38 PMSteven Bos
09/13/2022, 3:16 PMstimuli_test_carry_lookahead.cir
file. Could you commit that?Stefan Schippers
09/13/2022, 3:35 PMSteven Bos
09/13/2022, 4:00 PMStefan Schippers
09/13/2022, 4:10 PMStefan Schippers
09/13/2022, 4:32 PMEric Keiter
09/13/2022, 5:14 PMSteven Bos
09/13/2022, 5:17 PMEric Keiter
09/13/2022, 5:21 PMSteven Bos
09/13/2022, 5:23 PMEric Keiter
09/13/2022, 5:23 PMSteven Bos
09/13/2022, 5:24 PMEric Keiter
09/13/2022, 5:25 PMEric Keiter
09/13/2022, 5:26 PMSteven Bos
09/13/2022, 5:27 PMEric Keiter
09/13/2022, 5:27 PMEric Keiter
09/13/2022, 5:30 PM.options timeint NEWLTE
and .options timeint ERROPTION
The first one (NEWLTE) allows you to set what the “reference” used by RELTOL. The other one (ERROPTION) allows you to completely disable local trunction error, and only rely on nonlinear solver behavior to set the time step. This second one (ERROPTION) is mostly a last resort when someone has a really difficult circuit that won’t run otherwise. But it often runs very fast (albeit probably less accurately).Eric Keiter
09/13/2022, 5:32 PM.options timeint NEWLTE
can be set to 0,1,2 or 3. The meaning is as follows:Steven Bos
09/13/2022, 5:32 PMSteven Bos
09/13/2022, 5:39 PMStefan Schippers
09/13/2022, 5:49 PM.print tran format=raw file=carry_lookahead_xyce.spice.raw v(*)
I am restructuring all examples to run without the -r command line option, this example was not completed yet.Stefan Schippers
09/13/2022, 9:27 PMtest_carry_lookahead
example has 80k unknowns, using -r will save all internal nodes, which are not interesting and will generate a huge raw file. the .print above just saves the top level voltages which is enough for the test.Stefan Schippers
09/14/2022, 9:53 PMulimit -a
, though it is usually unrestricted as far as i know. If using a virtual machine / WSL try to see if there are restrictions. I am not familiar with these, so can not help much. If everything is set up correctly then it might be a ngspice problem.Eric Keiter
09/14/2022, 9:53 PMEric Keiter
09/14/2022, 9:55 PMEric Keiter
09/14/2022, 9:55 PMEric Keiter
09/14/2022, 9:55 PMStefan Schippers
09/14/2022, 9:59 PMEric Keiter
09/14/2022, 10:00 PMEric Keiter
09/14/2022, 10:00 PMEric Keiter
09/14/2022, 10:01 PMStefan Schippers
09/14/2022, 10:05 PMStefan Schippers
09/14/2022, 10:07 PMEric Keiter
09/14/2022, 10:08 PMEric Keiter
09/14/2022, 10:09 PMStefan Schippers
09/14/2022, 10:12 PMTotal analysis time (seconds) = 2710.63
Total elapsed time (seconds) = 4191.515
Xyce:
***** Total Simulation Solvers Run Time: 2103.34 seconds
***** Total Elapsed Run Time: 4147.71 seconds
*****
***** End of Xyce(TM) Simulation
so not very different. Results were good for both and raw sizes were comparable (Xyce aves less timepoints when circuit is idle, ngspice somewhat more).Eric Keiter
09/14/2022, 10:13 PMStefan Schippers
09/14/2022, 10:13 PMSteven Bos
09/15/2022, 7:24 AMSteven Bos
09/15/2022, 7:25 AMSteven Bos
09/15/2022, 7:26 AMSteven Bos
09/15/2022, 7:52 AM.options LINSOL type=klu
and see how it performs. BTW all test we do are open source and are either shared here or in the xschem repo. I am thinking about a simulator benchmark/test suite probably as a separate repo where all the schematics are centralized and users can submit PR of their own schematics. But before that a good test method is needed. I can imagine parsing run time , file I/O, solving, total run time good candidatesSteven Bos
09/15/2022, 7:59 AM.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
but this test does a bit more with
.include /usr/local/share/pdk/sky130A/libs.ref/sky130_fd_sc_hd/spice/sky130_fd_sc_hd.spice
.include /usr/local/share/pdk/sky130A/libs.tech/ngspice/corners/tt.spice
.include /usr/local/share/pdk/sky130A/libs.tech/ngspice/r+c/res_typical__cap_typical.spice
.include /usr/local/share/pdk/sky130A/libs.tech/ngspice/r+c/res_typical__cap_typical__lin.spice
.include /usr/local/share/pdk/sky130A/libs.tech/ngspice/corners/tt/specialized_cells.spice
Stefan Schippers
09/15/2022, 8:37 AMsky130_fd_pr/corner.sym
. (if you are using my test it is probably alrready done). Also ensure you have the .spiceinit
file in the simulation directory with following content:
set ngbehavior=hsa
set ng_nomodcheck
May be the 2nd line does help, not sure.Stefan Schippers
09/15/2022, 8:42 AMSteven Bos
09/15/2022, 3:29 PMset ng_nomodcheck
line) memory never exceeded 1.8 GB.
The result:
Ngspice 2 threads 1458s (773s) and raw file 1381 (1351)Steven Bos
09/15/2022, 3:36 PMSteven Bos
09/15/2022, 4:01 PMSteven Bos
09/15/2022, 4:07 PMEric Keiter
09/15/2022, 4:37 PMEric Keiter
09/15/2022, 4:39 PMEric Keiter
09/15/2022, 4:44 PMSteven Bos
09/15/2022, 7:05 PMSteven Bos
09/15/2022, 7:13 PMEric Keiter
09/15/2022, 10:16 PMSteven Bos
09/16/2022, 1:35 PMStefan Schippers
09/16/2022, 1:41 PM-r
flag it not only forces raw writing, it also saves all variables if no .save
lines are present in the netlist. This is (i believe) different from Xyce, which is saving everything if -r
is specified, even if .print
lines are present in the netlist.
@Steven Bos I found a very different behavior between ngspice and Xyce if doing a .dc analysis and some capacitors with a IC=.. condition are present in the netlist.
Ngspice removes all capacitors (and shorts all inductors) in DC analysis (this makes sense since frequency is 0)
Xyce replaces capacitors with an IC condition with voltage sources with value equal to the IC voltage in a .DC simulation.
This is something we must be very careful about.
IC conditions are typically used in transient analysis to define an initial state, In my experience nobody did care about IC conditions if doing a DC analysis, but for Xyce it affects DC results.
This is the behavior described in the Xyce reference manual:
"If one is doing a transient with DC operating point calculation or a DC operating point analysis, the initial condition is applied by inserting a voltage source across the capacitor to force the operating point to find a solution with the capacitor charged to the specific voltage. The resulting operating point will be one that is consistent with the capacitor having the given voltage in steady state".Steven Bos
09/16/2022, 3:12 PMKunal
09/18/2022, 5:11 AMKunal
09/18/2022, 5:17 AM