Guest User

Untitled

a guest
Dec 14th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4.  
  5. entity primer1 is
  6. port(
  7. iA : in std_logic_vector(2 downto 0);
  8. iB : in std_logic_vector(4 downto 0);
  9. iC : in std_logic_vector(7 downto 0);
  10. iSEL : in std_logic_vector(3 downto 0);
  11. oRESULT : out std_logic_vector(7 downto 0)
  12. );
  13.  
  14. end entity;
  15.  
  16. architecture Behavioral of primer1 is
  17. signal sDEC : std_logic_vector(7 downto 0);
  18. signal sFX : std_logic_vector(7 downto 0);
  19. signal sKOM: std_logic_vector(7 downto 0);
  20. signal sSHR : std_logic_vector(7 downto 0);
  21. signal sSEL : std_logic_vector(1 downto 0);
  22. begin
  23.  
  24. process(iA) begin
  25. if(iA = "111") then
  26. sDEC <= "10000000";
  27. elsif(iA = "110") then
  28. sDEC <= "01000000";
  29. elsif(iA = "101") then
  30. sDEC <= "00100000";
  31. elsif(iA = "100") then
  32. sDEC <= "00010000";
  33. elsif(iA = "011") then
  34. sDEC <= "00001000";
  35. elsif(iA = "010") then
  36. sDEC <= "00000100";
  37. elsif(iA = "001") then
  38. sDEC <= "00000010";
  39. else
  40. sDEc <= "00000001";
  41.  
  42. end if;
  43.  
  44. end process;
  45.  
  46. sFX <= iB(3 downto 0) & "0000";
  47.  
  48. sKOM <= (not(iC)) + '1';
  49.  
  50. sSHR <= iC(7) & iC(7) & iC(7) & iC(7) & iC(7 downto 4);
  51.  
  52. process(iSEL) begin
  53. if(iSEL(3) = '1') then
  54. sSEL <= "11";
  55. elsif(iSEL(2) = '1') then
  56. sSEL <= "10";
  57. elsif(iSEL(1) = '1') then
  58. sSEL <= "01";
  59. else
  60. sSEL <= "00";
  61.  
  62. end if;
  63.  
  64. end process;
  65.  
  66. process(sSEL, sDEC, sFX, sKOM, sSHR) begin
  67. if(sSEL = "11") then
  68. oRESULT <= sDEC;
  69. elsif(sSEL = "10") then
  70. oRESULT <= sFX;
  71. elsif(sSEL = "01") then
  72. oRESULT <= sKOM;
  73. else
  74. oRESULT <= sSHR;
  75.  
  76. end if;
  77.  
  78. end process;
  79.  
  80. end architecture;
Advertisement
Add Comment
Please, Sign In to add comment