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

Noise goes wrong with psp103_nqs #3

Closed
dwarning opened this issue Sep 29, 2024 · 6 comments
Closed

Noise goes wrong with psp103_nqs #3

dwarning opened this issue Sep 29, 2024 · 6 comments

Comments

@dwarning
Copy link

This setup was simulated correct with model compiled by the old openvaf Version (noise activated) from Semimod download page
Bildschirmfoto vom 2024-09-29 08-39-15

Using openvaf from origin/branches/osdi_0.3_noise_mfactor under linux (BTW - not easy to pick-up the right branch, worry!) I get:
export

Same behaviour under windows with your provided binary.

Used psp103_nqs.va model Version 103.8.2

I have not the problem with older psp103 version 103.6.0 from same repository. Model w/o noise problem

@dwarning
Copy link
Author

I isolated the problem: Commit 1529801 - the replacement of Geoffrey's 477e71c seems the culprit. Interesting because with 477e71c we can not compile psphv.va - see our discussion in 137.
The shown testcase has no multiplier.

@arpadbuermen
Copy link
Owner

arpadbuermen commented Oct 3, 2024

I observed the same behavior with
Version: 103.6.0 (PSP), 200.5.0 (JUNCAP), December 2017
Can you recheck.

The problem originates from noise source
I(NOII) <+ white_noise((nt / mig), "igig");
When this source is commented out, the problem goes away.

If I leave the line below unchanged
I(NOII) <+ white_noise((nt / mig), "igig");
and comment out
I(DI,SI) <+ sigVds * sqrt(MULT_i) * migid * I(NOII);
The problem also disappears.
It seems the source of the problem is referring to a branch current of a branch with only a noise contribution.

A simulation in some reference simulator that supports Verilog-A would be welcome. Just to find out, what the correct behavior should be.

@arpadbuermen
Copy link
Owner

arpadbuermen commented Oct 4, 2024

It seems that the code for computing derivatives is incorrect. In the special case when you contribute a current to a branch that has only a noise component

electrical A, B;
branch(A) br1;
I(br1) <+ white_noise(...);

and then use that same current to contribute to the current of another branch

I(B) <+ I(br1);

a new unknown for I(br1) is created. Now who does that kind of exotic stuff in Verilog-A? Turns out the PSP people do :) All hell breaks loose because the derivative dI(B)/dI(br1) is incorrectly computed.

The derivative is computed correctly if I(br1) has a small resistive contribution, i.e.

I(br1) <+ 1e-100+V(br1) + white_noise(...);

The workaround until the bug is fixed is to change the file PSP103_module.include. Change

I(NOII)      <+  white_noise((nt / mig), "igig");

into

I(NOII)      <+  1e-100*V(NOII) + white_noise((nt / mig), "igig");

The bug seems to have floated up to the surface when correct $mfactor handling was added.

Please confirm if it works for you.

@dwarning
Copy link
Author

dwarning commented Oct 5, 2024

I can follow you analysis and confirm the workaround by adding a tiny resistive component.

If I copy over the file openvaf/sim_back/src/dae/builder.rs from @gjcoram the problem disappears (but crash in psphv.va remains). I thought I can locate the root cause by inspection the two files but your modifications in this file are to extensive an my rs skills are very limited.

@arpadbuermen
Copy link
Owner

Seems to be closed. Build OpenVAF and try it out before I close the issue.

@dwarning
Copy link
Author

Can confirm, the psp noise bug is fixed. Thank you.
BTW: psphv can still be compiled as before.

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