The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 4th, 2024, 1:26pm
Pages: 1
Send Topic Print
Verilog A Event (Read 3568 times)
yaxazaa
New Member
*
Offline



Posts: 6

Verilog A Event
Mar 22nd, 2006, 4:44pm
 
Can someone tell me how to do integration between two events in Verilog-A? Foe example, when signal a passed trigger point, the function starts to do integration, after detected signal b passed trigger point, intergation stop.

Thanks.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Verilog A Event
Reply #1 - Mar 23rd, 2006, 5:49am
 
@(initial_step) integ = 0;

@(cross(V(ctrl), +1)) integ = 1; // triggers when V(ctrl) crosses 0 in the positive direction
@(cross(V(ctrl)-2,+1)) integ = 0; // triggers when V(ctrl) crosses 2 in the positive direction

V(out) <+ idt(integ * V(in), 0);


Note that V(ctrl) must start below zero, or else the cross function won't detect a crossing.
Back to top
 
 

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



Posts: 11
Eindhoven, The Netherlands
Re: Verilog A Event
Reply #2 - Mar 24th, 2006, 2:18am
 
Or use the @(above) event if you want V(ctrl) to be able to start above 0 from the start of your simulation. With @(above) the event is triggered also during (implicit) DC analysis.

@(above(V(ctrl))) integ = 1;
@(above(V(ctrl))) integ = 0;

BTW @(above) is an Verilog-AMS 2.2 feature so may not be available in all simulators yet.

Alternatively, test for V(ctrl) during the @(initial_step)

@(initial_step) integ = (V(ctrl) > 0) ? ((V(ctrl) > 2) ? 0 : 1) : 0;
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.