The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 6:23am
Pages: 1
Send Topic Print
Running code depending on clock and time. (Read 2116 times)
eddie
New Member
*
Offline



Posts: 7

Running code depending on clock and time.
Oct 06th, 2009, 5:15am
 
Hello Everyone.
Just a quick query.
I have a block of code that needs to run on the leading edge of a clock (so I intend to look at the voltage, if v > a threshold, then run the code).
But I need the code to run for a time longer than the pulse with of the clock, lets say 3 clock cycles. If I use the conditional with a threshold it will see the leading edge but as soon as the simulator runs the block of code again when the clock is low the code I need running will stop, as naturally v is less than the threshold.
Any way I can detect the rising edge and set the code going until a time or event later.
Btw, the code implements a RC time constant discharge. The problem I have at the moment is that as soon as the pulse goes low the discharge stops prematurely.
Thanks.
Ed
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Running code depending on clock and time.
Reply #1 - Oct 8th, 2009, 6:13am
 
Is this Verilog-A?  What sort of a net is your voltage?

@(initial_step) active = 0;

@(cross(V(in) > vth)) active = 1;

if (active) begin
// do your code
end
Back to top
 
 

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



Posts: 220
UK
Re: Running code depending on clock and time.
Reply #2 - Oct 9th, 2009, 4:02am
 
You can schedule events in Verilog-A. But Im not sure whether your code is in  Verilog-A or Verilog-AMS. I guess in Verilog-AMS things could be easier for you.

Anyway not sure abt the question!! :-p

Rajdeep
Back to top
 
 

Design is fun, verification is a requirement.
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.