library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity nexys2_test is Port (btn0: in STD_LOGIC; lclk: in STD_LOGIC; segsel: out STD_LOGIC_VECTOR(3 downto 0); seg: out STD_LOGIC_VECTOR(6 downto 0); dp: out STD_LOGIC; leds: out STD_LOGIC_VECTOR(7 downto 0)); end nexys2_test; architecture Behavioral of nexys2_test is signal clk: STD_LOGIC_VECTOR(24 downto 0); signal counter: STD_LOGIC_VECTOR(11 downto 0); signal display_num: STD_LOGIC_VECTOR(2 downto 0); signal display_mask: STD_LOGIC_VECTOR(1 downto 0); begin process(lclk) begin if lclk = '1' and lclk'Event then clk <= clk + 1; if clk = "000000000000000000000000" then counter <= counter + 1; end if; if clk(16 downto 0) = "00000000000000000" then display_mask <= display_mask + 1; end if; end if; end process; --ld0 <= btn0; leds <= counter(7 downto 0); dp <= '1'; -- display_mask <= "01"; with display_mask select display_num <= counter(2 downto 0) when "00", counter(5 downto 3) when "01", counter(8 downto 6) when "10", counter(11 downto 9) when "11", "000" when others; with display_num select seg <= "1000000" when "000", "1111001" when "001", "0100100" when "010", "0110000" when "011", "0011001" when "100", "0010010" when "101", "0000010" when "110", "1111000" when "111", "1111111" when others; with display_mask select segsel <= "1110" when "00", "1101" when "01", "1011" when "10", "0111" when "11", "1111" when others; end Behavioral;