The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 5th, 2024, 4:07pm
Pages: 1
Send Topic Print
Diode modeling probelm (Read 1173 times)
sonis
New Member
*
Offline



Posts: 7
Cork, Ireland
Diode modeling probelm
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
Back to top
 
 
View Profile   IP Logged
sonis
New Member
*
Offline



Posts: 7
Cork, Ireland
Re: Diode modeling probelm
Reply #1 - Oct 13th, 2005, 1:15pm
 
there is a typo in my post , it should be
`include "disciplines.vams"
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: Diode modeling probelm
Reply #2 - 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
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: Diode modeling probelm
Reply #3 - 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.
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2384
Silicon Valley
Re: Diode modeling probelm
Reply #4 - 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
Back to top
 
 
View Profile WWW   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: Diode modeling probelm
Reply #5 - 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
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.