Line 33... |
Line 33... |
--
|
--
|
-- Revision History
|
-- Revision History
|
-- Author Date Change
|
-- Author Date Change
|
------------------ -------- ---------------------------------------------------
|
------------------ -------- ---------------------------------------------------
|
-- Seth Henry 05/24/20 Created as a separate sub-component
|
-- Seth Henry 05/24/20 Created as a separate sub-component
|
|
-- Seth Henry 07/13/22 Modified to allow for chaining of toggle signal as
|
|
-- well as slowing down the DIM50PCT signal to 1/32
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_misc.all;
|
use ieee.std_logic_misc.all;
|
|
|
entity status_led is
|
entity status_led is
|
generic(
|
generic(
|
|
Source : boolean := TRUE;
|
Reset_Level : std_logic
|
Reset_Level : std_logic
|
);
|
);
|
port(
|
port(
|
Clock : in std_logic;
|
Clock : in std_logic;
|
Reset : in std_logic;
|
Reset : in std_logic;
|
|
--
|
|
Toggle_In : in std_logic := '0';
|
|
Toggle_Out : out std_logic;
|
|
--
|
LED_Mode : in std_logic_vector(2 downto 0);
|
LED_Mode : in std_logic_vector(2 downto 0);
|
LED_Out : out std_logic
|
LED_Out : out std_logic
|
);
|
);
|
end entity;
|
end entity;
|
|
|
Line 65... |
Line 72... |
retval := retval + 1;
|
retval := retval + 1;
|
end loop;
|
end loop;
|
return retval;
|
return retval;
|
end function;
|
end function;
|
|
|
signal Dim50Pct_Out : std_logic := '0';
|
signal Dim50Pct_Ctr : std_logic_vector(4 downto 0) := "00000";
|
|
alias Dim50Pct_Out is Dim50Pct_Ctr(4);
|
|
|
constant TAP1 : integer := 16;
|
constant TAP1 : integer := 16;
|
constant TAP2 : integer := 21;
|
constant TAP2 : integer := 21;
|
constant TAP3 : integer := 22;
|
constant TAP3 : integer := 22;
|
constant TAP4 : integer := 23;
|
constant TAP4 : integer := 23;
|
Line 112... |
Line 120... |
end process;
|
end process;
|
|
|
d0 <= LFSR_poly(TAP4) xnor LFSR_poly(TAP3) xnor
|
d0 <= LFSR_poly(TAP4) xnor LFSR_poly(TAP3) xnor
|
LFSR_poly(TAP2) xnor LFSR_poly(TAP1);
|
LFSR_poly(TAP2) xnor LFSR_poly(TAP1);
|
|
|
Timer_proc: process( Clock, Reset )
|
Source_Mode : if( Source )generate
|
|
|
|
Toggle_Out <= Cycle_Toggle;
|
|
|
|
Toggle_Gen: process( Clock, Reset )
|
begin
|
begin
|
if( Reset = Reset_Level )then
|
if( Reset = Reset_Level )then
|
Dim50Pct_Out <= '0';
|
|
LFSR_poly <= Init_Seed;
|
LFSR_poly <= Init_Seed;
|
Cycle_Toggle <= '0';
|
Cycle_Toggle <= '0';
|
Fade_Timer1 <= (others => '0');
|
|
Fade_Timer2 <= (others => '0');
|
|
Fade_out <= '0';
|
|
elsif( rising_edge(Clock) )then
|
elsif( rising_edge(Clock) )then
|
Dim50Pct_Out <= not Dim50Pct_Out;
|
|
|
|
LFSR_poly <= LFSR_poly(22 downto 0) & d0;
|
LFSR_poly <= LFSR_poly(22 downto 0) & d0;
|
if( LFSR_poly = Init_Seed )then
|
if( LFSR_poly = Init_Seed )then
|
Cycle_Toggle <= not Cycle_Toggle;
|
Cycle_Toggle <= not Cycle_Toggle;
|
end if;
|
end if;
|
|
end if;
|
|
end process;
|
|
|
|
end generate;
|
|
|
|
Sink_Mode : if( not Source )generate
|
|
|
|
Toggle_Out <= '0';
|
|
|
|
Toggle_Gen: process( Clock, Reset )
|
|
begin
|
|
if( Reset = Reset_Level )then
|
|
Cycle_Toggle <= '0';
|
|
elsif( rising_edge(Clock) )then
|
|
Cycle_Toggle <= Toggle_In;
|
|
end if;
|
|
end process;
|
|
|
|
end generate;
|
|
|
|
|
|
Timer_proc: process( Clock, Reset )
|
|
begin
|
|
if( Reset = Reset_Level )then
|
|
Dim50Pct_Ctr <= (others => '0');
|
|
Fade_Timer1 <= (others => '0');
|
|
Fade_Timer2 <= (others => '0');
|
|
Fade_out <= '0';
|
|
elsif( rising_edge(Clock) )then
|
|
Dim50Pct_Ctr <= Dim50Pct_Ctr - 1;
|
|
|
Fade_Timer1 <= Fade_Timer1 - 1;
|
Fade_Timer1 <= Fade_Timer1 - 1;
|
Fade_Timer2 <= Fade_Timer2 - 1;
|
Fade_Timer2 <= Fade_Timer2 - 1;
|
if( or_reduce(Fade_Timer2) = '0' )then
|
if( or_reduce(Fade_Timer2) = '0' )then
|
Fade_Timer2(TIMER_MSB downto TIMER_MSB - 8) <= (others => '1');
|
Fade_Timer2(TIMER_MSB downto TIMER_MSB - 8) <= (others => '1');
|