The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 8:32pm
Pages: 1
Send Topic Print
Skipping first few clock cycles for cross statemen (Read 2823 times)
sylak
Junior Member
**
Offline



Posts: 24
Silicon valley
Skipping first few clock cycles for cross statemen
Jul 25th, 2007, 3:07pm
 
I am writing a code for a counter and am using @cross statement to begin my count. But I wasnt to skip first few clcok cycles before I start my counter. Is there  a way to do this trick?
Back to top
 
 
View Profile   IP Logged
kamath
Junior Member
**
Offline



Posts: 16

Re: Skipping first few clock cycles for cross stat
Reply #1 - Jul 25th, 2007, 10:52pm
 
hai,
y dont u include a delay buffer for the clock so that the number of clocks to be skipped can be calculated and so much delay given...
hope this works,ne other solution do tell me.....
bye
Back to top
 
 
View Profile   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Skipping first few clock cycles for cross stat
Reply #2 - Jul 26th, 2007, 12:16am
 
Use an integer variable active that you set/unset based on any condition you require, and have the counter only count when active is set.

Code:
parameter real tstart = 1u from [0:inf);
integer active;

analog begin
  if ($abstime > tstart)
    active = 1;

  @(cross(V(in)-0.5, +1))
    if (active)
	count = count + 1;

end 



The code that sets active can be anything, also a number of counts made, a signal on a terminal, etc.
Back to top
 
 
View Profile   IP Logged
sylak
Junior Member
**
Offline



Posts: 24
Silicon valley
Re: Skipping first few clock cycles for cross stat
Reply #3 - Jul 26th, 2007, 1:37pm
 
Thanks Marq..That helped
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.