The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Delay in an ideal switch https://designers-guide.org/forum/YaBB.pl?num=1273501522 Message started by shary on May 10th, 2010, 7:25am |
Title: Delay in an ideal switch Post by shary on May 10th, 2010, 7:25am Hi, This seems extremely simple, however I've been having trouble with adding delay to a three terminal ideal switch. The switch has bias, control and output terminals (b,c,o), and depending on the voltage difference between bias and control terminals, the switch is open or closed. I can get the ideal switch to simulate, but when I try to add delay using either transition or absdelay, nothing works. Am I doing something wrong? Here is my code: ************ if(V(b,c) > Vth || V(c,b) > Vth) closed = 1; else closed = 0; if(closed) Iout = V(b,o)/Rswitch; else Iout=0; I(b,o) <+ Iout; *********** This code works fine, except there is no delay. When I replace the last line with: I(b,o) <+ transition(Iout,td); OR I(b,o) <+ absdelay(Iout,td); it doesn't work. Is there anything obviously wrong?? How do I add a delay of say 10p? Thank you! |
Title: Re: Delay in an ideal switch Post by Ken Kundert on May 10th, 2010, 9:38am Quote:
I think what you want is to delay the switching action, not the signal being switched. So you probably want something like ... Code:
Notice that the transition function, and hence the delay, is applied to the switch conductance, so you would be delaying the switching action itself, and not delaying the current of the input signal relative to its voltage, which would actually model some very strange distributed component. I have seen some people write this model as Code:
You also made two classic mistakes when writing your model. First, you tried to apply the transition function to a continuous signal (transition(Iout,td)). Never do that. The transition function is only to be applied to piecewise constant signals. Second, you forgot the cross function, which is needed to accurately observe the time of the threshold crossing. -Ken |
Title: Re: Delay in an ideal switch Post by shary on Jun 16th, 2010, 9:38pm Thank you for your reply, Ken. That was very helpful. Also, thank you for your comments about the use of the transition and cross function. I now understand why the initial code was not working, i.e. not adding any delay (due to transition on continuous function). Thanks again. |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |