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

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-26-2008, 12:56 AM
benn
Guest
 
Posts: n/a
Default Is there a usual way to generate one clock from another?

I have a 25Mhz clock that I wish to divide down to around 1.5Mhz..

I tried looking for examples, but it seems they all use PLLs! Is
something like this the way its normally done:

wire oClk_1p5MHz;
reg [16:0] Counter;

always@ (posedge iClk_25Mhz)
begin
Counter <= Counter + 1'b1;
End


assign oClk_1p5MHz = Counter[3]; // Counter[0] = Input/2, Counter[1]
= Input/4, Counter[2]/8; Counter[3]/16


Is this normally considered the preferred (safe) method, or will this
blow up when things wrap around?
Reply With Quote
  #2 (permalink)  
Old 07-26-2008, 04:24 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Is there a usual way to generate one clock from another?

benn wrote:
> I have a 25Mhz clock that I wish to divide down to around 1.5Mhz..


I would use a larger counter and a larger increment constant.
Read up on phase accumulators.

-- Mike Treseler
Reply With Quote
  #3 (permalink)  
Old 07-26-2008, 04:50 PM
gabor
Guest
 
Posts: n/a
Default Re: Is there a usual way to generate one clock from another?

On Jul 26, 10:24 am, Mike Treseler <mtrese...@gmail.com> wrote:
> benn wrote:
> > I have a 25Mhz clock that I wish to divide down to around 1.5Mhz..

>
> I would use a larger counter and a larger increment constant.
> Read up on phase accumulators.
>
> -- Mike Treseler


If the OP only wanted "around" 1.5 MHz, the code posted
should work fine. What you need to avoid is gating the
outputs of the counter. Using any single bit of a
counter will not have glitches. If you need a function
of the counter bits, the best bet is to register
the function with the input clock and define the function
accordingly if the extra clock of latency matters.

For example if you wnated to divide your clock by 18 but
have a 50% duty cycle, you could not just use the MSB
of the counter. Your logic would necessarily be a function
of more than one bit (unless you use non-binary coding or
two counters). In that case you would want to run the
combinatorial function through another flip-flop before
using it as a clock.

By the way, I'm surprised that Mike didn't give his usual
spiel about not using multiple clocks and just creating a
clock enable at 1.5 MHz instead...
Reply With Quote
  #4 (permalink)  
Old 07-26-2008, 11:00 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Is there a usual way to generate one clock from another?

gabor wrote:

> By the way, I'm surprised that Mike didn't give his usual
> spiel about not using multiple clocks and just creating a
> clock enable at 1.5 MHz instead...


I've seen the light.
Those who haven't been bitten yet
will disregard such advice because there is no problem.
Those who have been bitten, don't need the advice.

-- Mike Treseler
Reply With Quote
  #5 (permalink)  
Old 07-28-2008, 02:50 AM
Mark McDougall
Guest
 
Posts: n/a
Default Re: Is there a usual way to generate one clock from another?

Mike Treseler wrote:

> I've seen the light.
> Those who haven't been bitten yet
> will disregard such advice because there is no problem.
> Those who have been bitten, don't need the advice.


IOW, Got to be cruel to be kind eh Mike?

Regards,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
Reply With Quote
  #6 (permalink)  
Old 07-30-2008, 07:42 AM
tiwari
Guest
 
Posts: n/a
Default Re: Is there a usual way to generate one clock from another?

On Jul 26, 3:56*am, benn <benn...@hotmail.com> wrote:
> I have a 25Mhz clock that I wish to divide down to around 1.5Mhz..
>
> I tried looking for examples, but it seems they all use PLLs! * * Is
> something like this the way its normally done:
>
> wire oClk_1p5MHz;
> reg [16:0] Counter;
>
> always@ (posedge iClk_25Mhz)
> begin
> * * * * Counter <= Counter + 1'b1;
> End
>
> assign *oClk_1p5MHz = Counter[3]; // Counter[0] = Input/2, Counter[1]
> = Input/4, Counter[2]/8; Counter[3]/16
>
> Is this normally considered the preferred (safe) method, or will this
> blow up when things wrap around?


Actually, this method will not generate a accurate 1.5Mhz clock. For
exact 1.5MHz clk, first you have have to generate a 75Mhz clk from
25mhz clk and then divide 75MHz clock by 50 to get exact 1.5MHz clock.
Reply With Quote
  #7 (permalink)  
Old 07-30-2008, 02:53 PM
Allan Herriman
Guest
 
Posts: n/a
Default Re: Is there a usual way to generate one clock from another?

tiwari <[email protected]> wrote in news:c5d255b6-abf6-425a-a9c2-
[email protected]:

> On Jul 26, 3:56*am, benn <benn...@hotmail.com> wrote:
>> I have a 25Mhz clock that I wish to divide down to around 1.5Mhz..
>>
>> I tried looking for examples, but it seems they all use PLLs! * * Is
>> something like this the way its normally done:
>>
>> wire oClk_1p5MHz;
>> reg [16:0] Counter;
>>
>> always@ (posedge iClk_25Mhz)
>> begin
>> * * * * Counter <= Counter + 1'b1;
>> End
>>
>> assign *oClk_1p5MHz = Counter[3]; // Counter[0] = Input/2, Counter[

> 1]
>> = Input/4, Counter[2]/8; Counter[3]/16
>>
>> Is this normally considered the preferred (safe) method, or will this
>> blow up when things wrap around?

>
> Actually, this method will not generate a accurate 1.5Mhz clock. For
> exact 1.5MHz clk, first you have have to generate a 75Mhz clk from
> 25mhz clk and then divide 75MHz clock by 50 to get exact 1.5MHz clock.



I'm betting it's 1.544MHz anyway. Are there any other commonly
encountered frequencies close to 1.5MHz?

Allan
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
MI5 Persecution: Usual targets of such abuse 10/10/96 (5536) [email protected] Verilog 0 08-20-2007 05:13 PM
Single clock pulse transfer b/w clock domain himassk Verilog 3 05-18-2007 08:10 AM
GENERATE bir Verilog 2 11-23-2006 05:37 PM
how to generate a random time sequency clock signal? Paul Verilog 4 04-18-2006 02:28 AM
generate a 20 MHZ clock(pulse) with duty cycle other than 50 % from master clock 40 MHZ having 50 % duty cycle MegaPowerStar Verilog 2 08-19-2003 02:29 AM


All times are GMT +1. The time now is 03:31 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