The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Diode modeling probelm
https://designers-guide.org/forum/YaBB.pl?num=1129234455

Message started by sonis on Oct 13th, 2005, 1:14pm

Title: Diode modeling probelm
Post by sonis on Oct 13th, 2005, 1:14pm

I would like to build a behavoiral model of an rectifier in Verilog AMS. It consist of two diodes in which the anodes and cathodesare connected with each another. I built a model, simulated with simvision and failed to finished simulation,The system shows there is an illegal value when the value of cross function is 0.7. I tried different ways to rebuild it but still can't find solution yet.  I appreciate any help from you. Thanks in advance.

here is my scripts.

`inlucde "desciplines.vams"

module diode (a,c);

inout a,c;
electrical a,c;

analog begin
   @(cross((V(a,c)+I(a,c)),0.7))
    ;
    if ((V(a,c)+I(a,c))>0.7)
            I(a,c) <+ 0.7;
            else begin
                    if ((V(a,c)+I(a,c))> -0.7)
                              V(a,c) <+ 0;
                    else
                               I(a,c) <+ -0.7;
                    end
     end
endmodule

Title: Re: Diode modeling probelm
Post by sonis on Oct 13th, 2005, 1:15pm

there is a typo in my post , it should be
`include "disciplines.vams"

Title: Re: Diode modeling probelm
Post by jbdavid on Nov 3rd, 2005, 9:47am

a much better diode model would use an exponential..
for convergence issues its better to use a limexp function to express the relationship between the voltage and current..
But in YOUR case of something thats basically a bidirectional diode clamp..
I would just add TWO exponentials.. with the opposite polarity voltage in each expression

I(branch) <+ Is*limexp(V(branch)/Vt);
I(branch) <+ -Is*limexp(-V(branch)/Vt);
(Vt = kT/q if my recollection serves me correctly..
and if that doesn't help you know which of your text books to go back to.. I'd recommend starting with something simple.. like Millman's Microelectronics... (the one my college used for the Junior Circuits sequence many years ago..)
BTW -- I didn't look, (and If I'm not sure, I'll always crack open the right book before finishing the model!!)
BTW the Orange Verilog-A book has examples of a diode model.. and so does the Cadence Software, in ahdlLib..
good luck..
jbd

Title: Re: Diode modeling probelm
Post by Eugene on Nov 3rd, 2005, 1:25pm

Sonis,

I am a bit confused by your use of "V(a,c)+I(a,c)". First of all, it seems you are mixing volts and amps, unless you are implicitly using a one ohm resistor to convert one unit to the other. Second, and perhaps more importantly, you must be careful about using current probes, like I(a,c).  You can use them in situations like
V(a,c) = 1000*I(a,c) to implement a 1k resistor but in other applications the current probe acts like a short between the nodes. I wonder if you aren't shorting nodes "a" and "c" together in your example. If you are, V(a,c) will always be zero, which I suspect is not what you want.

In any event, I think I agree with jbdavid; I'd use analytic expressions instead of conditional statements to model diodes.

Title: Re: Diode modeling probelm
Post by Ken Kundert on Nov 4th, 2005, 8:40am

Eugene and JBD,
   Sonis is using a tip I presented in my book on Verilog-AMS (see section 6.2 on page 71). I think the problem he is having is result of the values of the contributions not matching up with the values used in the conditions. I would expect that
1. there would be @cross statements to detect thresholds at both 0.7 and -0.7
2. the conditionals would be rewritten as
if (V(a,c) + I(a,c) > 0.7)
 V(a,c) <+ 0.7;  <-- this is different
else begin
 if (V(a,c) + I(a,c) < -0.7)  <-- this is different
   V(a,c) <+ -0.7;  <-- this is different
 else
   I(a,c) <+ 0;   <-- this is different

-Ken

Title: Re: Diode modeling probelm
Post by jbdavid on Nov 9th, 2005, 9:48am

Ah..
While I KNOW the simulator and the language both support branch switching.. I got burned by it a couple of times, and can ususally find a good way to get my things done without it..  
and keep spectre away from the discontinuities..
Maybe this trick is faster .. especially in isolation, but when used with 4000 other transistors.. it might (might - I haven't retested this in several years) make the sim run slower.. -
I avoid this for the same reason I go around manhole covers when on my bicycle.. its potentially more problematic than staying on the pavement! (especially  if wet!) - and I suspect others avoid using Power ON Reset circuits for similar reasons..

I probably will try this again sometime, when it seems to be a better solution than one of my workarounds..

Jonathan

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.