我正在尝试实现一个系统来创建其他系统所需的多个时钟,但我的流程无法正常工作。
似乎没有找到时钟的上升沿,因为计数器保持在 0
mclk 信号由时钟向导 IP 创建。
这是我的代码:
entity clk_generator is
port(
clk : in std_logic; --(100 MHz)
mclk_o : out std_logic; --(22.579 MHz)
bclk : out std_logic; --MCLK/8
lrclk : out std_logic --SCLK/64
);
end clk_generator;
architecture Behavioral of clk_generator is
component clk_wiz_0
port (
mclk : out std_logic;
clk_in1 : in std_logic;
reset : in std_logic := '0'
);
end component;
signal mclk_i : std_logic;
signal bclk_couter: integer :=0;
signal lrclk_couter : integer :=0;
begin
clk_gen : clk_wiz_0
port map(
clk_in1 => clk,
mclk => mclk_i
);
mclk_o <= mclk_i;
process(clk) is
begin
if rising_edge(mclk_i) then
bclk_couter <= bclk_couter +1;
if bclk_couter = 4 then
bclk <= '1';
end if;
if bclk_couter = 8 then
bclk <= '0';
lrclk_couter <= lrclk_couter + 1;
bclk_couter <= 0;
end if;
if lrclk_couter = 32 then
lrclk <= '1';
end if;
if lrclk_couter = 64 then
lrclk <= '0';
lrclk_couter <= 0;
end if;
end if;
end process;
end Behavioral;
我的过程没有像我想象的那样工作,显然没有检测到上升沿
进程上的敏感列表应该是导致模拟重新运行进程的东西。
因此,请在过程敏感度列表中使用正确的时钟。
process(mclk_i) is
begin
if rising_edge(mclk_i) then