The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 8:12am
Pages: 1
Send Topic Print
Running average in Verilog-AMS (Read 7683 times)
Cri Azzolini
Community Member
***
Offline



Posts: 48
University of Parma, Italy
Running average in Verilog-AMS
Apr 14th, 2010, 7:15am
 
Hi all,

is there a method to calculate running averages in Verilog-AMS? I would need to measure the running average of a voltage with a time window of TS second. So that the expression in pseudo-math language would be:

avg = 1 /TS * integral_from($asbtime-TS)_to($abstime) vin(x)dx

where $abstime is the running time.
As model output I would need a time continuous function: avg(t).
I am not sure if the VerilogAMS function "idt" is suitable.

Any ideas?

Many thanks,
Cristiano
Back to top
 
 
View Profile WWW cri.azzolini   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: Running average in Verilog-AMS
Reply #1 - Apr 14th, 2010, 4:40pm
 
There's an example of doing this on the Cadence Online Support site http://support.cadence.com/wps/mypoc/cos?uri=deeplinkmin:ViewSolution;solutionNu...

If that helps...

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Running average in Verilog-AMS
Reply #2 - Apr 19th, 2010, 7:54am
 
In case you are not able to see the answer at the Cadence support site, the answer to your question is: yes, idt is applicable, but you also need to factor in the time window. You can rewrite the integral to the following form:

avg = 1 /TS * integral_from($abstime-TS)_to($abstime) vin(x)dx

avg = 1 /TS * (integral_from(0)_to($abstime) vin(x)dx -
                     integral_from(0)_to($abstime-TS) vin(x)dx)

avg = 1 /TS * (integral_from(0)_to($abstime) vin(x)dx -
                     integral_from(TS)_to($abstime) vin(x-TS)dx)

avg = 1 /TS * (integral_from(0)_to($abstime) vin(x)dx -
                     integral_from(0)_to($abstime) vin(x-TS)dx)

avg = 1 /TS * integral_from(0)_to($abstime) (vin(x) - vin(x - TS))dx

Now you can use idt() and a delay operator to implement this transformed operation.

Marq
Back to top
 
 
View Profile   IP Logged
Cri Azzolini
Community Member
***
Offline



Posts: 48
University of Parma, Italy
Re: Running average in Verilog-AMS
Reply #3 - Apr 20th, 2010, 2:53am
 
Hi Marq and Andrew,

many thanks for the precious hints.
I'll proceed as suggested!

Bye,
   Cristiano
Back to top
 
 
View Profile WWW cri.azzolini   IP Logged
Cri Azzolini
Community Member
***
Offline



Posts: 48
University of Parma, Italy
Re: Running average in Verilog-AMS
Reply #4 - Apr 20th, 2010, 4:17am
 
Hi again,

I just googled this thread with a skill code by Andrew:

http://groups.google.com/group/comp.cad.cadence/browse_thread/thread/bc276d85b43...

I also tried the VerilogAMS code suggested by Marq and they seems quite similar. Actually there is a small discrepancy between the results of the two methods but in my case this may be probably accepted.

Thanks,
Cristiano
Back to top
 
 
View Profile WWW cri.azzolini   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.