Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different random variables for each device in monte-carlo simulation #445

Open
rnunes2311 opened this issue May 21, 2024 · 2 comments
Open

Comments

@rnunes2311
Copy link

rnunes2311 commented May 21, 2024

Hi,
It looks like every device is getting independent/different random variables assigned in a monte-carlo simulation.
I also realised that the resistors were not getting any variation. This appears to be a mistake in the parameters_res_nom.spice. For example:
.param sw_sky130_fd_pr__res_high_po_rs = {325.0+corner_factor*0.0} + process_mc_factor*MC_PR_SWITCH*GAUSS(0,0.035,1)

GAUSS generates random values relative to the mean, which is 0. Therefore it always generates 0, I believe.

@RTimothyEdwards
Copy link
Owner

I'm not getting that. Gaussian random variables calculated in a .param statement should be calculated once, not for every device. And for the question above, process_mc_factor is 1 (which I think corresponds to 3 sigma variation), andMC_PR_SWITCH is 1 when the monte carlo corner is selected, so the parameter calculated should be (325 + (random number with zero mean)).

@rnunes2311
Copy link
Author

rnunes2311 commented May 22, 2024

For the resistors I see in simulation no variation at all. The ngspice manual states that the gauss function generates random numbers relative to the mean. For that parameter it is generating 325 + (random number with 0 mean and 0 sigma) = 325. For most gaussian random variables in the pdk the agauss function is used, which generates random numbers with an absolute sigma value. I see no variation at all in the resistors with a monte-carlo simulation. By modifying the expression I could get the 3.5 % sigma variation.
I also see mismatch in transistors, which should not happen and when I place resistors in parallel and series to increase the area while still keeping the same equivalent resistance value the equivalent resistance variation is not 3.5 % 1 sigma, because every resistor is getting a different value assigned. This I saw after correcting the original expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants