I am simulating a floating gate memory model custom made in verilog. I am running several simulations using an Ocean script with varying parameters to determine total charge, time to reach total charge, retention time, etc. All of these must be done with transient analysis.
My question is how do I abort a transient analysis once the maximum charge is reached (there is a node in the model that displays the charge that can be read as a voltage). The problem is when I run transient analysis, it takes an incredibly long time because the charge is constantly changing due to thermal effects and my time step is in the picosecond range. I have tried setting the step to a larger value using the ?step parameter for the analysis command, but that did not change anything.
Once the simulation is complete, I have the code to scan the waveform, find the maximum charge, how long it took to reach this value, print the information to a text file, change parameters and repeat. The only problem is the time to run the simulation. It takes up to 5 minutes and I have thousands of simulations to run for each data point. Also, the time it takes to reach the maximum charge varies with the parameters so I can not just set the transient analysis to a very small value. Right now it is at 1 microsecond.
So, I am looking for the analysis parameters that would allow me to stop after reaching the maximum charge. This could be found by a simple if statement that says if the same maximum is reached twice, stop the experiment. The charge on the floating gate changes by 1 due to thermal effects every few picoseconds and this is why the simulation takes so long.
The slope is always zero. I was not clear earlier. When I say charge, I mean number of electrons. So the final graph looks like a staircase with each step being an additional electron. So, I can't check when the slope goes negative or if the slope stays 0 for a certain amount of time. Imagine the maximum charge being reached at 70 ns, drops to max - 1 at 82 ns, back to max at 100ns, then drops down to max - 1 at 110 ns. If I wait for 15 ns I would get the max - 1 value and the incorrect time. Similar situations can be imagined for any "wait" time.
By manually run the transient analysis, I mean check the waveform result at an input time without having to simulate the entire wave. For the result I posted above:
tran: time = 17.72 ps (1.77 n%), step = 298.4 as (29.8 f%) tran: time = 109 ps (10.9 n%), step = 106.6 fs (10.7 p%) tran: time = 1.145 ns (114 n%), step = 891.6 fs (89.2 p%)
Lets say I wanted to check the values at 1 ns, then the value at 5 ns, so a 5 ns step, so only have two data points for the waveform. As opposed to the 106.6 fs and 891.6 fs steps. Or just ask the simulator to simulate a specific time, such as 1.145 ns without having to do the previous steps.
Or another way to put it, run a transient analysis for 1 ns with 10 ps steps, have the simulation stop so I could check the value, then continue again for another 10 ns with 1 ns steps, stop and check value, with both simulations adding to the same waveform.