Hello, I have a problem. My simulation in xschem is taking too much time. I ran it for a week, but t...
c
Hello, I have a problem. My simulation in xschem is taking too much time. I ran it for a week, but the simulation didn't even start. I have approximately 10,000 transistors, and I believe that's too many. Do you have any ideas on how to simplify the model I'm using for these transistors ? thanks for your help.
đź‘€ 2
s
are you using a single N and a single P transistor type? 1.8V?
How much RAM does your system have?
j
If you pardon my curiosity: what brought the project to use many transistors? • so many because a lot are put in parallel/series to handle a larger current/voltage? -> would a more complex model of the whole aggregated component allow to take the gate count lower? • so many because the analog circuit became rather complex, with many submodules -> simulating the modules separately? • so many replicated modules that multiply the number of transistors in total -> simulating only a single module? • simulating a digital logic in an analog simulator -> validating the analog part with a few gates, and run a digital simulation separately? • the project is mixing a digital and analog part, and you'd wish to validate the analog part as driven by the digital part? -> some mixed simulation with the digital part having a digital simulation, and analog part an analog one?
Some advise I had for the context of FPGA simulation for large project, was to implement software doing what the hardware does: very high-level simulation, and only simulate the hardware for one piece of the project at a time, with the rest emulated by software.
i.e.: it might be much shorter to simulate the whole project one slice at a time than everything together.
in particular if there are replicated modules, which only need one simulation for all of them.
sorry for not being able to help with any applicable knowledge from me here!
a
@Charly Meyer My advise to do the following to simulate such a circuit: • Enable threading in NG-Spice to make the simulation faster. • Use RAW output without
.control
statements make NG-spice run in RAW mode. This will remove a lot of the limit on RAM requirement. • If this is a large digital design. I would rather use a digital simulation and do abstractions at different sections of the design.
🌍 1
c
Thank you for your interest. Yes, I need to explan more. My goal is to design a digital circuit at the transistor level. The reason for that is to reduce power consumption, and I am using 0.68V instead of 1.8V. The VHDL and Verilog circuits have been created and successfully simulated. I am utilizing the SkyWater technology in the 130nm process.
Moreover, I do not use a clock, so it is impossible to design this circuit using Verilog (with OpenLANE, for instance). My goal is just to verify if the digital behavior is good or not. I use another method for the time propagation of signals.
And I have 32 Gb of RAM. Is it possible to have 1Tb of RAM but not for free.
y
Sounds like you're not getting past DC operating point which isn't surprising given the number of transistors in digital gates. You could try skipping calculating DC operating point by adding 'uic' to the tran command. You could also consider ramping the supply too
🌍 2
🙌 2
a
@yrrapt Good point.
e
Also make sure you’re spice engine is configured correctly for the PDK. That can make a huge difference. I.e. https://ngspice.sourceforge.io/applic.html
🌍 1
Also, 10K devices is not out of reach for a properly configured machine with enough memory. The ngspice example has one test with “15000 MOS transistors (BSIM4v5 model) and 82000 passives (R and C).” and finishes in a couple of minutes.
🌍 1
j
If it is a 1-time computation rather than something to do regularly, it could also be worth considering lending some very RAM-ful server.
For a few minutes of computation, that could be not so expensive.
So after more optimisations are done, it could move things from "almost there" to "we got it"
Interesting challenge by the way, and when I think of it, that's exactly an use case for simulating a digital circuit with an analog simulator!
Getting the analog behavior out of digital circuit... If still trying to build a simplified model of power usage, some number of on/off switch per time unit maybe, it could be possible to run the model digitally, and record the number of 1 -> 0 and 0 -> 1 transitions of various transistors. The model could be checked with circuits small enough to fit SPICE, then used for the whole chip.
That would not allow to check that some power rail being bit too resistive in a particular context or other subtle analog behaviors of digital circuits. :S
c
Thank you @yrrapt*.* I tried to launch the simulation without OP. I had already tried to do that, but I forgot to include "uic". The simulation was launched approximately 40 minutes after the initialization. The simulation takes a lot of time, about 1 hour for each clock tick.
a
This problem has come up for several designers. Based on painful past experience this is usually caused when GMINDC is similar between N and PMOS and the simulator struggles to converge on bistable (latchs, flops, sram etc) elements. 1 hour per clock tick would imply that maybe your design is paging in simulation or your simulation timestep is set very small versus your clock tick. What is your clock frequency and what is the timestep in the sim?
r
@Charly Meyer If your supply is only 0.68V, your PMOS devices are operating in the sub-threshold region (Vgs < Vth), assuming you’re using standard 1.8V PMOS devices from SKY130. The simulator/model has harder time converging because of this, based on what I’ve seen. Have you tried to raise the supply to 1.8V as a sanity check? It should simulate faster. I know it’s not a solution but if it does simulate faster at 1.8V, you know what the issue is.
c
@Eric Smith, How do you simulate the netlist containing 15,000 transistors? Do you make any changes? I attempted to directly run this netlist on NGspice (compiled with KLU) on Windows, but it takes a significant amount of time, more than just a couple of minutes. Could you please provide some guidance or suggestions on how to improve the simulation efficiency? Thank you.
I finally completed the simulation (5 clock cycles and initialization) in less than 1 hour and 30 minutes. I achieved this by using the following command: ".tran 100n 7u uic" and modifying the transistor model to level 1. Additionally, I had previously applied a voltage at 1.8V instead 0.68V (only to verify the overall behavior).
👍 1
h
Indeed this circuit would be an interesting test case for ngspice. Could you make the ngspice netlist available (here or per private email)?
Meanwhile I have run circuits with 200k transistors (BSIM4, Skywater) with the ngspice KLU version.
e
@Charly Meyer I ran exactly Holger Vogt’s ISCAS85 benchmark which is on the link I gave you with only one modification, to change the path of sky130.lib.spice I run the ARM version of iic-osic-tools on a 16" M1 MacBook Pro base config. My version of iic-osic includes ngspice-38. The final output of the ISCAS85 deck is:
Copy code
Circuit Inventory

