Aha. With that the console version of ngspice starts in the illegal state
that you identified, and .OP (obviously) can not find the correct operation
point, making the run fail with "Transient solution failed -".
When I specify UIC to skip .OP, the tran starts and runs very slowly,
locking up windows 7 in quite a scary way by using an enormous amount
of diskspace, but ^C still is able to kill it.
Possibly the dll version does something it shouldn't in this case, but
I can't check that now.
-marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is that there are conditions that eat up all of the available memory (see my other post 5hrs ago).
This is not dll specific. It is a XSPICE bug, difficult to analyse. During tansient analysis, right at its beginning, function EVTiter(ckt) adds one event after the other with a timestep of 1e-9s, the given delay time. Each time step some memory is allocated. Changing the delay times to 1e-6s makes memory consumption a bit slower, but after 10% transient time 4GB are used up.
Basically this should not happen, illigal inputs to a logic device should cause U (unknown) at its output. Of course it is not a good idea to force an illigal condition right at the beginning of a simulation, but ngspice should then bail out gracefully.
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, the problem is not at t=0, but at t=5ms when CLK goes low and both
NAND1 and NAND2 go high. The two NAND3s then form a 2ns delay-line
oscillator. This generates a lot of output which NGSPICE stores in
memory when in interactive mode.
I modified the rise_delay and fall_delay of NAND3 and simulated
until 0.5ms after the oscillation started. The following statistics
were compiled:
tt=0.1ns CALLOCed memory: 181.1 MB, disk 41.2 MB
tt=1ns CALLOCed memory: 155.7 MB, disk 34.1 MB
tt=10ns CALLOCed memory: 40.7 MB, disk 4.5 MB
tt=100ns CALLOCed memory: 25.3 MB, disk 0.4 MB
For tt=1ns approximately 100MB/0.5ms = 0.2GB/ms is needed,
or 0.1 GB/ms when we take into account that CLK is low 50%
of the time. To simulate 150 ms, 15GB of main memory is
required. This will fail far before completion on a workstation
with 16GB memory (under Windows). I therefore doubt that
this circuit demonstrates a bug in XSPICE.
The attached circuit is not the one used for the statistics.
It contains analog monitor traces for all the digital nodes
as shown in srff_orig.png. Analog aliasing of the digital
traces could caused a wrong conclusion of U(ndefined)
signals.
the input file you have provided, does not crash ngspice (neither ngspice.exe nor ngspice.dll). It simply does not do anything, exept that the clock is toggling.
When you experience a crash with ngspice.dll, please test your input with standard ngspice.exe. If o.k. then, probably your interface to ngspice.dll has a problem. To solve this problem, your input to this mailing list is definitely not sufficient (see the questions below). When ngspice.exe crashes, we need to have an exact copy of the input file that leads to the crash. Of course you may simplify this file, but if then the crash is not there any more, we cannot help.
What ngspice version do you use?
What error messages do you experience?
How do you invoke the input file (ngspice.dll specific functions)?
What version of your input file crashes ngspice (please deliver exactly this one)?
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When S pin and R pin is 1, this SR flip-flop get into unstable state, and this make ngspice.dll to crash!
Last edit: fiveight 2017-08-02
Sorry, I forgot post the simulating commands.
Use follow commands:
Aha. With that the console version of ngspice starts in the illegal state
that you identified, and .OP (obviously) can not find the correct operation
point, making the run fail with "Transient solution failed -".
When I specify UIC to skip .OP, the tran starts and runs very slowly,
locking up windows 7 in quite a scary way by using an enormous amount
of diskspace, but ^C still is able to kill it.
Possibly the dll version does something it shouldn't in this case, but
I can't check that now.
-marcel
The problem is not if there is non-convergence.
The problem is that there are conditions that eat up all of the available memory (see my other post 5hrs ago).
This is not dll specific. It is a XSPICE bug, difficult to analyse. During tansient analysis, right at its beginning, function EVTiter(ckt) adds one event after the other with a timestep of 1e-9s, the given delay time. Each time step some memory is allocated. Changing the delay times to 1e-6s makes memory consumption a bit slower, but after 10% transient time 4GB are used up.
Basically this should not happen, illigal inputs to a logic device should cause U (unknown) at its output. Of course it is not a good idea to force an illigal condition right at the beginning of a simulation, but ngspice should then bail out gracefully.
Holger
Ok, the problem is not at t=0, but at t=5ms when CLK goes low and both
NAND1 and NAND2 go high. The two NAND3s then form a 2ns delay-line
oscillator. This generates a lot of output which NGSPICE stores in
memory when in interactive mode.
I modified the rise_delay and fall_delay of NAND3 and simulated
until 0.5ms after the oscillation started. The following statistics
were compiled:
tt=0.1ns CALLOCed memory: 181.1 MB, disk 41.2 MB
tt=1ns CALLOCed memory: 155.7 MB, disk 34.1 MB
tt=10ns CALLOCed memory: 40.7 MB, disk 4.5 MB
tt=100ns CALLOCed memory: 25.3 MB, disk 0.4 MB
For tt=1ns approximately 100MB/0.5ms = 0.2GB/ms is needed,
or 0.1 GB/ms when we take into account that CLK is low 50%
of the time. To simulate 150 ms, 15GB of main memory is
required. This will fail far before completion on a workstation
with 16GB memory (under Windows). I therefore doubt that
this circuit demonstrates a bug in XSPICE.
The attached circuit is not the one used for the statistics.
It contains analog monitor traces for all the digital nodes
as shown in srff_orig.png. Analog aliasing of the digital
traces could caused a wrong conclusion of U(ndefined)
signals.
-marcel
Last edit: marcel hendrix 2017-08-05
You can use this picture of my netlist.
Again this one does not crash ngspice.exe or ngspice.dll.
Holger
Fiveight,
the input file you have provided, does not crash ngspice (neither ngspice.exe nor ngspice.dll). It simply does not do anything, exept that the clock is toggling.
When you experience a crash with ngspice.dll, please test your input with standard ngspice.exe. If o.k. then, probably your interface to ngspice.dll has a problem. To solve this problem, your input to this mailing list is definitely not sufficient (see the questions below). When ngspice.exe crashes, we need to have an exact copy of the input file that leads to the crash. Of course you may simplify this file, but if then the crash is not there any more, we cannot help.
What ngspice version do you use?
What error messages do you experience?
How do you invoke the input file (ngspice.dll specific functions)?
What version of your input file crashes ngspice (please deliver exactly this one)?
Holger
Sorry, I forgot post the simulating commands.
Use the spice I post second time and use follow commands:
Things start becoming interesting:
By adding a control section
to your input file given above, I managed to stall my computer completely by calling standard ngspice.exe with
ngspice srflipflop.cir
.This is worth some further investigations!
Holger