首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

急问三分频的HDL

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity n_div is
port(n:in std_logic_vector(7 downto 0);
clk:in std_logic;
clkoutut std_logic);
end n_div;

architecture rtl of n_div is
signal cnt:std_logic_vector(7 downto 0);
signal n_t,n_1:std_logic_vector(7 downto 0);
begin
n_1<=n-1;
n_t<='0' & n(7 downto 1);
process(n,clk)
begin
if clk'event and clk='1' then
if cnt=n_1 then
cnt<="00000000";
else
cnt<=cnt+1;
end if;
if cnt clkout<='0'
else
clkout<='1';
end if;
end if;
end process;
end rtl;
返回列表