The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Analog Verification >> Analog Functional Verification >> VAMS clock period monitor- Help!
https://designers-guide.org/forum/YaBB.pl?num=1436854597

Message started by Rosh on Jul 13th, 2015, 11:16pm

Title: VAMS clock period monitor- Help!
Post by Rosh on Jul 13th, 2015, 11:16pm

I would like to measure the ON time of a clock pulse.





Code:
`include "disciplines.vams"


module measure_periods(in);


parameter real vdd_half=2.5;

input in;
voltage in;


real t0, t1;
analog begin

@(cross(V(in)-vdd_half,1))   //record time when clock rises beyond Vdd/2
t0=$abstime;


@(cross(V(in)-vdd_half,-1))    //record time when clock falls beyond Vdd/2
t1=$abstime;


t1=t1-t0;

end

endmodule




Will t1 record the ON time? Is this logic correct?

Title: Re: VAMS clock period monitor- Help!
Post by boe on Jul 14th, 2015, 3:27am

Rosh,

Code:
t1=t1-t0;
will be executed every time step.
- B O E

Title: Re: VAMS clock period monitor- Help!
Post by Rosh on Jul 14th, 2015, 3:29am

Hi BOE,

Thank you for the reply.

How will ensure that I print only one output instead of printing it continuously?


Thank you

Title: Re: VAMS clock period monitor- Help!
Post by boe on Jul 14th, 2015, 8:17am

Hi Rosh,
I recommend you use
Code:
t1=$abstime;
t2=t1-t0;
as block at the falling edge event.
- B O E

Title: Re: VAMS clock period monitor- Help!
Post by Rosh on Jul 15th, 2015, 2:15am

Thank you BOE

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