📄 count5208.vhd
字号:
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 15:30:53 09/29/07
-- Design Name:
-- Module Name: count5208 - Behavioral
-- Project Name:
-- Target Device:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity clk_div is
port (clk:in std_logic;
b_clk:out std_logic);
end clk_div;
architecture Behavioral of clk_div is
constant zero:std_logic_vector(2 downto 0):=(OTHERS=>'0');
constant ld:std_logic_vector(2 downto 0):="010";
constant md:std_logic_vector(2 downto 0):="100";
signal countr:std_logic_vector(2 downto 0);
signal countf:std_logic_vector(2 downto 0);
signal levelr:std_logic;
signal levelf:std_logic;
begin
process(clk)
begin
if(clk'event and clk='1')then
if(countr=md)then
countr<=zero;
else
countr<=countr+1;
end if;
end if;
end process;
process(clk)
begin
if(clk'event and clk='0')then
if (countf=md)then
countf<=zero;
else
countf<=countf+1;
end if;
end if;
end process;
process(clk)
begin
if(clk'event and clk='1')then
if(countr=zero)then
levelr<='1';
elsif(countr=ld)then
levelr<='0';
end if;
end if;
end process;
process(clk)
begin
if(clk'event and clk='0')then
if(countf=zero)then
levelf<='1';
elsif(countf=ld)then
levelf<='0';
end if;
end if;
end process;
b_clk<=levelr OR levelf;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -