📄 led11.vhd
字号:
library ieee; -- Defines std_logic types
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity LED_Shifter is
port ( CLK : in std_logic; -- Defines ports
RIGHT : in std_logic;
QA : out std_logic_vector(4 downto 0);
QB : out std_logic_vector(4 downto 0);
QC : out std_logic_vector(4 downto 0);
QD : out std_logic_vector(4 downto 0);
QE : out std_logic_vector(4 downto 0));
attribute pin_assign : string; -- Pin Assign
attribute pin_assign of CLK : signal is "29";
attribute pin_assign of RIGHT : signal is "28";
attribute pin_assign of QA : signal is "36,35,38,37,39";
attribute pin_assign of QB : signal is "40,43,42,1,44";
attribute pin_assign of QC : signal is "2,5,4,8,6";
attribute pin_assign of QD : signal is "13,12,11,9,7";
attribute pin_assign of QE : signal is "24,22,20,18,19";
end LED_Shifter;
architecture LED_Shifter_ARCH of LED_Shifter is
signal COUNTER : std_logic_vector(2 downto 0); -- Defines internal signals
signal Q_IN : std_logic_vector(4 downto 0);
begin
QA <= Q_IN; -- Set output
QB <= Q_IN;
QC <= Q_IN;
QD <= Q_IN;
QE <= Q_IN;
process( CLK, RIGHT ) begin
if CLK='1' and CLK'event then -- Clock rising edge ?
COUNTER <= COUNTER + '1';
if RIGHT='1' then -- Blink CW
if COUNTER=0 then
Q_IN <= "11110";
elsif COUNTER=1 then
Q_IN <= "11101";
elsif COUNTER=2 then
Q_IN <= "11011";
elsif COUNTER=3 then
Q_IN <= "10111";
elsif COUNTER=4 then
Q_IN <= "01111";
COUNTER <= "000";
end if;
else -- Blink CCW
if COUNTER=0 then
Q_IN <= "01111";
elsif COUNTER=1 then
Q_IN <= "10111";
elsif COUNTER=2 then
Q_IN <= "11011";
elsif COUNTER=3 then
Q_IN <= "11101";
elsif COUNTER=4 then
Q_IN <= "11110";
COUNTER <= "000";
end if;
end if;
end if;
end process;
end LED_Shifter_ARCH;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -