The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Timer function with tolerance parameter
https://designers-guide.org/forum/YaBB.pl?num=1563986733

Message started by nthoangga on Jul 24th, 2019, 9:45am

Title: Timer function with tolerance parameter
Post by nthoangga on Jul 24th, 2019, 9:45am

Hi, Here is the timer function documentation:

timer(time[, period][, ttol][, enable])

Parameters
time (real) – time of needed evaluation point
period (real) – period or repetion
ttol (real) – time tolerance
enable (real) – enable

Only 'time' is required, other parameters are optional.
If I want to provide 'ttol' parameter, but don't have a need for 'period', how could I do it?

One idea is just to give a very big value for 'period' (ex. period=10). But is there any other ways around it?

Title: Re: Timer function with tolerance parameter
Post by Ken Kundert on Jul 24th, 2019, 11:12am

Don't know for sure, but you might want to try:


Code:
timer(1u, ttol(1n))

or


Code:
timer(1u,,1n)


-Ken

Title: Re: Timer function with tolerance parameter
Post by Geoffrey_Coram on Jul 25th, 2019, 5:11am

It seems like the syntax should be

timer(time [, [period] [, [tol] [, [enable]] )

instead of

timer(time[, period][, ttol][, enable])

if null/missing arguments are supported.

Title: Re: Timer function with tolerance parameter
Post by Geoffrey_Coram on Jul 25th, 2019, 5:13am

Actually, Annex A of the Verilog-AMS Language Reference Manual version 2.4 has:

timer ( analog_expression [ , analog_expression_or_null
[ , constant_expression_or_null [ , analog_expression ] ] ] )

and it's clear that null arguments are allowed (per the syntax - your simulator may not be fully compliant).

Title: Re: Timer function with tolerance parameter
Post by nthoangga on Jul 25th, 2019, 3:26pm


Ken Kundert wrote on Jul 24th, 2019, 11:12am:
Don't know for sure, but you might want to try:


Code:
timer(1u, ttol(1n))

or


Code:
timer(1u,,1n)


-Ken


Just to confirm the comments above, first method does not work. Second method works.

Title: Re: Timer function with tolerance parameter
Post by Ken Kundert on Jul 25th, 2019, 4:34pm

Whoops. It should have been:


Code:
timer(1u, .ttol(1n))

I was missing the period before ttol. Even then it might not work. I don't know whether named arguments are supported for functions and tasks.

-Ken

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.