Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.32 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    10:36:57 11/22/2014
  6. -- Design Name:
  7. -- Module Name:    kol1 - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  23.  
  24. -- Uncomment the following library declaration if using
  25. -- arithmetic functions with Signed or Unsigned values
  26. --use IEEE.NUMERIC_STD.ALL;
  27.  
  28. -- Uncomment the following library declaration if instantiating
  29. -- any Xilinx primitives in this code.
  30. --library UNISIM;
  31. --use UNISIM.VComponents.all;
  32.  
  33. entity kol1 is
  34.     Port ( iA : in  STD_LOGIC_VECTOR (3 downto 0);
  35.            iB : in  STD_LOGIC_VECTOR (3 downto 0);
  36.            oRES : out  STD_LOGIC_VECTOR (7 downto 0));
  37. end kol1;
  38.  
  39. architecture Behavioral of kol1 is
  40. signal sMUXout3 : std_logic_vector(7 downto 0) := (others => '0');
  41. signal sMUXout2 : std_logic_vector(7 downto 0) := (others => '0');
  42. signal sMUXout1 : std_logic_vector(7 downto 0) := (others => '0');
  43. signal sMUXout0 : std_logic_vector(7 downto 0) := (others => '0');
  44.  
  45. signal siA_SL3 : std_logic_vector(7 downto 0) := (others => '0');
  46. signal siA_SL2 : std_logic_vector(7 downto 0) := (others => '0');
  47. signal siA_SL1 : std_logic_vector(7 downto 0) := (others => '0');
  48. signal siA_SL0 : std_logic_vector(7 downto 0) := (others => '0');
  49.  
  50. signal sSum : std_logic_vector(7 downto 0) := (others => '0');
  51.  
  52. begin
  53. -- MUXes
  54. sMUXout3(3 downto 0) <= iA when(iB(3) = '1')else (others => '0');
  55. sMUXout2(3 downto 0) <= iA when(iB(2) = '1')else (others => '0');
  56. sMUXout1(3 downto 0) <= iA when(iB(1) = '1')else (others => '0');
  57. sMUXout0(3 downto 0) <= iA when(iB(0) = '1')else (others => '0');
  58.  
  59. -- shifters
  60. siA_SL3 <= sMUXout3(4 downto 0) & "000"; -- x4-x3-x2-x1-x0-00-00-00
  61. siA_SL2 <= sMUXout2(5 downto 0) & "00";  -- x5-x4-x3-x2-x1-x0-00-00
  62. siA_SL1 <= sMUXout1(6 downto 0) & '0';   -- x6-x5-x4-x3-x2-x1-x0-00
  63. siA_SL0 <= sMUXout0;                     -- x7-x6-x5-x4-x3-x2-x1-x0
  64.  
  65. -- adders
  66. sSum <= siA_SL3 + (siA_SL2 + (siA_SL1 + siA_SL0));
  67. oRES <= sSum;
  68.  
  69. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement