The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 7th, 2024, 6:30am
Pages: 1
Send Topic Print
problem with $realtime ??? (Read 8852 times)
rajdeep
Senior Member
****
Offline



Posts: 220
UK
problem with $realtime ???
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

Back to top
 
 

Design is fun, verification is a requirement.
View Profile   IP Logged
rajdeep
Senior Member
****
Offline



Posts: 220
UK
Re: problem with $realtime ???
Reply #1 - 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
Back to top
 
 

Design is fun, verification is a requirement.
View Profile   IP Logged
bernd
Senior Member
****
Offline



Posts: 229
Munich/Germany
Re: problem with $realtime ???
Reply #2 - 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
Back to top
 
 

Just another lonesome cad guy
View Profile WWW   IP Logged
rajdeep
Senior Member
****
Offline



Posts: 220
UK
Re: problem with $realtime ???
Reply #3 - May 31st, 2006, 6:16am
 
It didn't even worked with conservative  :-/..
Back to top
 
 

Design is fun, verification is a requirement.
View Profile   IP Logged
bernd
Senior Member
****
Offline



Posts: 229
Munich/Germany
Re: problem with $realtime ???
Reply #4 - May 31st, 2006, 6:26am
 
Why do you set the time step at all?
Spectre in general computes the best time step internally.

Bernd
Back to top
 
 

Just another lonesome cad guy
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2384
Silicon Valley
Re: problem with $realtime ???
Reply #5 - 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.
Back to top
 
 
View Profile WWW   IP Logged
rajdeep
Senior Member
****
Offline



Posts: 220
UK
Re: problem with $realtime ???
Reply #6 - 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 Cool
Back to top
 
 

Design is fun, verification is a requirement.
View Profile   IP Logged
rajdeep
Senior Member
****
Offline



Posts: 220
UK
Re: problem with $realtime ???
Reply #7 - 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
Back to top
 
 

Design is fun, verification is a requirement.
View Profile   IP Logged
Jess Chen
Community Fellow
*****
Offline



Posts: 380
California Bay Area
Re: problem with $realtime ???
Reply #8 - 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
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: problem with $realtime ???
Reply #9 - May 31st, 2006, 9:11am
 
Rather than @cross, you might want to investigate the optional 3rd argument -- timetol -- for the timer event.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: problem with $realtime ???
Reply #10 - May 31st, 2006, 9:27am
 
rajdeep wrote 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.


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"
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
rajdeep
Senior Member
****
Offline



Posts: 220
UK
Re: problem with $realtime ???
Reply #11 - 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
Back to top
 
 

Design is fun, verification is a requirement.
View Profile   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.