pascalkuthe / OpenVAF

An innovative Verilog-A compiler
https://openvaf.semimod.de/
GNU General Public License v3.0
113 stars 15 forks source link

Noise contribution distorbs DC model #30

Closed dwarning closed 1 year ago

dwarning commented 1 year ago

In fact the noise model in the attached code is more as questionable. We have a parallel current and voltage contribution to same branch:

`// shot noise

    I(bii,biii) <+ V(bii,biii)*1e5;

    V(bii,biii) <+ white_noise(abs(2*(nf*`KBOLTZ*TjK)*(nf*`KBOLTZ*TjK)/(`QELECTRON*Ic1)) , "Vbe");

` But the issue is, that the noise contribution affected the dc simulation result very strong, so the model is not usable. Removing the noise part dc results are reasonable.

Is that behaviour inline with LRM and Verilog-A? Expectation is that the white_noise contribution affect only ac and noise simulations base on small-signal model. Should a warning issued if different contribution types go on same branch?

fbhhbt-2.3.zip

pascalkuthe commented 1 year ago

It seems like the model is not inline with the Verilig-A standard. A branch can be either a voltage source or a current source not both at the same time. Whichever contributions happen last in an iteration "wins". For example:

V(x) <+ foo;
if (bar) begin
  I(x) <+ foo;
end

Is a current source if bar is true and a voltage source otherwise.This condition can even be operating point dependent (this feature is called switch branches).

So in the example you posted the voltage contribution of the noise model overwrites the current contribution of the normal model. Note that the reasoning of this being an ac contribution does not apply here. All contributions always apply in all analysis modes. The only difference is that some analog operators return different values.

For example I(x) <+ ddt(Q) still turns the branch into a current source during DC simulations, ddt just returns 0 in that case so its a voltage source with 0 current. This is especially important for voltage source as a voltage source with voltage 0 is a short.

In general using voltage sources for noise in this manner is not a good idea and doesn't correspond to the physics either (charges cause noise not voltages).

The fbhhbt model does not see much use (its not a cmc model) and this has therefore likely just been overlooked. Many compilers/simulators (especiallly those that use ADMS) don't handle switch branches correctly so I can imagine that some accept this model.

So.in conclusion I am fairly certain that this model is not.standard compliant and that this is not an issue.with openvaf. I would.ne hesitant to add a warning because switch branches are valid according to.the standard and do occur in real world models. Especially because openvaf just treats branch collapsing as a spevical case of switch branches that gets optimized (I think this case it might actually cause a branch collapse because there is a constant V(bii, biii) <+ 0 contribution although that will automatically stop once noise is added)