D
Divyang M
Guest
I'm having some trouble with a dual clock design that I am working on.
First the details of what I'm am trying to do:
I have a sys_clk and a fast_clk (where fast_clk is 4 times faster than
the sys_clk). I generate both these clocks using the altpll
megafunction from Altera and the clocks are synchronised.
So, for the part of my design which runs off the sys_clk I start as
follows :
process(start, reset, sys_clk)
begin
if (reset = '1') then -- asynchronous reset
...
else
if(sys_clk = '1' and sys_clk'event) then
if (start = '1') then
... whatever the process has to do..
end if;
end if;
end if;
end process;
which is fine.
NOTE : The 'start' signal is a physical button so may not be generated
with the rising edge but it is only detected at the rising edge (normal
to vhdl designs)
Now, for the part of my design that works on the fast_clk, I want this
process to start when the sys_clk process also sees the start signal.
To make this a little clearer, let T11, T21, T31,.. be the rising edge
of sys_clk and
T11, T12, T13, T14, T21, T22, T23, T24, T31, T32, ... be the rising
edges of the fast_clk
so that T11, T21, ... from both clocks coincide. The clocks are
guaranteed to be synchronised (atleast that's what the altpll claims so
I am believing that)
Now for the fast_clk processes if I use
process(start, reset, fast_clk)
begin
if (reset = '1') then -- asynchronous reset
...
else
if(fast_clk = '1' and fast_clk'event) then
if (start = '1') then
... whatever the process has to do..
end if;
end if;
end if;
end process;
then this might start at Tx1, Tx2, Tx3, or Tx4..it is not know..but
I want it to start at Tx1 so that it coincided with the start of the
process running on sys_clk.
So I've come up with the following:
process(fast_clk, start)
begin
if (fast_clk = '1' and fast_clk'event) then
if (sys_clk = '1' and sys_clk'event and start = '1') then
start_fast <= '1';
end if;
end if;
end process;
Then, I plan to use start_fast (instead of start) in the process
dependent on the fast_clk.
Can anyone please provide me a critique of this and if this will work?
Also, any other alternatives?
Thanks,
Divyang M.
First the details of what I'm am trying to do:
I have a sys_clk and a fast_clk (where fast_clk is 4 times faster than
the sys_clk). I generate both these clocks using the altpll
megafunction from Altera and the clocks are synchronised.
So, for the part of my design which runs off the sys_clk I start as
follows :
process(start, reset, sys_clk)
begin
if (reset = '1') then -- asynchronous reset
...
else
if(sys_clk = '1' and sys_clk'event) then
if (start = '1') then
... whatever the process has to do..
end if;
end if;
end if;
end process;
which is fine.
NOTE : The 'start' signal is a physical button so may not be generated
with the rising edge but it is only detected at the rising edge (normal
to vhdl designs)
Now, for the part of my design that works on the fast_clk, I want this
process to start when the sys_clk process also sees the start signal.
To make this a little clearer, let T11, T21, T31,.. be the rising edge
of sys_clk and
T11, T12, T13, T14, T21, T22, T23, T24, T31, T32, ... be the rising
edges of the fast_clk
so that T11, T21, ... from both clocks coincide. The clocks are
guaranteed to be synchronised (atleast that's what the altpll claims so
I am believing that)
Now for the fast_clk processes if I use
process(start, reset, fast_clk)
begin
if (reset = '1') then -- asynchronous reset
...
else
if(fast_clk = '1' and fast_clk'event) then
if (start = '1') then
... whatever the process has to do..
end if;
end if;
end if;
end process;
then this might start at Tx1, Tx2, Tx3, or Tx4..it is not know..but
I want it to start at Tx1 so that it coincided with the start of the
process running on sys_clk.
So I've come up with the following:
process(fast_clk, start)
begin
if (fast_clk = '1' and fast_clk'event) then
if (sys_clk = '1' and sys_clk'event and start = '1') then
start_fast <= '1';
end if;
end if;
end process;
Then, I plan to use start_fast (instead of start) in the process
dependent on the fast_clk.
Can anyone please provide me a critique of this and if this will work?
Also, any other alternatives?
Thanks,
Divyang M.