entity keyarray is port(
sysclk : in std_logic
key1 : in std_logic_vector(3 downto 0)
key2 : out std_logic_vector(3 downto 0)
duan : out std_logic_vector(7 downto 0)
wei : out std_logic
)
end keyarray
architecture rtl of keyarray issignal led: std_logic_vector(7 downto 0)
begin
process(sysclk)VARIABLE sig_com : std_logic_vector(3 downto 0) := "1110"
begin
if(sysclk 'event and sysclk='1')then
case sig_com is
WHEN "1110" =>
key2<=sig_com
if(key1/="1111")then
led<=sig_com &key1
sig_com:="1110"
else
sig_com:="1101"
end if
WHEN "1101" =>
key2<=sig_com
if(key1/="1111")then
led<=sig_com&key1
sig_com:="1101"
else
sig_com:="1011"
end if
WHEN "1011" =>
key2<=sig_com
if(key1/="1111")then
led<=sig_com&key1
sig_com:="1011"
else
sig_com:="0111"弯亮枝
end if
WHEN "0111" =>
key2<=sig_com
if(key1/="1111")then
led<=sig_com &key1
sig_com:="0111"
else
sig_com:="1110"
end if
when others =>sig_com:="1110"
end case
end if
end process
process(sysclk)begin
wei<='1'
case led is
when "01110111" =>duan <埋敏="11111000" --7
when "10110111" =>duan <="10000011" --b
when "11010111" =>duan <="10001110" --f
when "11100111" =>duan <="10110000" --3
when "01111110" =>duan <="10011001" --4
when "10111110" =>duan <="键御10000000" --8
when "11011110" =>duan <="11000110" --c
when "11101110" =>duan <="11000000" --0
when "01111101" =>duan <="10010010" --5
when "10111101" =>duan <="10010000" --9
when "11011101" =>duan <="10100001" --d
when "11101101" =>duan <="11111001" --1
when "01111011" =>duan <="10000010" --6
when "10111011" =>duan <="10001000" --a
when "11011011" =>duan <="10000110" --e
when "11101011" =>duan <="10100100" --2
when others=>duan <="11000000" --0
end case
end process
end rtl
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)