J
J.Ram
Guest
Hello ,
I want to generate a clock of 150Khz from system clock(86.4 Mhz) and
requirement is generated 150 khz clock must edge aligned with a
reference clock of 150Khz .
so what i did , i generated a 150Khz from 86.4Mhz clock by divide
factor 576. Finally tried to
align that generated clock with ref_clk of 150Khz(on period is one
cycle of 86.4Mhz).
code is written as follows.
simulation in modelsim is correct but in FPGA it seem that clock is
generated but jitter is present.
Is any other method to do this. I need your suggestions.
----------------------------------------------------------------------------------------
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity clkdivby576_rec is
port(
clk : in std_logic;
ref_clk : in std_logic;
reset : in std_logic;
out_clk_rec_data : out std_logic);
end clkdivby576_rec;
architecture behav of clkdivby576_rec is
signal sig_count : natural range 0 to 575 := 0;
signal temp : std_logic;
begin
acq_data_reset : process(reset,ref_clk,sig_count)
begin
if reset = '1' or sig_count = 1 then
temp <= '0';
elsif ref_clk'event and ref_clk = '1' then
temp <= '1';
end if;
end process acq_data_reset;
p0: process(clk,reset)
variable clk_var : std_logic :=0;
variable count : natural range 0 to 575 := 0;
begin
if rising_edge(clk) then
if temp = '1' then
count := 0:
end if;
if reset = '1' then
clk_var := '0';
count := 0;
else
if count = 575 then
count := 0 ;
else
count := count +1;
end if;
sig_count <= count :
if count >= 287 then
clk_var := '0';
else
clk_var := '1';
end if;
out_clk_rec_data <= clk_var;
end if;
end if;
end process p0;
end behav;
---------------------------------------------------------------------
I want to generate a clock of 150Khz from system clock(86.4 Mhz) and
requirement is generated 150 khz clock must edge aligned with a
reference clock of 150Khz .
so what i did , i generated a 150Khz from 86.4Mhz clock by divide
factor 576. Finally tried to
align that generated clock with ref_clk of 150Khz(on period is one
cycle of 86.4Mhz).
code is written as follows.
simulation in modelsim is correct but in FPGA it seem that clock is
generated but jitter is present.
Is any other method to do this. I need your suggestions.
----------------------------------------------------------------------------------------
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity clkdivby576_rec is
port(
clk : in std_logic;
ref_clk : in std_logic;
reset : in std_logic;
out_clk_rec_data : out std_logic);
end clkdivby576_rec;
architecture behav of clkdivby576_rec is
signal sig_count : natural range 0 to 575 := 0;
signal temp : std_logic;
begin
acq_data_reset : process(reset,ref_clk,sig_count)
begin
if reset = '1' or sig_count = 1 then
temp <= '0';
elsif ref_clk'event and ref_clk = '1' then
temp <= '1';
end if;
end process acq_data_reset;
p0: process(clk,reset)
variable clk_var : std_logic :=0;
variable count : natural range 0 to 575 := 0;
begin
if rising_edge(clk) then
if temp = '1' then
count := 0:
end if;
if reset = '1' then
clk_var := '0';
count := 0;
else
if count = 575 then
count := 0 ;
else
count := count +1;
end if;
sig_count <= count :
if count >= 287 then
clk_var := '0';
else
clk_var := '1';
end if;
out_clk_rec_data <= clk_var;
end if;
end if;
end process p0;
end behav;
---------------------------------------------------------------------