The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 8:00am
Pages: 1
Send Topic Print
VAMS clock period monitor- Help! (Read 4787 times)
Rosh
Junior Member
**
Offline



Posts: 21

VAMS clock period monitor- Help!
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?
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: VAMS clock period monitor- Help!
Reply #1 - Jul 14th, 2015, 3:27am
 
Rosh,
Code:
t1=t1-t0; 

will be executed every time step.
- B O E
Back to top
 
 
View Profile   IP Logged
Rosh
Junior Member
**
Offline



Posts: 21

Re: VAMS clock period monitor- Help!
Reply #2 - 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
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: VAMS clock period monitor- Help!
Reply #3 - 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
Back to top
 
 
View Profile   IP Logged
Rosh
Junior Member
**
Offline



Posts: 21

Re: VAMS clock period monitor- Help!
Reply #4 - Jul 15th, 2015, 2:15am
 
Thank you BOE
Back to top
 
 
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.