我已完成以下代码,不知延时怎么加!大神求帮助! 求大神帮助!
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
en
tity test4 is
port (clk,clr,en : in std_logic;
co : out std_logic;
dout : out std_logic_vector(3 downto 0);
m: out std_logic_vector(3 downto 0);
SEGOUT : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
SELOUT : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
end test4;
architecture behav of test4 is
SIGNAL SEC : STD_LOGIC_VECTOR(3 DOWNTO 0);
begin
process(clk,clr,en)
variable Q : std_logic_vector(3 downto 0);
begin
m<="0001";
if en='1' then
if clk'event and clk='1' then
if clr='1' then Q:=(others=>'0');
elsif Q<9 then Q := Q + 1;
else Q:=(others=>'0');
end if;
end if;
end if;
if Q="0000" then co<='1';
else co<='0'; end if;
SEC<=Q;
CASE SEC IS
WHEN "0000"=>SEGOUT<="00111111"; SELOUT<="01111111";
WHEN "0001"=>SEGOUT<="00000110"; SELOUT<="01111111";
WHEN "0010"=>SEGOUT<="01011011"; SELOUT<="01111111";
WHEN "0011"=>SEGOUT<="01001111"; SELOUT<="01111111";
WHEN "0100"=>SEGOUT<="01100110"; SELOUT<="01111111";
WHEN "0101"=>SEGOUT<="01101101"; SELOUT<="01111111";
WHEN "0110"=>SEGOUT<="01111101"; SELOUT<="01111111";
WHEN "0111"=>SEGOUT<="00000111"; SELOUT<="01111111";
WHEN "1000"=>SEGOUT<="01111111"; SELOUT<="01111111";
WHEN "1001"=>SEGOUT<="01101111"; SELOUT<="01111111";
WHEN OTHERS=>NULL;
end CASE;
dout <= Q;
end process;
end behav;
一周热门 更多>