clock divide by 5

Joined
Mar 16, 2009
Messages
1
Reaction score
0
Hi,

I want to generate a clock which is a divide of 5 from an input clock and with symmetrical duty cycle. Can anyone help me with the vhdl codes? I'm new with VHDL.

Thank you.
 
Joined
Feb 9, 2009
Messages
3
Reaction score
0
The following code would give u some idea

The following code explains how to generate a slower clock from a faster clock. That means it is exactly opposite to clock divider. But I think this would give u some idea about how to make the clock divider.


-----------------------------------------------------------------------------
-- Clk Generator
-----------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
use ieee.std_logic_arith.all;


entity clk_gen is
port (
FClk : in std_logic;
SClk : out std_logic

);
end clk_gen;

architecture behavioral of clk_gen is

begin
process (FClk)
VARIABLE temp : std_logic_vector(2 downto 0):= "000";
begin
IF (FClk'event and FClk = '1') THEN
temp := temp + '1';
SClk <= temp(2);
END IF;
end process;
end behavioral;


--FClk means faster clock
--SClk means slower clock
 
Joined
Dec 9, 2008
Messages
88
Reaction score
0
You are not going to get a 50% duty cycle (2.5/5) unless you can first double your clock and then divide by 10. Do you have a PLL available in your IC?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top