FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-22-2005, 05:19 PM
BQ
Guest
 
Posts: n/a
Default Frequency divisors

In my project, which uses an Altera Cyclone EP1C12, I need to generate a
lot of different frequencies, such as f=10Mhz, 1MHz, 2.5MHz, 250kHz, etc.
I used counters but quartus' design assistant complains that I'm using
gated clocks. Are there better solutions than counters to achieve what I
need? Or better ways to implement frequency divisors?
Thank you in advance,
BQ
Reply With Quote
  #2 (permalink)  
Old 06-22-2005, 08:39 PM
Falk Brunner
Guest
 
Posts: n/a
Default Re: Frequency divisors


"BQ" <[email protected]> schrieb im Newsbeitrag
news:mkfue.16513$[email protected]..

> In my project, which uses an Altera Cyclone EP1C12, I need to generate a
> lot of different frequencies, such as f=10Mhz, 1MHz, 2.5MHz, 250kHz, etc.
> I used counters but quartus' design assistant complains that I'm using
> gated clocks. Are there better solutions than counters to achieve what I
> need? Or better ways to implement frequency divisors?


The counters are right, but don't use the outputs as real clocks. Run
everything at the highest frequency (I guess 10 MHz) and use clock enables
for the slower parts of the logic. Keeps things easy and safe.

Regards
Falk



Reply With Quote
  #3 (permalink)  
Old 06-22-2005, 11:08 PM
Vladislav Muravin
Guest
 
Posts: n/a
Default Re: Frequency divisors

The problem is when you start using the counter bits as clocks.
If your clock is simply one of the counter's bits, this is not really a
gated clock,
there is no problem in terms of that there is no ambiguity of metastability.

Honestly I really hate this thing in Quartus as many other warnings, which
are far from reality.

Try using the same highest clock and counter bits as "clock enable"s.
If you designing a UART-like application, this is the way to go.

Vladislav

"BQ" <[email protected]> wrote in message
news:mkfue.16513$[email protected]..
> In my project, which uses an Altera Cyclone EP1C12, I need to generate a
> lot of different frequencies, such as f=10Mhz, 1MHz, 2.5MHz, 250kHz, etc.
> I used counters but quartus' design assistant complains that I'm using
> gated clocks. Are there better solutions than counters to achieve what I
> need? Or better ways to implement frequency divisors?
> Thank you in advance,
> BQ



Reply With Quote
  #4 (permalink)  
Old 06-22-2005, 11:40 PM
Peter Alfke
Guest
 
Posts: n/a
Default Re: Frequency divisors

Let's look at the basics:
If you have an incoming clock (say 10 MHz in your case) and you want to
derive any clock from it, these derived clocks will inevitably be
delayed from the original clock, even when you are smart and avoid
ripple counters and clock gating. Also, the distribution of your many
clocks might use local (instead of global) routing.
Whatever you do, you end up with a sloppy clock structure, which
invites hold-time problems when the different clock domains have to
interact. (If they don't, you really have no problem.)

Dumb clock gating can create glitches, mixing non-synchronous clocks
can create metastability problem, but even the most careful clock
selection scheme is dangerous.

Clock Enable avoids all these problems (except the metastability).
That's why we all favor CE (except for its higher power consumption).
Peter Alfke, Xilinx Applications

Reply With Quote
  #5 (permalink)  
Old 06-22-2005, 11:40 PM
Peter Alfke
Guest
 
Posts: n/a
Default Re: Frequency divisors

Let's look at the basics:
If you have an incoming clock (say 10 MHz in your case) and you want to
derive any clock from it, these derived clocks will inevitably be
delayed from the original clock, even when you are smart and avoid
ripple counters and clock gating. Also, the distribution of your many
clocks might use local (instead of global) routing.
Whatever you do, you end up with a sloppy clock structure, which
invites hold-time problems when the different clock domains have to
interact. (If they don't, you really have no problem.)

Dumb clock gating can create glitches, mixing non-synchronous clocks
can create metastability problem, but even the most careful clock
selection scheme is dangerous.

Clock Enable avoids all these problems (except the metastability).
That's why we all favor CE (except for its higher power consumption).
Peter Alfke, Xilinx Applications

Reply With Quote
  #6 (permalink)  
Old 06-23-2005, 12:50 AM
ddrinkard
Guest
 
Posts: n/a
Default Re: Frequency divisors

In HDL you can do something like this:

module clock_generator(input clk, input resetN, output reg CE_out);
parameter clk_divisor = 1;
reg [3:0] cnt;
always @ (posedge clk or negedge resetN)
begin
if (~resetN)
begin
cnt <= 0; CE_out <= 0;
end
else begin
if (cnt == (clk_divisor - 1))
begin
cnt <= 0; CE_out <= 1;
end
else begin
cnt <= cnt + 1; CE_out <= 0;
end
end
end
endmodule
module top(input clk, input resetN, output reg Q1, output reg Q2);
wire CE1;
wire CE2;
defparam U1.clk_divisor = 10; // generate a CE every 10 clocks
clock_generator U1 (.clk(clk),.resetN(resetN),.CE_out(CE1));
defparam U2.clk_divisor = 5; // generate a CE every 5 clocks
clock_generator U2 (.clk(clk),.resetN(resetN),.CE_out(CE2));
always @ (posedge clk or resetN)
begin
if (~resetN) Q1 <= 0; else if (CE1) Q1 <= ~Q1;
if (~resetN) Q2 <= 0; else if (CE2) Q2 <= ~Q2;
end
endmodule

module tb(); //testbench
reg clk,resetN;
wire Q1,Q2;
initial
begin
resetN <= 0;
clk <= 0;
#10 resetN <= 1;
while (1) #100 clk <= ~clk;
end
top UUT(.clk(clk),.resetN(resetN),.Q1(Q1),.Q2(Q2));
endmodule

Best to always use a single clock whenever possible. If you need to
divide more than 16 you'll have to grow cnt, of course...

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Frequency limitations? Joey FPGA 1 05-11-2005 05:15 PM
Bus Frequency !! Joey FPGA 0 04-26-2005 11:17 AM
Frequency synthesizer. chris FPGA 0 06-10-2004 04:38 PM
FREQUENCY DOUBOULER BY MAX PLUS...... [email protected] FPGA 1 05-24-2004 05:22 AM


All times are GMT +1. The time now is 01:27 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved