Jump to content

VHDL for FPGA Design/Printable version

From Wikibooks, open books for an open world


VHDL for FPGA Design

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/VHDL_for_FPGA_Design

Permission is granted to copy, distribute, and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike 3.0 License.

Decoder

Decoder VHDL Code

[edit | edit source]
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
 
entity Decoder is
   port(E : in std_logic;
        din : in std_logic_vector(2 downto 0);
        dout : out std_logic_vector(7 downto 0));
end Decoder;
 
architecture descript of Decoder is
begin
   
   dout <="00000000" when E='0' else
        "00000001" when E='1' and din="000" else
        "00000010" when E='1' and din="001" else
        "00000100" when E='1' and din="010" else
        "00001000" when E='1' and din="011" else
        "00010000" when E='1' and din="100" else
        "00100000" when E='1' and din="101" else
        "01000000" when E='1' and din="110" else
        "10000000" when E='1' and din="111";

end descript;

Decoder Testbench File

[edit | edit source]
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
 
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
USE ieee.numeric_std.ALL;
 
ENTITY tb_Decoder IS
END tb_Decoder;
 
ARCHITECTURE behavior OF tb_Decoder IS 
 
    -- Component Declaration for the Unit Under Test (UUT)
 
    COMPONENT Decoder
    PORT(
         E : IN  std_logic;
         din : IN  std_logic_vector(2 downto 0);
         dout : OUT  std_logic_vector(7 downto 0)
        );
    END COMPONENT;
    

   --Inputs
   signal E : std_logic := '0';
   signal din : std_logic_vector(2 downto 0) := (others => '0');

 	--Outputs
   signal dout : std_logic_vector(7 downto 0);
   -- No clocks detected in port list. Replace clk below with 
   -- appropriate port name 
 
	signal clk : std_logic;
	constant clk_period : time := 10 ns;
 
BEGIN
 
	-- Instantiate the Unit Under Test (UUT)
   uut: Decoder PORT MAP (
          E => E,
          din => din,
          dout => dout
        );

   -- Clock process definitions
   clk_process :process
   begin
		clk <= '0';
		wait for clk_period/2;
		clk <= '1';
		wait for clk_period/2;
   end process;
 
	
   -- Stimulus process
   stim_proc: process
   begin		
      -- hold reset state for 100 ns.
      wait for 100 ns;	
		din <= "001";
		wait for clk_period;
		din <= "010";
		wait for clk_period;
		din <= "011";
		wait for clk_period;
		din <= "100";
		wait for clk_period;
		din <= "101";
		wait for clk_period;
		din <= "110";
		wait for clk_period;
		din <= "111";
		wait for clk_period;
		E <= '1';
		wait for clk_period;		
		din <= "000";
		wait for clk_period;
		din <= "001";
		wait for clk_period;
		din <= "010";
		wait for clk_period;
		din <= "011";
		wait for clk_period;
		din <= "100";
		wait for clk_period;
		din <= "101";
		wait for clk_period;
		din <= "110";
		wait for clk_period;
		din <= "111";
		
      -- insert stimulus here 

      wait;
   end process;

END;

Decoder Simulation Waveform

[edit | edit source]

[edit | edit source]

Video of how to get to the Decoder RTL Schematic (circuit diagram) in the Xilinx ISE Project Navigator

See Also

[edit | edit source]



Multiplexer

Multiplexer VHDL Code

[edit | edit source]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity Multiplexer_VHDL is
   port
   (
      a, b, c, d, e, f, g, h : in std_logic; 
      Sel : in std_logic_vector(2 downto 0);

      Output : out std_logic
   );
end entity Multiplexer_VHDL;
 
architecture Behavioral of Multiplexer_VHDL is
begin 
   process (a, b, c, d, e, f, g, h, Sel) is
   begin
      case Sel is
         when "000"  => Output <= a;
         when "001"  => Output <= b;
         when "010"  => Output <= c;
         when "011"  => Output <= d;
         when "100"  => Output <= e;
         when "101"  => Output <= f;
         when "110"  => Output <= g;
         when others => Output <= h;
      end case;
   end process;
end architecture Behavioral;

Multiplexer Testbench Code

[edit | edit source]
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
 
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
USE ieee.numeric_std.ALL;
 
ENTITY tb_Multiplexer IS
END tb_Multiplexer;
 
ARCHITECTURE behavior OF tb_Multiplexer IS 
 
    -- Component Declaration for the Unit Under Test (UUT)
 
    COMPONENT Multiplexer_VHDL
    PORT(
         a : IN  std_logic;
         b : IN  std_logic;
         c : IN  std_logic;
         d : IN  std_logic;
         e : IN  std_logic;
         f : IN  std_logic;
         g : IN  std_logic;
         h : IN  std_logic;
         Sel : IN  std_logic_vector(2 downto 0);
         Output : OUT  std_logic
        );
    END COMPONENT;
    

   --Inputs
   signal a : std_logic := '0';
   signal b : std_logic := '0';
   signal c : std_logic := '0';
   signal d : std_logic := '0';
   signal e : std_logic := '0';
   signal f : std_logic := '0';
   signal g : std_logic := '0';
   signal h : std_logic := '0';
   signal Sel : std_logic_vector(2 downto 0) := (others => '0');

 	--Outputs
   signal Output : std_logic;
   -- No clks detected in port list. Replace clk below with 
   -- appropriate port name 
 
	signal clk : std_logic;
	constant clk_period : time := 10 ns;
	signal counter : std_logic_vector(7 downto 0) := (others => '0'); 
	
BEGIN
 
	-- Instantiate the Unit Under Test (UUT)
   uut: Multiplexer_VHDL PORT MAP (
          a => a,
          b => b,
          c => c,
          d => d,
          e => e,
          f => f,
          g => g,
          h => h,
          Sel => Sel,
          Output => Output
        );

   -- clk process definitions
   clk_process :process
   begin
		clk <= '0';
		wait for clk_period/2;
		clk <= '1';
		wait for clk_period/2;
   end process;
 
	a <= counter(0);
	b <= counter(1);
	c <= counter(2);
	d <= counter(3);
	e <= counter(4);
	f <= counter(5);
	g <= counter(6);
	h <= counter(7);
	
   -- Stimulus process
   stim_proc: process
   begin		
      -- hold reset state for 100 ns.
		wait for 100 ns;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00000001";
		Sel <= "000";
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00000010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00000011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00000100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00000101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00000111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00001111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00010111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00011111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00100111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00101111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00110111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "00111111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01000111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01001111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01010111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01011111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01100111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01101111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01110111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "01111111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10000001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10000010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10000011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10000100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10000101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10000111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10001111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10010111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10011111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10100111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10101111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10110111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "10111111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11000111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11001111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11010111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11011111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11100111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11101111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11110111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111000";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111001";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111010";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111011";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111100";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111101";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111110";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		wait for clk_period;
		counter <= "11111111";		
		Sel <= "000";		
		wait for clk_period;
		Sel <= "001";
		wait for clk_period;
		Sel <= "010";
		wait for clk_period;
		Sel <= "011";
		wait for clk_period;
		Sel <= "100";
		wait for clk_period;
		Sel <= "101";
		wait for clk_period;
		Sel <= "110";
		wait for clk_period;
		Sel <= "111";
		
      -- insert stimulus here 

      wait;
   end process;

END;

Multiplexer Simulation Waveform

[edit | edit source]

[edit | edit source]


Priority Encoder

Priority Encoder

[edit | edit source]
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.all;

ENTITY encoder74 IS							
	PORT 	(clk,res,sin :IN STD_LOGIC;	
			outpt :OUT STD_LOGIC);		
END encoder74 ;							

ARCHITECTURE struc OF encoder74 IS 
			SIGNAL txlss : STD_LOGIC_VECTOR(3 downto 1);

BEGIN
PROCESS
BEGIN

WAIT UNTIL FALLING_EDGE (clk);
		IF (res = '1') THEN			
			txlss <= "000";
		ELSIF (res = '0') THEN
			txlss(1) <= inpt;
			txlss(2) <= txlss(1);
			txlss(3) <= txlss(2);
			outpt<= (sin XOR txlss(2) XOR txlss(3));
END IF;
END PROCESS;
END struc;

Simulation Waveform

[edit | edit source]
 

Generated Logic Circuit

[edit | edit source]
 


4-Bit Adder

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all use ieee.std_logic_arith.all;

Entity Adder4 Is port ( a,b:in integer Range -8 to 7; sum:out integer Range -16 to 15 ); end Adder4;

Architecture Adder4arch of Adder4 Is Begin sum<=a+b;

end Adder4arch;

Simulation Waveform

[edit | edit source]
 
library ieee;
use ieee.std_logic_1164.all;
use work.all;

entity adder4b is
  port (a,b,c:in std_logic_vector(3 downto 0);
        cin:in std_logic;
        cout:out std_logic;
        s:out std_logic_vector(3 downto 0));
END adder4b;

architecture arch12 of adder is
  signal y:std_logic_vector(4 downto 0);
begin
  y(0)<= cin;
  cout<=y(4);
  --u:for i in 0 to 3 generate
  --p:entity work.FA(arch) port map(a,b,c,s,r=>y(i+1));
  p0:entity work.FA(arch) port map(a=>a(0),b=>b(0),c=>y(0),s=>s(0),r=>y(1));
  p1:entity work.FA(arch) port map(a=>a(1),b=>b(1),c=>y(1),s=>s(1),r=>y(2));
  p2:entity work.FA(arch) port map(a=>a(2),b=>b(2),c=>y(2),s=>s(2),r=>y(3));
  p3:entity work.FA(arch) port map(a=>a(3),b=>b(3),c=>y(3),s=>s(3),r=>y(4));
--end generate;


4-Bit Multiplier

Design of 4×4-Bit Multiplier VHDL Code

[edit | edit source]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity Multiplier_VHDL is
   port
   (
      Nibble1, Nibble2: in std_logic_vector(1 downto 0);

      Result: out std_logic_vector(2 downto 0)
   );
end Multiplier_VHDL;

architecture Behavioral of Multiplier_VHDL is
begin

   Result <= std_logic_vector(unsigned(Nibble1) * unsigned(Nibble2));

end Behavioral;

Simulation Waveform

[edit | edit source]
 


4-Bit ALU

4-Bit ALU VHDL Code

[edit | edit source]

A combinatorial ALU with the following operations:

Operation Result Flag Description
000 Nibble1 + Nibble2 Carry = Overflow Addition
001 | Nibble1 - Nibble2 | 1 if Nibble2 > Nibble1,
0 otherwise
Test / diff
010 Nibble1 AND Nibble2 0 Bitwise AND
011 Nibble1 OR Nibble2 0 Bitwise OR
100 Nibble1 XOR Nibble2 0 Bitwise XOR
101 15 - Nibble1 0 Bitwise inverse of Nibble1
110 15 - Nibble2 0 Bitwise inverse of Nibble2
111 Nibble1 + Nibble2 + 1 Carry = Overflow Addition
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
 
entity ALU_VHDL is
   port
   (
      Nibble1, Nibble2 : in std_logic_vector(3 downto 0);
      Operation : in std_logic_vector(2 downto 0);

      Carry_Out : out std_logic;
      Flag : out std_logic;
      Result : out std_logic_vector(3 downto 0)
   );
end entity ALU_VHDL;
 
architecture Behavioral of ALU_VHDL is

   signal Temp: std_logic_vector(4 downto 0);

begin

   process(Nibble1, Nibble2, Operation, temp) is
   begin
      Flag <= '0';
      case Operation is
 	 when "000" => -- res = nib1 + nib2, flag = carry = overflow
 	    Temp   <= std_logic_vector((unsigned("0" & Nibble1) + unsigned(Nibble2)));
            Result <= temp(3 downto 0);
 	    Carry_Out   <= temp(4);
 	 when "001" => -- res = |nib1 - nib2|, flag = 1 iff nib2 > nib1
 	    if (Nibble1 >= Nibble2) then
 	       Result <= std_logic_vector(unsigned(Nibble1) - unsigned(Nibble2));
 	       Flag   <= '0';
            else
 	       Result <= std_logic_vector(unsigned(Nibble2) - unsigned(Nibble1));
 	       Flag   <= '1';
            end if;
 	 when "010" =>
 	    Result <= Nibble1 and Nibble2;
 	 when "011" =>
 	    Result <= Nibble1 or Nibble2;
 	 when "100" =>
 	    Result <= Nibble1 xor Nibble2;
 	 when "101" =>
 	    Result <= not Nibble1;
  	 when "110" =>
            Result <= not Nibble2;
 	 when others => -- res = nib1 + nib2 + 1, flag = 0
 	    Temp   <= std_logic_vector((unsigned("0" & Nibble1) + unsigned(not Nibble2)) + 1);
 	    Result <= temp(3 downto 0);
 	    Flag   <= temp(4);
      end case;
   end process;

end architecture Behavioral;

Simulation Waveform

[edit | edit source]

Generated Symbol

[edit | edit source]


D Flip Flop

Synchronous Positive Edge Triggered D Flip-Flop with Active-High Reset, Preset, and Clock Enable

[edit | edit source]
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity D_FF_VHDL is
   port
   (
      clk : in std_logic;

      rst : in std_logic;
      pre : in std_logic;
      ce  : in std_logic;
      
      d : in std_logic;

      q : out std_logic
   );
end entity D_FF_VHDL;
 
architecture Behavioral of D_FF_VHDL is

begin
   process (clk) is
   begin
      if rising_edge(clk) then  
         if (rst='1') then   
            q <= '0';
         elsif (pre='1') then
            q <= '1';
         elsif (ce='1') then
            if (d ='1') then
             q <= '1';
         elsif (d ='0') then 
             q<= '0';
            end if;
         end if;
      end if;
   end process;
end architecture Behavioral;

Simulation Results

[edit | edit source]
 

Generated Symbol

[edit | edit source]
 File:D FF SCH F.png


T Flip Flop

Synchronous Positive edge T Flip-Flop with Reset and Clock enable

[edit | edit source]
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity t_trigger is
   port (T,Reset,CLK,CLK_enable: in std_logic;
	 Q: out std_logic);
end t_trigger;
 
architecture beh_t_trigger of t_trigger is	 

begin
    process (Reset,CLK) 
    variable  temp: std_logic;
    begin
        if (rising_edge(CLK)) then    --sometimes you need to include a package for rising_edge, you can use CLK'EVENT AND CLK = '1' instead
            if Reset='1' then   
                temp := '0';  		
            elsif CLK_enable ='1' then
                temp := T xor temp;
            end if;
        end if; 
    Q <= temp;	   
    end process;
end beh_t_trigger;

Simulation Results

[edit | edit source]
 

Generated Symbol

[edit | edit source]
 File:T FF SCH F.png


JK Flip Flop

Synchronous Positive edge JK Flip-Flop with Reset and Clock enable

[edit | edit source]
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;

entity JK_FF_VHDL is
   port( J,K: in  std_logic;
         Reset: in std_logic;
         Clock_enable: in std_logic;
         Clock: in std_logic;
         Output: out std_logic);
end JK_FF_VHDL;

architecture Behavioral of JK_FF_VHDL is
   signal temp: std_logic;
begin
   process (Clock) 
   begin
      if rising_edge(Clock) then                 
         if Reset='1' then   
            temp <= '0';
         elsif Clock_enable ='1' then
            if (J='0' and K='0') then
               temp <= temp;
            elsif (J='0' and K='1') then
               temp <= '0';
            elsif (J='1' and K='0') then
               temp <= '1';
            elsif (J='1' and K='1') then
               temp <= not (temp);
            end if;
         end if;
      end if;
   end process;
   Output <= temp;
end Behavioral;

Simulation Results

[edit | edit source]
 

Generated Symbol

[edit | edit source]
  


4-Bit Binary Counter with Parallel Load

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Counter is
Port(clk : in STD_LOGIC;
   Reset : in STD_LOGIC;
   Count : out STD_LOGIC_VECTOR (2 downto 0));
end Counter;
architecture Behavioral of Counter is
signal count_int : std_logic_vector(2 downto 0);
begin
process (reset, clk)
begin
 if reset = '1' then
  count_int <= "111";
 elsif clk'event and clk = '1' then
  if count_int <= "111" and count_int > "010" then
    count_int <= count_int - "1";
  else
    count_int <= "111";
  end if;
 end if;
end process;
count <= count_int;
end Behavioral;

Simulation Results

[edit | edit source]


4-Bit BCD Counter with Clock Enable

4-Bit BCD Up Counter with Clock Enable

[edit | edit source]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity Counter2_VHDL is 
   port( Clock_enable_B: in std_logic;
 	 Clock: in std_logic;
 	 Reset: in std_logic;
 	 Output: out std_logic_vector(0 to 3));
end Counter2_VHDL;
 
architecture Behavioral of Counter2_VHDL is
   signal temp: std_logic_vector(0 to 3);
begin   process(Clock,Reset)
   begin
      if Reset='1' then
         temp <= "0000";
      elsif(rising_edge(Clock)) then
         if Clock_enable_B='0' then
            if temp="1001" then
               temp<="0000";
            else
               temp <= temp + 1;
            end if;
         end if;
      end if;
   end process;
   Output <= temp;
end Behavioral;

Simulation Results

[edit | edit source]
 


4-Bit Shift Register

4-Bit Shift Register

[edit | edit source]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity Shift_register_VHDL is

   port( clk: in std_logic;
 	 L: in std_logic; 
 	 w: in std_logic; -- new data to shift in
 	 Output: out std_logic_vector(3 downto 0);
 	 Input: in std_logic_vector( 3 downto 0));

end Shift_register_VHDL;

architecture Behavioral of Shift_register_VHDL is
begin
   process
   variable temp: std_logic_vector(3 downto 0); 
   begin
      wait until rising_edge (clk);
      temp := Input; 
      if L='1' then 
         for i in 0 to 2 loop
            temp(i) := temp(i+1);
         end loop;
         temp(3) := w;
      end if;
      Output <= temp;
    end process;
end Behavioral;

Simulation results

[edit | edit source]
 


4-Bit Johnson Counter with Reset

Johnson Counter

[edit | edit source]
library ieee;
use ieee.std_logic_1164.ALL;
use ieee.numeric_std.ALL;
library UNISIM;
use UNISIM.Vcomponents.ALL;

entity Johnson is
   port ( CLK : in    std_logic; 
          CLR : in    std_logic; 
          A   : out   std_logic; 
          B   : out   std_logic; 
          C   : out   std_logic; 
          D   : out   std_logic);
end Johnson;

architecture BEHAVIORAL of Johnson is
   attribute INIT       : string ;
   attribute BOX_TYPE   : string ;
   signal XLXN_44 : std_logic;
   signal A_DUMMY : std_logic;
   signal B_DUMMY : std_logic;
   signal C_DUMMY : std_logic;
   signal D_DUMMY : std_logic;
   component FDC
      -- synopsys translate_off
      generic( INIT : bit :=  '0');
      -- synopsys translate_on
      port ( C   : in    std_logic; 
             CLR : in    std_logic; 
             D   : in    std_logic; 
             Q   : out   std_logic);
   end component;
   attribute INIT of FDC : component is "0";
   attribute BOX_TYPE of FDC : component is "BLACK_BOX";
   
   component INV
      port ( I : in    std_logic; 
             O : out   std_logic);
   end component;
   attribute BOX_TYPE of INV : component is "BLACK_BOX";
   
begin
   A <= A_DUMMY;
   B <= B_DUMMY;
   C <= C_DUMMY;
   D <= D_DUMMY;
   XLXI_20 : FDC
      port map (C=>CLK,
                CLR=>CLR,
                D=>XLXN_44,
                Q=>A_DUMMY);
   
   XLXI_21 : FDC
      port map (C=>CLK,
                CLR=>CLR,
                D=>A_DUMMY,
                Q=>B_DUMMY);
   
   XLXI_22 : FDC
      port map (C=>CLK,
                CLR=>CLR,
                D=>B_DUMMY,
                Q=>C_DUMMY);
   
   XLXI_23 : FDC
      port map (C=>CLK,
                CLR=>CLR,
                D=>C_DUMMY,
                Q=>D_DUMMY);
   
   XLXI_25 : INV
      port map (I=>D_DUMMY,
                O=>XLXN_44);
   
end BEHAVIORAL;

Simulation Waveform

[edit | edit source]


State-Machine Design Example Asynchronous Counter

Asynchronous Counter

[edit | edit source]

VHDL Code

State Diagram

[edit | edit source]

Simulation Waveform

[edit | edit source]


State-Machine Design Example Serial Parity Generator

Serial Parity Generator

[edit | edit source]

State Diagram

[edit | edit source]

Simulation Waveform

[edit | edit source]


Example Application Serial Adder

Serial Adder

[edit | edit source]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity SA_VHDL is
   Port ( I : in std_logic_vector(15 downto 0);
          O : out std_logic_vector(7 downto 0);
          c_i, a_i, b_i, c_o, s_o : out std_logic;
          CLK : in std_logic;
          Load : in std_logic);
end SA_VHDL;

architecture Behavioral of SA_VHDL is
   signal ina, inb, oreg : std_logic_vector(7 downto 0);
   signal so, ci, co: std_logic;
begin

--rec ina
process (CLK)
begin
   if CLK'event and CLK='1' then
      if (Load='1') then
         ina <= I(15 downto 8);
      else
         ina <= '0' & ina(7 downto 1);
      end if;
   end if;
end process;

--reg inb
process (CLK)
begin
   if CLK'event and CLK='1' then
      if (Load='1') then
         inb <= I(7 downto 0);
      else
         inb <= '0' & inb(7 downto 1);
      end if;
   end if;
end process;

--oreg 
process (CLK)
begin
   if CLK'event and CLK='1' then
      if (Load='1') then
         oreg <= "00000000";
         ci <= '0';
      else
         ci <= co;
         oreg <= so & oreg(7 downto 1);
      end if;
   end if;
end process;

-- FA
so <=  inb(0) xor ina(0) xor ci;
co <= (inb(0) and ina(0)) or  
      (inb(0) and ci) or 
      (ci and ina(0));

O <= oreg;

-- for  test
c_i <= ci;  
a_i <= ina(0);
b_i <= inb(0);

c_o <= co;  
s_o <= so; 

end Behavioral;

Simulation Results

[edit | edit source]