The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Verilog A Event
https://designers-guide.org/forum/YaBB.pl?num=1143074667

Message started by yaxazaa on Mar 22nd, 2006, 4:44pm

Title: Verilog A Event
Post by yaxazaa on 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.

Title: Re: Verilog A Event
Post by Geoffrey_Coram on 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.

Title: Re: Verilog A Event
Post by Marq Kole on 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;

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