求带异步复位的4位二进制减计数器VHDL代码 及带异步复位的8421码十进制计数器

如题所述

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

entity count1 is
port
(ci:in std_logic; --计数信号
reset: in std_logic; --异步复位
load: in std_logic; --同步置数
clk: in std_logic;
d : in std_logic_vector(3 downto 0); --置数值
q : buffer std_logic_vector(3 downto 0);
co: out std_logic --计数溢出标志
);
end count1;

architecture behave of count1 is
begin
process(clk,reset)
begin
if(reset='0') then
q<="0000";
elsif(clk'event and clk='1') then
if(load='1') then
q<=d;
elsif(ci='1') then
if(q=0) then
q<="1111";
co<='1';
else
q<=q-1;
co<='0';
end if;
end if;
end if;
end process;
end behave;
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-04-19
我的思路是找出真值表然后case语句就解决了,我也bupt的...
第2个回答  2011-04-19
实验8~~铜球
第3个回答  2011-04-17
bupt的?