求大神写个VHDL代码
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;