Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20705 Discussions

DE2: how to use clock divider?

Altera_Forum
Honored Contributor II
1,514 Views

Hello, 

I was coding clock divider in VHDL and was told that it's not a good idea to do so. How do I use the DE2's onboard clock divider? 

 

Thank You
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
547 Views

Instead of using a clock divider, use a clock enable instead. It will keep your system in the same clock-domain and make the timing behavior easier to determine by Timequest. 

 

IF (rising_edge(CLOCK)) THEN IF (clock_enable_s = '1') THEN --Stuff Here END IF; END IF;  

 

Just pulse the enable when you want an operation to be done and it should behave much like a clock division. 

 

Hope this helps.
0 Kudos
Altera_Forum
Honored Contributor II
547 Views

Learned how to use the megawizard for a PLL. thanks

0 Kudos
Altera_Forum
Honored Contributor II
547 Views

 

--- Quote Start ---  

Instead of using a clock divider, use a clock enable instead. It will keep your system in the same clock-domain and make the timing behavior easier to determine by Timequest. 

 

IF (rising_edge(CLOCK)) THEN IF (clock_enable_s = '1') THEN --Stuff Here END IF; END IF;  

 

Just pulse the enable when you want an operation to be done and it should behave much like a clock division. 

 

Hope this helps. 

--- Quote End ---  

 

 

Sorry for my terminology, that's what i would have used. My problem was trying to make a 25.175MHz clock from a 50MHz clock. I have no idea how to do this. 

I can see that i'd need to divide by 2.298850574712644 to make that clock. 

and i dont think there's any synthesizible way to do that?
0 Kudos
Altera_Forum
Honored Contributor II
547 Views

any particular reason to set such a non-integer clock rate?

0 Kudos
Altera_Forum
Honored Contributor II
547 Views

 

--- Quote Start ---  

any particular reason to set such a non-integer clock rate? 

--- Quote End ---  

 

 

it's the clock rate that VGA uses.
0 Kudos
Altera_Forum
Honored Contributor II
547 Views

if i'm not mistaken there are some example code that I've seen doesn't really use 27.125MHz clock but they just derive VGA clock from the 50MHz clock with counters. precision doesn't really matters.

0 Kudos
Reply