library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; ------------------------------------------------------------------------------- -- This unit will send the correct input on the address/LED lines at the -- correct time. The vector 'A' corresponds directly to the LED pins. The -- vector 'A2' will ------------------------------------------------------------------------------- entity LineSel is port ( LLed: in STD_LOGIC_VECTOR (6 downto 0); -- input for left LED RLed: in STD_LOGIC_VECTOR (6 downto 0); -- input for right LED Addr: in integer range -1 to 65535; -- input for RAM address rst: in std_logic; -- reset clk: in std_logic; -- clk A: out STD_LOGIC_vector(15 downto 0); -- output on LED/Address lines A2: out STD_LOGIC_VECTOR (15 downto 0); -- more output on LED/Address -- lines AlSel: in STD_LOGIC -- input for Address/Led Selection (0=Addr,1=LED) ); end LineSel; architecture LineSel_arch of LineSel is begin process(clk, rst) variable address : std_logic_vector(15 downto 0); begin if rst = '1' then A <= (others => '1'); -- clear the LED contents on reset (active-low) elsif clk'event and clk = '1' then if AlSel = '1' then A(15) <= '1'; -- decimal point A(14) <= not RLed(6); A(13) <= not RLed(5); A(12) <= not RLed(4); A(11) <= not RLed(3); A(10) <= not RLed(2); A(9) <= not RLed(1); A(8) <= not RLed(0); A(7) <= '1'; -- decimal point A(6) <= not LLed(6); A(5) <= not LLed(5); A(4) <= not LLed(4); A(3) <= not LLed(3); A(2) <= not LLed(2); A(1) <= not LLed(1); A(0) <= not LLed(0); else -- <> -- address := std_logic_vector(to_unsigned(Addr, 16)); ------------------------------------------------------------------------------- -- This assignment is required because there are some extra lines that need to -- be assigned with respect to the address. If you read the provided UCF file, -- most of this vector is ignored (because there are no pin assignments for it) -- but it is retained to simplify the situation somewhat ------------------------------------------------------------------------------- A2(15) <= address(15); A2(14) <= address(14); A2(13) <= address(13); A2(12) <= address(12); A2(11) <= address(11); A2(10) <= address(10); A2(9) <= address(9); A2(8) <= address(8); A2(7) <= address(7); A2(6) <= address(6); A2(5) <= address(5); A2(4) <= address(4); A2(3) <= address(3); A2(2) <= address(2); A2(1) <= address(1); A2(0) <= address(0); ------------------------------------------------------------------------------- -- The following assignments assume that 'A' has been assigned in the -- constraints file directly across to the LED lines ------------------------------------------------------------------------------- A(15) <= address(15); A(14) <= address(9); A(13) <= address(10); A(12) <= address(3); A(11) <= address(1); A(10) <= address(2); A(9) <= address(0); A(8) <= address(11); A(7) <= address(7); A(6) <= address(6); A(5) <= address(14); A(4) <= address(13); A(3) <= address(8); A(2) <= address(7); A(1) <= address(12); A(0) <= address(15); end if; end if; end process; end LineSel_arch;