Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.39 KB | None | 0 0
  1. ---------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    09:20:29 10/18/2017
  6. -- Design Name:
  7. -- Module Name:    ALU_D - str_arch
  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_ARITH.ALL;
  23. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  24.  
  25.  
  26.  
  27. -- Uncomment the following library declaration if using
  28. -- arithmetic functions with Signed or Unsigned values
  29. --use IEEE.NUMERIC_STD.ALL;
  30.  
  31. -- Uncomment the following library declaration if instantiating
  32. -- any Xilinx primitives in this code.
  33. --library UNISIM;
  34. --use UNISIM.VComponents.all;
  35.  
  36. entity ALU_D is
  37.  
  38.  
  39. port (Af : in  STD_LOGIC_VECTOR (3 downto 0);
  40.            Bf : in  STD_LOGIC_VECTOR (3 downto 0);
  41.            f0f : in  STD_LOGIC;
  42.            f1f : in  STD_LOGIC;
  43.            Yf : out  STD_LOGIC_VECTOR (4 downto 0));
  44.               end ALU_D;
  45. architecture str_arch of ALU_D is
  46. component ALU
  47. port (A : in  STD_LOGIC_VECTOR (3 downto 0);
  48.            B : in  STD_LOGIC_VECTOR (3 downto 0);
  49.            f0 : in  STD_LOGIC;
  50.            f1 : in  STD_LOGIC;
  51.            Y : out  STD_LOGIC_VECTOR (4 downto 0));
  52.               end component;
  53. component ALU2
  54.  Port ( A : in  STD_LOGIC_VECTOR (3 downto 0);
  55.            B : in  STD_LOGIC_VECTOR (3 downto 0);
  56.            Y : out  STD_LOGIC_VECTOR (4 downto 0));
  57. end component;
  58.    
  59. component ALU3
  60. Port ( A : in  STD_LOGIC_VECTOR (3 downto 0);
  61.            B : in  STD_LOGIC_VECTOR (3 downto 0);
  62.            Y : out  STD_LOGIC_VECTOR (4 downto 0));
  63. end component;
  64. component MUX
  65. Port ( i0 : in  STD_LOGIC_VECTOR (4 downto 0);
  66.            i1 : in  STD_LOGIC_VECTOR (4 downto 0);
  67.            i2 : in  STD_LOGIC_VECTOR (4 downto 0);
  68.            i3 : in  STD_LOGIC_VECTOR (4 downto 0);
  69.            f0 : in  STD_LOGIC;
  70.            f1 : in  STD_LOGIC;
  71.            Y : out  STD_LOGIC_VECTOR (4 downto 0));
  72. end component;
  73.    
  74. signal p1,p2,p3 : 4 downto 0;  
  75.  
  76. begin
  77. unit1: ALU port map (A<=Af,B<=Bf,f0<=f0f,f1<=f1f,Y<=p1);
  78. unit2: ALU2 port map (A<=Af,B<=Bf,Y<=p2);
  79. unit3: ALU3 port map (A<=Af,B<=Bf,Y<=p3);
  80. unit4: MUX port map (i0<=p1,i1<=p1,i2<=p2,i3<=p3,f0<=f0f,f1<=f1f,Y<=Yf);
  81.  
  82.  
  83.  
  84. end str_arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement