?? baijinzhi.txt
字號:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity counter100 is
Port(--clk:in std_logic;
saomiao:in std_logic;
led:out std_logic_vector(6 downto 0);
ss0:out std_logic
);
end counter100;
architecture action of counter100 is
signal count_low: std_logic_vector(3 downto 0);
signal count_high:std_logic_vector(3 downto 0);
signal c:std_logic;
signal fenpin:std_logic_vector(5 downto 0);
signal j:std_logic;
signal clk:std_logic;
begin
process(saomiao)
begin
if(saomiao'event and saomiao='1') then
fenpin<=fenpin+1;
clk<=fenpin(5);
end if ;
end process;
process(clk)
begin
if(clk'event and clk='1') then
if (count_low=9) then
count_low<="0000";
c<='1';
else count_low<=count_low+1;
c<='0';
end if;
end if;
end process;
process(c)
begin
if(c'event and c='1') then
if (count_high=9) then
count_high<="0000";
else count_high<=count_high+1;
end if;
end if;
end process;
process(count_low)
begin
if j='0' then
case count_low is
when"0000"=>led<="0111111";
when"0001"=>led<="0000110";
when"0010"=>led<="1011011";
when"0011"=>led<="1001111";
when"0100"=>led<="1100110";
when"0101"=>led<="1101101";
when"0110"=>led<="1111101";
when"0111"=>led<="0100111";
when"1000"=>led<="1111111";
when"1001"=>led<="1101111";
when others=>led<="0000000";
end case;
else
case count_high is
when"0000"=>led<="0111111";
when"0001"=>led<="0000110";
when"0010"=>led<="1011011";
when"0011"=>led<="1001111";
when"0100"=>led<="1100110";
when"0101"=>led<="1101101";
when"0110"=>led<="1111101";
when"0111"=>led<="0100111";
when"1000"=>led<="1111111";
when"1001"=>led<="1101111";
when others=>led<="0000000";
end case;
end if;
end process;
process(saomiao)
begin
if saomiao'event and saomiao='1' then
if j='0' then j<='1';
else j<='0';
end if ;
ss0<=j;
end if;
end process;
end action;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -