The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:18am
Pages: 1
Send Topic Print
Question about PLL example given in this website (Read 2859 times)
amber555
New Member
*
Offline



Posts: 3

Question about PLL example given in this website
Mar 10th, 2008, 8:57am
 
Hi, everyone. I just download an example PLL code in Verilog-AMS from this website and it works fine. However, when I look at the code, I found that for the charge pump (cp.vams), there is a "-" before the "transition". Could anyone explain for me why we need a "-"?  Thanks a lot.
Back to top
 
 
View Profile   IP Logged
amber555
New Member
*
Offline



Posts: 3

Re: Question about PLL example given in this websi
Reply #1 - Mar 12th, 2008, 4:12am
 
The Verilog-code that I mentioned for modeling the charge pump is as follows:

module cp (pout, nout, inc, dec);
   parameter real cur = 1m;      // output current (A)
   input inc, dec;
   electrical pout, nout;
   real out;

   analog begin
     @(initial_step) out = 0.0;

     if (dec && !inc)
         out = -cur;
     else if (!dec && inc)
         out = cur;
     else out = 0;

     I(pout, nout) <+ -transition(out, 0.0, 10n, 10n);
   end
endmodule


I am wondering why we need to add "-" before "transition". Thanks in advance.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Question about PLL example given in this websi
Reply #2 - Mar 12th, 2008, 5:04am
 
Surely it's just a sign convention; one could have written instead
 I(nout,pout) <+ transition(out, 0.0, 10n, 10n);

Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: Question about PLL example given in this websi
Reply #3 - Mar 12th, 2008, 10:38am
 
Current is positive if it enters pout and exits nout (associated reference direction). Since this is a source, we think of positive current leaving the source. Thus we need a negative sign to convert our conventions internal to the model, that of a source, to the conventions used by the language, associated reference direction.

-Ken
Back to top
 
 
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.