OpenCores
no use no use 1/1 no use no use
a bit of newbie advice ..
by Unknown on Mar 2, 2005
Not available!

Hi,

I'm a bit new to verilog and I have the situation where I want to generate a clock
from a clock available on the board, however the ratio is 3.5:1 i.e. I want a
8 MHz clock from a 28MHz clock source.

Does anybody have any hint's or pointers in the right direction ?

Right now I am thinking of adding a secondary clock source, but I would be glad if
I could avoid it :-) .

/ regards, Lars Segerlund

a bit of newbie advice ..
by Unknown on Mar 2, 2005
Not available!
Hi, I'm a bit new to verilog and I have the situation where I want to generate a clock from a clock available on the board, however the ratio is 3.5:1 i.e. I want a 8 MHz clock from a 28MHz clock source. Does anybody have any hint's or pointers in the right direction ? Right now I am thinking of adding a secondary clock source, but I would be glad if I could avoid it :-) . / regards, Lars Segerlund _______________________________________________ http://www.opencores.org/mailman/listinfo/cores


Lars,

You could do something like this:
_ _ _ _ _ _ _
| |_| |_| |_| |_| |_| |_| |_ 28MHz clock
_______ _______
| |_______| |___ 8MHz clock (on average)

Regards,

David.


a bit of newbie advice ..
by Unknown on Mar 2, 2005
Not available!
You can achieve this using combinatorial logic with feedback.

Basically you need to produce a state machine which changes state on both
clock edges but doesn't use clocked registers to achieve this (as most
registers will only clock on one edge). In your design you have to very
careful about race conditions as they can stop the whole thing from working.
If you can do a search on OpenCores (it wasn't working for me) I posted the
code for a divide by 1.5 clock I think some time ago.

If that isn't enough to get you going then post again and I'll think on your
problem some more. It is solvable though.

Colin

I'm a bit new to verilog and I have the situation where I want
to generate a clock
from a clock available on the board, however the ratio is 3.5:1
i.e. I want a
8 MHz clock from a 28MHz clock source.

Does anybody have any hint's or pointers in the right direction ?

Right now I am thinking of adding a secondary clock source, but
I would be glad if
I could avoid it :-) .

/ regards, Lars Segerlund


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.5.7 - Release Date: 01/03/2005



a bit of newbie advice ..
by Unknown on Mar 2, 2005
Not available!
On Wed, 2 Mar 2005 17:25:34 +0100, Lars Segerlund lars.segerlund at comsys.se> wrote:

Hi,

I'm a bit new to verilog and I have the situation where I want to generate a clock
from a clock available on the board, however the ratio is 3.5:1 i.e. I want a
8 MHz clock from a 28MHz clock source.

Does anybody have any hint's or pointers in the right direction ?

Right now I am thinking of adding a secondary clock source, but I would be glad if
I could avoid it :-) .


One way you could tackle it is to use an on-chip PLL to multiply up
your clock source x2 (to 56 Mhz), then create a simple state machine
to divide by 7. If you're desiging with something that has built-in
PLLs and you're willing to live with a little jitter, it's cleaner
than trying to figure out how to create glitch-free combinatorial
logic.

- Guy


a bit of newbie advice ..
by Unknown on Mar 2, 2005
Not available!
Hi Lars, Assuming your design has close to a 50% duty cycle on your 28Mhz clock source and your system doesn't care about jitter in the 8Mhz clock you could try something like this... Generate two 4 Mhz clocks by dividing the 28Mhz by 7. One clock is generated on the positive edge of the clock and the other on the negative edge. You would then or the two clocks togethor to generate the 8Mhz clock. Here's some VHDL code that shows my solution... library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity clk28to8 is Port ( clk28 : in std_logic; resetn : in std_logic; clk8 : out std_logic ); end clk28to8; architecture RTL of clk28to8 is signal clk8pos : std_logic; signal clk8neg : std_logic; begin -- Or two outputs to generate clock clk8 '0' ); elsif clk28'event and clk28 = '1' then if pos_cnt = 1 or pos_cnt = 2 then pos_cnt := pos_cnt + 1; clk8pos '0' ); clk8pos '0' ); elsif clk28'event and clk28 = '0' then -- use the positive clock to sync the negative edge of the clock if clk8pos = '1' then neg_cnt := (others => '0' ); clk8neg '0' ); clk8neg lars.segerlund at c...> To: Date: Wed Mar 2 17:25:34 CET 2005 Subject: [oc] a bit of newbie advice ..
Hi,
I'm a bit new to verilog and I have the situation where I want to
generate a clock
from a clock available on the board, however the ratio is 3.5:1
i.e. I want a
8 MHz clock from a 28MHz clock source.
Does anybody have any hint's or pointers in the right direction ?
Right now I am thinking of adding a secondary clock source, but I
would be glad if
I could avoid it :-) .
/ regards, Lars Segerlund




a bit of newbie advice ..
by Unknown on Mar 4, 2005
Not available!
Thanks again, This does the trick. / regards, Lars Segerlund. On Wed, 2 Mar 2005 22:44:20 +0100 mrussell at design-group.com wrote:
Hi Lars, Assuming your design has close to a 50% duty cycle on your 28Mhz clock source and your system doesn't care about jitter in the 8Mhz clock you could try something like this... Generate two 4 Mhz clocks by dividing the 28Mhz by 7. One clock is generated on the positive edge of the clock and the other on the negative edge. You would then or the two clocks togethor to generate the 8Mhz clock. Here's some VHDL code that shows my solution... library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity clk28to8 is Port ( clk28 : in std_logic; resetn : in std_logic; clk8 : out std_logic ); end clk28to8; architecture RTL of clk28to8 is signal clk8pos : std_logic; signal clk8neg : std_logic; begin -- Or two outputs to generate clock clk8 '0' ); elsif clk28'event and clk28 = '1' then if pos_cnt = 1 or pos_cnt = 2 then pos_cnt := pos_cnt + 1; clk8pos '0' ); clk8pos '0' ); elsif clk28'event and clk28 = '0' then -- use the positive clock to sync the negative edge of the clock if clk8pos = '1' then neg_cnt := (others => '0' ); clk8neg '0' ); clk8neg lars.segerlund at c...> To: Date: Wed Mar 2 17:25:34 CET 2005 Subject: [oc] a bit of newbie advice ..
> Hi,
> I'm a bit new to verilog and I have the situation where I want to
> generate a clock
> from a clock available on the board, however the ratio is 3.5:1
> i.e. I want a
> 8 MHz clock from a 28MHz clock source.
> Does anybody have any hint's or pointers in the right direction ?
> Right now I am thinking of adding a secondary clock source, but I
> would be glad if
> I could avoid it :-) .
> / regards, Lars Segerlund
>
>
_______________________________________________ http://www.opencores.org/mailman/listinfo/cores



no use no use 1/1 no use no use
© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.