求大神写个VHDL代码

2019-07-15 21:21发布

用VHDL语言描述一个带有异步置位/同步复位功能且课增减方向的8位循环计数器逻辑
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
1条回答
Zj_3d0
1楼-- · 2019-07-16 02:09
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 using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity CNT1 is
        port(clk :         in         std_logic;
                  rst :         in         std_logic;
                  updown: in         std_logic;
                  q         :         out std_logic_vector(7 downto 0)
                  );
end CNT1;

architecture Behavioral of CNT1 is
        signal q1 :     std_logic_vector(7 downto 0);
        

begin
        process(clk)
                begin
                        if clk'event and clk='1'  then
                                if rst='1' then
                                        q1<="00000000";
                                elsif updown='1'        then
                                                q1<=q1+1;
                                        else
                                                q1<=q1-1;
                                end if;
                        end if;
        end process;
                        q<=q1;
end Behavioral;

一周热门 更多>