BSIM4v5: 14942
Capacitor: 48376
Resistor: 33847
Vsource: 208

ngspice 1 -> exit
ngspice-38 done

real	10m1.436s
user	8m37.347s
sys	0m4.227s
But to be fair to the M1, I was also doing other work at the same time…
a
@Holger Vogt How to get NGSpice to use KLU as a solver?
h
ngspice with KLU is still experimental and under test.
You may download a compiled Windows version at https://ngspice.sourceforge.io/download.html#klu
Or you may download the source code from Sourceforge git at https://sourceforge.net/p/ngspice/ngspice/ci/KLU-6+11-rebase-master-5_Mag_2023/tree/ and compile it yourself, preferently using the compile script compile_linux_klu.sh
a
Thanks @Holger Vogt Are you seeing good improvement in speed using KLU? Are you using klu implementation from the Sparse Suite library?
h
For the example cited above by Eric I see a simulation speed enhancement by a factor of three.
The KLU code is an older version of SuiteSparse (https://github.com/DrTimothyAldenDavis/SuiteSparse)
c
I launched on Windows the benchmark and changed only the .lib. After 4 hours, I quit Ngspice. I'm trying to install Ngspice with KLU on Linux, but I don't know how to do that. Where can I find documentation to install it?
h
As KLU is still experimental, there is no 'ready to install' solution.
So you need to download the source code and compile it yourself.
How to compile ngspice with KLU: download source from https://sourceforge.net/p/ngspice/ngspice/ci/KLU-6+11-rebase-master-5_Mag_2023/tree/ download ngspice manual as https://sourceforge.net/projects/ngspice/files/ng-spice-rework/40/ngspice-40-manual.pdf/download compile instructions for Linux are given in chapter 32.1: download and install various libraries (if not already there): bison, flex, and X11 (and Xaw, Xmu, Xext, Xft, FontConfig, Xrender, readline, and freetype) headers (e.g. libX11-devel) and libs (e.g. libX11-6), in addition autoconf, automake, libtool compile by running the script ./compile_linux_klu.sh
a
@Holger Vogt I have followed the same steps and encountered this error when executing ./compile_linux_klu.sh
@Holger Vogt solved..i need to execute it as sudo.
120 Views