The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Question about PLL example given in this website https://designers-guide.org/forum/YaBB.pl?num=1205164643 Message started by amber555 on Mar 10th, 2008, 8:57am |
Title: Question about PLL example given in this website Post by amber555 on 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. |
Title: Re: Question about PLL example given in this websi Post by amber555 on 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. |
Title: Re: Question about PLL example given in this websi Post by Geoffrey_Coram on 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); |
Title: Re: Question about PLL example given in this websi Post by Ken Kundert on 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 |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |