急求VHDL带异步清零和同步使能功能的四位加法计数器的源程序清单,谢谢~
答案:1 悬赏:50
解决时间 2021-01-16 22:07
- 提问者网友:且恨且铭记
- 2021-01-16 12:46
急求VHDL带异步清零和同步使能功能的四位加法计数器的源程序清单,谢谢~
最佳答案
- 二级知识专家网友:孤老序
- 2021-01-16 13:46
VHDL语言设计一个带异步清零和同步使能的4位二进制加法计数器源程序如下,程序仿真结果如图所示
LIBRARY ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--*-------------------------------------------------------*--
ENTITY counter4 IS
PORT(clk : in std_logic;
clr : in std_logic;
enable : in std_logic;
Q : out std_logic_vector(3 downto 0));
End counter4;
--*------------------------------------------------------*--
ARCHITECTURE arch OF counter4 IS
signal dout : std_logic_vector(3 downto 0);
begin
P1 : process(clk,clr)
begin
if clr='0' then
dout <= "0000";
elsif clk'event and clk='1' then
if enable='1' then
dout <= dout+1;
elsif enable='0' then
dout <= dout;
end if;
end if;
end process P1;
P2 : process(dout)
begin
Q <= dout;
end process P2;
end arch;
--*-------------------------------------------------------*--
LIBRARY ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--*-------------------------------------------------------*--
ENTITY counter4 IS
PORT(clk : in std_logic;
clr : in std_logic;
enable : in std_logic;
Q : out std_logic_vector(3 downto 0));
End counter4;
--*------------------------------------------------------*--
ARCHITECTURE arch OF counter4 IS
signal dout : std_logic_vector(3 downto 0);
begin
P1 : process(clk,clr)
begin
if clr='0' then
dout <= "0000";
elsif clk'event and clk='1' then
if enable='1' then
dout <= dout+1;
elsif enable='0' then
dout <= dout;
end if;
end if;
end process P1;
P2 : process(dout)
begin
Q <= dout;
end process P2;
end arch;
--*-------------------------------------------------------*--
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息