用VHDL设计一个异步置数,同步清零,计数使能和进位输出信号的16位二进制加法计数器
2013-07-23
展开全部
我写了一个,k是控制置数的,en是计数使能,clr是清零,下面附上了我的仿真波形图。
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;
entity cnt_16 is
port (
clk: in STD_LOGIC;
qin: in STD_LOGIC_VECTOR (15 downto 0);
clr:in std_logic;
k: in std_logic;
en: in STD_LOGIC;
qout: out STD_LOGIC_VECTOR (15 downto 0);
q: out STD_LOGIC
);
end cnt_16;
architecture cnt_16_arch of cnt_16 is
signal qqout:std_logic_vector(15 downto 0);
signal qq:std_logic;
begin
process(k,qin,en,clk,clr)
begin
if k='1' then
qqout<=qin;
else
if clk'event and clk='1' then
if clr='1' then
qqout<="0000000000000000";
elsif en='1' then
if qqout="1111111111111111" then
qq<='1' ;
qqout<="0000000000000000";
else
qqout<=qqout+'1';
end if;
end if;
end if;
end if;
end process;
suocun: process(qqout,qq)
begin
q<=qq;
qout<=qqout;
end process suocun;
end cnt_16_arch;
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;
entity cnt_16 is
port (
clk: in STD_LOGIC;
qin: in STD_LOGIC_VECTOR (15 downto 0);
clr:in std_logic;
k: in std_logic;
en: in STD_LOGIC;
qout: out STD_LOGIC_VECTOR (15 downto 0);
q: out STD_LOGIC
);
end cnt_16;
architecture cnt_16_arch of cnt_16 is
signal qqout:std_logic_vector(15 downto 0);
signal qq:std_logic;
begin
process(k,qin,en,clk,clr)
begin
if k='1' then
qqout<=qin;
else
if clk'event and clk='1' then
if clr='1' then
qqout<="0000000000000000";
elsif en='1' then
if qqout="1111111111111111" then
qq<='1' ;
qqout<="0000000000000000";
else
qqout<=qqout+'1';
end if;
end if;
end if;
end if;
end process;
suocun: process(qqout,qq)
begin
q<=qq;
qout<=qqout;
end process suocun;
end cnt_16_arch;
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询