Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Regular Visitor
droid77
Posts: 23
Registered: ‎07-22-2010
0
Accepted Solution

Increment/decrement counter at 2 different rates

I want to implement a counter that I increment at the clock rate (12.5e-9 seconds) but I want to decrement the counter at different rate (1.0075e-5 seconds).  How can I implement this since the the counter block specifically asks for a single rate?

 

Can you provide a simple model file to illustrate a possible solution?

 

Many thanks for your time.

 

Ed

Xilinx Employee
bwiec
Posts: 999
Registered: ‎08-02-2011
0

Re: Increment/decrement counter at 2 different rates

You could use the optional clock enable signal to allow the counter to increment/decrement however you'd like.

www.xilinx.com
Super Contributor
vlavruhin
Posts: 195
Registered: ‎12-08-2010
0

Re: Increment/decrement counter at 2 different rates

[ Edited ]

Hi.

 

Consider that you would like to design a counter, that counts up at the frequency f1 and counts down at the frequency f2. Lets suppose that  f1 = K * f2 (K - some integer number).

 

It's really easy to describe the behavour of such counter using your favourite HDL. It should be clocked by the frequency f1. At each rising edge of f1 the counter counts up. And at each K clock cycles of f1 the counter counts down. To detect these K cycles additional counter that counts down from K to 0 can be used.

Best Regards,
Vitaly.
Regular Visitor
droid77
Posts: 23
Registered: ‎07-22-2010
0

Re: Increment/decrement counter at 2 different rates

Thanks vlavruhin, great insight.  That is all I need to get started.