Showing results for

- Intel Community
- FPGAs and Programmable Solutions
- Programmable Devices
- Long counter (30s) in VHDL, balancing a clock divide and counter size

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

bigcheesefuzz

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-25-2019
06:49 PM

807 Views

Long counter (30s) in VHDL, balancing a clock divide and counter size

I need to add a timer to an application running on a Cyclone V with a long (30s) period.

I can easily write an integer counter that counts the clock (30MHz) x 30s = 90,000,000 which uses ~150 LUTs.

However I'm looking to reduce the amount of LUTs, I can divide the 30MHz clock down (say 100 or 1000) and the my counter only need to count the equivalent amount.

Are there any rules / guides to the ratio of clock divide-to- counter size to best implement a design ? Particularly for the smallest amount of LUTs ?

Plus running the counter slower would surely better from a timing perspective ?

1 Reply

Highlighted
##

If you need just a fixed duration counter (ie, don't need to load arbitrary count values) I would examine use of an LFSR approach to use a minimal number of cells. The number of cells will basically track the length of the counter. A 30 bit counter could have a period of 2^30-1 clocks (this is what is know as a maximal length LFSR). Here is a good quick reference: https://en.wikipedia.org/wiki/Linear-feedback_shift_register

ak6dn

Valued Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-28-2019
02:58 AM

7 Views

For more complete information about compiler optimizations, see our Optimization Notice.