I have written a behavioral model using verilog-a and want to simulate it using spectre.
Additionally, I want to study how the statistical variations of some of the parameters defined in my model affect the overal electrical characteristics, that is, I need to do a Monte Carlo simulation for this study.
I know how to do the Monte Carlo simulation provided with foundry PDK, so my problem is whether can I do the Monte Carlo with the parameters that I defined in my verilog-a model and plot the statistical analysis results as a histogram or something?
Thanks if any of you could lend me a hand on this!
There's an example in this solution of how to do this.
Thank you for the link to the solution. I've tried it myself and it works. However, I wonder if it's possible to define the statistical parameter with respect to another parameter of the model.
Say I have modeled a current source (see below) and I want the standard deviation to be a certain percentage of the value that the user defines in the schematic for the specific model.
// VerilogA for user, vccs_mc, veriloga
`include "constants.vams"`include "disciplines.vams"
inout vpos,vneg,ipos,ineg;electrical vpos,vneg,ipos,ineg;
(*cds_inherited_parameter*) parameter real gm_mc = 0;
parameter real gm = 1u;localparam real gm_effective = (1+gm_mc)*gm; // nominal transconductance plus monte-carlo mismatch effect
analog beginI(ipos,ineg) <+ gm_effective*V(vpos,vneg);end
How shall I define the variation of the parameter gm_mc in the .scs file such that is taken into account properly ? Currently I have the following:
parameters gm_mc = 0
vary gm_mc dist=gauss std=1 percent=yes
But when I run the Monte Carlo the simulator complains there's no statistical variation.
Thanks in advance.
If I run with your statistics block, I get:
Warning from spectre during Monte Carlo analysis `mc'. WARNING (SFE-3224): Variance of the mismatch parameter `gm_mc' is evaluted to be zero.Error found by spectre during Monte Carlo analysis `mc'. ERROR (SFE-3225): Variance (or standard deviation) of statistical parameters cannot be zero! Set `ignorezerovar=yes' in global options to bypass this check.
This is because you have percent=yes and so the standard deviation is set to be 1% of the mean value (which is 0). That's not going to work.
There's no need to make the standard deviation a function of an instance parameter. What you would do is have a normalized statistical parameter - e.g. a mean of 0, and standard deviation of 1, and then scale it in the model. In this case your model has a standard deviation of gm (if I remove the percent=yes) because you're multiplying gm_mc by gm. If you wanted it to be 1% of gm, you could write:
localparam real gm_effective = (1+gm_mc*0.01)*gm; // nominal transconductance plus monte-carlo mismatch effect
Thanks for the explanation and the workaround Andrew. Your approach indeed does the trick.