本帖最后由 fpgaw 于 2010-11-18 16:15 编辑
我想用一个主时钟来产生如图1所示的四个时钟,程序如下
library ieee ;
use ieee.std_logic_1164.all ;
entity cycles is
port (
clock_main , rst: in std_logic ;
c0, c1, c2, c3 : out std_logic) ;
end cycles ;
architecture rtl of cycles is
type state_values is (st0 , st1 , st2 ,st3) ;
signal pres_state , next_state : state_values ;
begin
process (clock_main , rst)
begin
if (rst = '1') then
pres_state <= st0 ;
elsif (clock_main'event and clock_main= '1') then
pres_state <= next_state ;
end if ;
end process ;
process(pres_state)
begin
case pres_state is
when st0 =>
c0 <= '1' ;
c1 <= '0' ;
c2 <= '0' ;
c3 <= '0' ;
next_state <= st1 ;
when st1 =>
c0 <= '0' ;
c1 <= '1' ;
c2 <= '0' ;
c3 <= '0' ;
next_state <= st2 ;
when st2 =>
c0 <= '0' ;
c1 <= '0' ;
c2 <= '1' ;
c3 <= '0' ;
next_state <= st3 ;
when st3 =>
c0 <= '0' ;
c1 <= '0' ;
c2 <= '0' ;
c3 <= '1' ;
next_state <= st0 ;
when others =>
next_state <= st0 ;
end case ;
end process ;
end rtl ;
为什么我产生的时钟c0,c1,c2,c3和主时钟clock_main的边沿有很大的时延呢,如图2,我怎么改都是这样,而且主时钟clock_main不同,时延也不同 |