The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> problem with $realtime ??? https://designers-guide.org/forum/YaBB.pl?num=1149077059 Message started by rajdeep on May 31st, 2006, 5:04am |
Title: problem with $realtime ??? Post by rajdeep on May 31st, 2006, 5:04am Hi all, I am trying to model a sawtooth generator using verilog-A (not AMS, so I cannot use idtmod). The code looks like : @(timer(0,period)) begin offset = $realtime; slope= 5e7; end V(ramp_out) <+ slope*($realtime - offset); This works fine for a simulation time less than 10us. But once I set the simulation time somewhat higher than that, the output just goes bizzare!!! Number of triangles in the o/p starts to get flattened out . I'm not sure why it is happenning??? Does $realtime have anything to do with the simulation time??? Plz help Rajdeep |
Title: Re: problem with $realtime ??? Post by rajdeep on May 31st, 2006, 5:24am Sorry folks!!! I got the solution. I have to increase the timestep of the simulation to the order of ns , But still can anybody suggest a way to circumvent this type of problem, where the inaccuracy is due to timestep of the simulation. I forgot to mention , the period used in the code is 0.5us.....that's why probably a 1us simulation time step was not enough. Rajdeep |
Title: Re: problem with $realtime ??? Post by bernd on May 31st, 2006, 6:11am I assume you have set errpreset to liberal, with modifies the parameter reltol and sets the integration method to 'gear2' which damps the signal. Try with errpreset == moderate Bernd |
Title: Re: problem with $realtime ??? Post by rajdeep on May 31st, 2006, 6:16am It didn't even worked with conservative :-/.. |
Title: Re: problem with $realtime ??? Post by bernd on May 31st, 2006, 6:26am Why do you set the time step at all? Spectre in general computes the best time step internally. Bernd |
Title: Re: problem with $realtime ??? Post by Ken Kundert on May 31st, 2006, 7:19am It seems to me that you should be using $abstime rather than $realtime. Also, idtmod() should be available in Verilog-A. |
Title: Re: problem with $realtime ??? Post by rajdeep on May 31st, 2006, 7:22am Otherwise, it was not working. I don't think it can actually choose a good timestep by itself. Maybe it fails to do so n case of verilogA models. A timestep of 10nS is giving fine result 8-) |
Title: Re: problem with $realtime ??? Post by rajdeep on May 31st, 2006, 7:28am Is it the same Ken Kundert who wrote the book on Verilog-AMS???/ I have tried with abstime..didnot change. Infact, it gives a warning to change $realtime with $abstime!!! Don't know!! I cudnot find idtmod in the whole Verilog-A LRM...i shud have tried though. Thanks Rajdeep |
Title: Re: problem with $realtime ??? Post by Jess Chen on May 31st, 2006, 8:27am You could also try $bound_step. I am not sure I have the syntax correct but this VerilogA command limits the size of the time steps. You can use this command to link the maximum step size to a frequency or slope defined elsewhere in the code. As a side note: if you are resetting your integral when some event occurs, you may want to use a @cross statement to make sure the reset occurs with the desired time resolution. -Jess |
Title: Re: problem with $realtime ??? Post by Geoffrey_Coram on May 31st, 2006, 9:11am Rather than @cross, you might want to investigate the optional 3rd argument -- timetol -- for the timer event. |
Title: Re: problem with $realtime ??? Post by Geoffrey_Coram on May 31st, 2006, 9:27am rajdeep wrote on May 31st, 2006, 7:28am:
1) Yes, it's the same Ken. 2) The simulator I'm using says that $abstime should be used instead of $realtime. 3) idtmod is in 4.4.6 of the Verilog-AMS LRM 2.2 (and the same section in 2.1), titled "Circular integrator operator" |
Title: Re: problem with $realtime ??? Post by rajdeep on May 31st, 2006, 12:59pm Thanks a lot folks!! I will try all the options. Infact, was thinking of timetol option before leaving for home. The cross option will make the code somewhat clumsy I guess...but then if it works fine. Thanks, Rajdeep |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |