📄 gd.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity gd is
port(clk:in std_logic;
ho:out std_logic_vector(7 downto 0);
lo:out std_logic_vector(7 downto 0));
end gd;
architecture gd of gd is
signal cnt:std_logic_vector(10 downto 0):="00000000000";
signal cou:std_logic_vector(2 downto 0):="000";
signal count:std_logic_vector(3 downto 0):="0000";
begin
process(clk)
begin
if(clk'event and clk='1')then
--if st="11" then
cnt<=cnt+1;
--else cnt<="00000000000";
--end if;
end if;
count(3 downto 0)<=cnt(10 downto 7);
cou(2 downto 0)<=cnt(2 downto 0);
if count="0000"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11010111";
when"001"=>ho<="01000000";lo<="11010111";
when"010"=>ho<="00100000";lo<="11010111";
when"011"=>ho<="00010000";lo<="00010001";
when"100"=>ho<="00001000";lo<="11010111";
when"101"=>ho<="00000100";lo<="11010111";
when"110"=>ho<="00000010";lo<="00010001";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0001"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="01011111";
when"001"=>ho<="01000000";lo<="01011111";
when"010"=>ho<="00100000";lo<="01011100";
when"011"=>ho<="00010000";lo<="01000101";
when"100"=>ho<="00001000";lo<="01011100";
when"101"=>ho<="00000100";lo<="01011101";
when"110"=>ho<="00000010";lo<="01000100";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0010"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="01111101";
when"001"=>ho<="01000000";lo<="01111101";
when"010"=>ho<="00100000";lo<="01110000";
when"011"=>ho<="00010000";lo<="00010101";
when"100"=>ho<="00001000";lo<="01110000";
when"101"=>ho<="00000100";lo<="01110101";
when"110"=>ho<="00000010";lo<="00010000";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0011"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11110111";
when"001"=>ho<="01000000";lo<="11110111";
when"010"=>ho<="00100000";lo<="11000001";
when"011"=>ho<="00010000";lo<="01010101";
when"100"=>ho<="00001000";lo<="11000001";
when"101"=>ho<="00000100";lo<="11010101";
when"110"=>ho<="00000010";lo<="01000001";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0100"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11011111";
when"001"=>ho<="01000000";lo<="11011100";
when"010"=>ho<="00100000";lo<="00000101";
when"011"=>ho<="00010000";lo<="01010100";
when"100"=>ho<="00001000";lo<="00000101";
when"101"=>ho<="00000100";lo<="01010100";
when"110"=>ho<="00000010";lo<="00000101";
when"111"=>ho<="00000001";lo<="11111101";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0101"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="01111111";
when"001"=>ho<="01000000";lo<="01110001";
when"010"=>ho<="00100000";lo<="00010101";
when"011"=>ho<="00010000";lo<="01010011";
when"100"=>ho<="00001000";lo<="00010101";
when"101"=>ho<="00000100";lo<="01010011";
when"110"=>ho<="00000010";lo<="00010111";
when"111"=>ho<="00000001";lo<="11110111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0110"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11111100";
when"001"=>ho<="01000000";lo<="11000101";
when"010"=>ho<="00100000";lo<="01010101";
when"011"=>ho<="00010000";lo<="01001100";
when"100"=>ho<="00001000";lo<="01010111";
when"101"=>ho<="00000100";lo<="01001111";
when"110"=>ho<="00000010";lo<="01011100";
when"111"=>ho<="00000001";lo<="11011111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="0111"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11110000";
when"001"=>ho<="01000000";lo<="00010111";
when"010"=>ho<="00100000";lo<="01010111";
when"011"=>ho<="00010000";lo<="00110000";
when"100"=>ho<="00001000";lo<="01011111";
when"101"=>ho<="00000100";lo<="00111111";
when"110"=>ho<="00000010";lo<="01110000";
when"111"=>ho<="00000001";lo<="01111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1000"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11000001";
when"001"=>ho<="01000000";lo<="01011111";
when"010"=>ho<="00100000";lo<="01011111";
when"011"=>ho<="00010000";lo<="11000001";
when"100"=>ho<="00001000";lo<="01111101";
when"101"=>ho<="00000100";lo<="11111101";
when"110"=>ho<="00000010";lo<="11000001";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1001"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="00000110";
when"001"=>ho<="01000000";lo<="01111110";
when"010"=>ho<="00100000";lo<="01111110";
when"011"=>ho<="00010000";lo<="00000110";
when"100"=>ho<="00001000";lo<="11110110";
when"101"=>ho<="00000100";lo<="11110110";
when"110"=>ho<="00000010";lo<="00000110";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1010"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="00011000";
when"001"=>ho<="01000000";lo<="11111011";
when"010"=>ho<="00100000";lo<="11111011";
when"011"=>ho<="00010000";lo<="00011011";
when"100"=>ho<="00001000";lo<="11011011";
when"101"=>ho<="00000100";lo<="11011011";
when"110"=>ho<="00000010";lo<="00011000";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1011"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="01100000";
when"001"=>ho<="01000000";lo<="11101110";
when"010"=>ho<="00100000";lo<="11101110";
when"011"=>ho<="00010000";lo<="01101110";
when"100"=>ho<="00001000";lo<="01101110";
when"101"=>ho<="00000100";lo<="01101110";
when"110"=>ho<="00000010";lo<="01100000";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1100"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="10000011";
when"001"=>ho<="01000000";lo<="10111011";
when"010"=>ho<="00100000";lo<="10111011";
when"011"=>ho<="00010000";lo<="10111011";
when"100"=>ho<="00001000";lo<="10111011";
when"101"=>ho<="00000100";lo<="10111011";
when"110"=>ho<="00000010";lo<="10000011";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1101"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="00001111";
when"001"=>ho<="01000000";lo<="11101111";
when"010"=>ho<="00100000";lo<="11101111";
when"011"=>ho<="00010000";lo<="11101100";
when"100"=>ho<="00001000";lo<="11101111";
when"101"=>ho<="00000100";lo<="11101111";
when"110"=>ho<="00000010";lo<="00001100";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1110"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="00111101";
when"001"=>ho<="01000000";lo<="10111101";
when"010"=>ho<="00100000";lo<="10111101";
when"011"=>ho<="00010000";lo<="10110001";
when"100"=>ho<="00001000";lo<="10111101";
when"101"=>ho<="00000100";lo<="10111101";
when"110"=>ho<="00000010";lo<="00110001";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
elsif count="1111"then
case cou(2 downto 0) is
when"000"=>ho<="10000000";lo<="11110101";
when"001"=>ho<="01000000";lo<="11110101";
when"010"=>ho<="00100000";lo<="11110101";
when"011"=>ho<="00010000";lo<="11000100";
when"100"=>ho<="00001000";lo<="11110101";
when"101"=>ho<="00000100";lo<="11110101";
when"110"=>ho<="00000010";lo<="11000100";
when"111"=>ho<="00000001";lo<="11111111";
when others=>ho<="00000000";lo<="11111111";
end case;
else ho<="00000000";lo<="11111111";
end if;
end process;
end ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -