001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075 | --******************************************************************************
--* *
--* 5bits LED Shifter *
--* Device : XC9536-PC44 *
--* Author : Seiichi Inoue *
--******************************************************************************
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;
--******************************************************************************
--* end of 5bits LED Shifter *
--****************************************************************************** |