?? ball.vhd
字號(hào):
--乒乓球燈模塊
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ball is
port(clk:in std_logic;--乒乓球燈前進(jìn)時(shí)鐘
clr:in std_logic;--乒乓球燈清零
way:in std_logic;--乒乓球燈前進(jìn)方向
en:in std_logic;--乒乓球燈使能
ballout:out std_logic_vector(7 downto 0));--乒乓球燈
end ball;
architecture ful of ball is
signal lamp:std_logic_vector(9 downto 0);
begin
process(clk,clr,en)
begin
if(clr='1') then--清零
lamp<="1000000001";
elsif en='0' then
elsif (clk'event and clk='1') then--使能允許,乒乓球燈前進(jìn)時(shí)鐘上升沿
if(way='1') then--乒乓球燈右移
lamp(9 downto 1)<=lamp(8 downto 0);
lamp(0)<='0';
else--乒乓球燈左移
lamp(8 downto 0)<=lamp(9 downto 1);
lamp(9)<='0';
end if;
end if;
ballout<=lamp(8 downto 1);
end process;
end;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -