📄 clk.vhd
字号:
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity clkdiv is
port
(
clk_in:in std_logic;
rd_clk:out std_logic;
wr_clk:out std_logic
);
end clkdiv;
---------------时钟分频器产生读写时钟信号-----------------------------------------
architecture Behavioral of clkdiv is
signal dagPL_clk_temp1_q:std_logic:='0';
signal dagPL_clk_temp2_q:std_logic:='0';
signal count1:std_logic_vector(2 downto 0):="000";
signal count2:std_logic_vector(2 downto 0):="000";
begin
rdclk: process(clk_in)
begin
if(clk_in'event and clk_in='1')then
if(count1 /= 2) then
count1 <= count1 + 1;
else
count1 <= (others =>'0');
dagPL_clk_temp1_q <= not dagPL_clk_temp1_q;
end if;
end if;
end process;
rd_clk<=dagPL_clk_temp1_q;
wrclk:process(clk_in)
begin
if(clk_in'event and clk_in='1')then
if(count2 /= 1) then
count2 <= count2 + 1;
else
count2 <= (others =>'0');
dagPL_clk_temp2_q<= not dagPL_clk_temp2_q;
end if;
end if;
end process;
wr_clk<=dagPL_clk_temp2_q;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -