Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.85 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.std_logic_1164.all;
  3. --http://insights.sigasi.com/tech/to-downto-ranges-vhdl.html
  4.  
  5. entity Function4 is
  6.     port ( A_IN : in STD_LOGIC_VECTOR (3 downto 0);
  7.            OUT_SIG_BEH : out STD_LOGIC_VECTOR (3 downto 0);
  8.          );
  9. end Function4;
  10.  
  11. architecture F4 of Function4 is
  12.     begin
  13.         F4 : process(A_IN)
  14.         type my_array is array (4 downto 0) of STD_LOGIC_VECTOR(3 downto 0);
  15.         variable arrValues : my_array := ("0001", "0011", "0100", "1000", "1001");
  16.         begin
  17.             if A_IN <= arrValues(0) then
  18.                 OUT_SIG_BEH <= "0001";
  19.             elsif A_IN <= arrValues(1) then
  20.                 OUT_SIG_BEH <= "0001";
  21.             elsif A_IN <= arrValues(2) then
  22.                 OUT_SIG_BEH <= "0001";
  23.             elsif A_IN <= arrValues(3) then
  24.                 OUT_SIG_BEH <= "0001";
  25.             elsif A_IN <= arrValues(4) then
  26.                 OUT_SIG_BEH <= "0001";
  27.             else
  28.                 OUT_SIG_BEH <= "0000";
  29.             end if;
  30.         end process F4;
  31. end F4;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement