正在加载图片...
architecture behave of keyscan is signal display std_logic_vector(6 downto 0): signal dcount std_logic_vector(2 downto 0); signal keyr,keyc std_logic_vector(3 downto 0); signal kcount std_logic_vector(2 downto 0); signal kflagl,kflag2 std logic; signal buff0,buff1,buff2,buff3,buff4,buff5,buff6,buff7 std_logic_vector(6 downto 0); begin process(clk) --In this process,two counts will accumulate begin if(clk'event and clk='1')then dcount<=dcount+l; kcount<=kcount+1; end if; end process; process(clk) --In this process, the main task is to scan keyboard begin if(clk'event and clk='1')then if(kcount=0)then k<="1111"; kc<="0000”: elsif(kcount=1)then keyr<=kr: … keyc<=kc; end if; end if; end process; process(clk) change the key flags begin if(clk'event and clk='1')then if(kcount=4 and keyr="1111")then kf1ag1<='0': elsif(kcount=4)then kf1ag1<'1': end if; kflag2<=kflagl; end if; end process: process(clk) -- shift the displays begin if(clk'event and clk='1')then if(kcount=5 and kflagl='1'and kflag2='0')then buffO<=buffl; … buff6<=buff7: end if;-------------------------------------------------------------------- architecture behave of keyscan is signal display : std_logic_vector(6 downto 0); signal dcount : std_logic_vector(2 downto 0); signal keyr,keyc : std_logic_vector(3 downto 0); signal kcount : std_logic_vector(2 downto 0); signal kflag1,kflag2 : std_logic; signal buff0,buff1,buff2,buff3,buff4,buff5,buff6,buff7 : std_logic_vector(6 downto 0); begin process(clk) --In this process, two counts will accumulate begin if(clk'event and clk='1') then dcount<=dcount+1; kcount<=kcount+1; end if; end process; process(clk) --In this process, the main task is to scan keyboard begin if(clk'event and clk='1') then if(kcount=0) then kr<="1111"; kc<="0000"; elsif(kcount=1) then keyr<=kr; …… keyc<=kc; end if; end if; end process; process(clk) -- change the key flags begin if(clk'event and clk='1') then if(kcount=4 and keyr="1111") then kflag1<='0'; elsif(kcount=4) then kflag1<='1'; end if; kflag2<=kflag1; end if; end process; process(clk) -- shift the displays begin if(clk'event and clk='1') then if(kcount=5 and kflag1='1' and kflag2='0') then buff0<=buff1; …… buff6<=buff7; end if;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有