---------------------------------------------------------------------------------- -- Company: Cal Poly, San Luis Obispo -- Engineer: Andrew Der -- -- Create Date: 21:12:02 11/18/2014 -- Design Name: -- Module Name: lights - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity lights is Port ( NUMBER : in STD_LOGIC_VECTOR (4 downto 0); clock : in STD_LOGIC; enable : in STD_LOGIC; selec : in STD_LOGIC; pass : out STD_LOGIC_VECTOR ( 4 downto 0 ); LED : out STD_LOGIC_VECTOR (3 downto 0)); end lights; --this module takes in the number from the LSFR, saves it, and then displays it over the LEDS. architecture Behavioral of lights is --signal declaration signal n0: std_logic; signal n1: std_logic; signal n2: std_logic; signal n3: std_logic; signal n4: std_logic; signal q0: std_logic; signal q1: std_logic; signal q2: std_logic; signal q3: std_logic; signal q4: std_logic; signal Q: std_logic_vector(4 downto 0); begin n4 <= NUMBER(4); n3 <= NUMBER(3); n2 <= NUMBER(2); n1 <= NUMBER(1); n0 <= NUMBER(0); --Below are D Flip Flops to save the number from the LSFR lights: process (clock,enable,selec) begin if (rising_edge (clock)) and (enable = '1') then q4 <= n4 ; end if; if (rising_edge (clock)) and (enable = '1') then q3 <= n3 ; end if; if (rising_edge (clock)) and (enable = '1') then q2 <= n2 ; end if; if (rising_edge (clock)) and (enable = '1') then q1 <= n1; end if; if (rising_edge (clock)) and (enable = '1') then q0 <= n0; end if; --Below is the LED assignments Q <= q0 & q1 & q2 & q3 &q4;if (selec = '0') then LED <= "0000"; elsif (selec = '1') then if ((Q >= "00001") and (Q <= "01000")) then LED <= "0001"; elsif ((Q >= "01001") and (Q <= "10001")) then LED <= "0010"; elsif ((Q >= "10010") and (Q <= "11001")) then LED <= "0100"; elsif ((Q >= "11010") and (Q <= "11111")) then LED <= "1000"; else LED <= "0000"; end if; end if; end process lights; pass <= Q ; end Behavioral;