<@U016H5X1K62>: The way I've seen this done befor...
# analog-design
@User: The way I've seen this done before, which was from another foundry but generally compatible with ngspice, was to define two variables "LOT" and "DEV" that default to zero but that can be set to 1 at the top of a spice run. Then all model files that contain monte-carlo models have the monte carlo expressions multiplied by LOT or DEV, depending on whether it is a wafer-specific variation or a device mismatch variation. The documentation that went along with that stated that you use either LOT=1 to look at process variation over wafer runs, or DEV=1 to look at device mismatch. The SkyWater files are more or less set up this way, except that they are written for spectre and had all the monte carlo parameters inside a "statistics" block which is apparently something that spectre parses, but ngspice doesn't. I purposefully just commented out those statistics sections and left them in the device model files, and I had intended to get around sometime to working on folding the montecarlo coefficients and distributions found there into "agauss()" parameters inside the device models. This is one specific quirk of ngspice, that if you put "agauss()" inside a device model, then it will be used to calculate a different randomly distributed value for every instance of the device; but if you put "agauss()" in a ".param" statement outside of the model, then it is a one-time calculation that applies to all devices in the simulation. In other words, LOT parameters go in ".param" statements outside the model, and DEV parameters go inside the device models. So if I just took the statistics blocks as-is and turned them into parameters, you'd get good lot variation analysis, but you wouldn't get any mismatch analysis. So the trick is getting some automated script to turn the spectre monte carlo parameters into something ngspice will be happy with.