Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.46 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:   13:41:55 10/18/2017
  6. -- Design Name:  
  7. -- Module Name:   C:/Users/mostafa.anwar/Desktop/ALU/ALU_test.vhd
  8. -- Project Name:  ALU
  9. -- Target Device:  
  10. -- Tool versions:  
  11. -- Description:  
  12. --
  13. -- VHDL Test Bench Created by ISE for module: ALU
  14. --
  15. -- Dependencies:
  16. --
  17. -- Revision:
  18. -- Revision 0.01 - File Created
  19. -- Additional Comments:
  20. --
  21. -- Notes:
  22. -- This testbench has been automatically generated using types std_logic and
  23. -- std_logic_vector for the ports of the unit under test.  Xilinx recommends
  24. -- that these types always be used for the top-level I/O of a design in order
  25. -- to guarantee that the testbench will bind correctly to the post-implementation
  26. -- simulation model.
  27. --------------------------------------------------------------------------------
  28. LIBRARY ieee;
  29. USE ieee.std_logic_1164.ALL;
  30. USE ieee.std_logic_unsigned.all;
  31. USE ieee.numeric_std.ALL;
  32.  
  33. ENTITY ALU_test IS
  34. END ALU_test;
  35.  
  36. ARCHITECTURE behavior OF ALU_test IS
  37.  
  38.     -- Component Declaration for the Unit Under Test (UUT)
  39.  
  40.     COMPONENT ALU
  41.     PORT(
  42.          A : IN  std_logic_vector(3 downto 0);
  43.          B : IN  std_logic_vector(3 downto 0);
  44.          f1 : IN  std_logic;
  45.          f0 : IN  std_logic;
  46.          Y : OUT  std_logic_vector(4 downto 0)
  47.         );
  48.     END COMPONENT;
  49.    
  50.  
  51.    --Inputs
  52.    signal A : std_logic_vector(3 downto 0) := (others => '0');
  53.    signal B : std_logic_vector(3 downto 0) := (others => '0');
  54.    signal f1 : std_logic := '0';
  55.    signal f0 : std_logic := '0';
  56.  
  57.     --Outputs
  58.    signal Y : std_logic_vector(4 downto 0);
  59.  
  60. BEGIN
  61.  
  62.     -- Instantiate the Unit Under Test (UUT)
  63.    uut: ALU PORT MAP (
  64.           A => A,
  65.           B => B,
  66.           f1 => f1,
  67.           f0 => f0,
  68.           Y => Y
  69.         );
  70.  
  71.    -- No clocks detected in port list. Replace <clock> below with
  72.    -- appropriate port name
  73.  
  74.   -- constant <clock>_period := 1ns;
  75.  
  76.  
  77.  
  78.  
  79.    -- Stimulus process
  80.    stim_proc: process
  81.    begin       
  82.       -- hold reset state for 100ms.
  83.       wait for 10 ns;
  84.         a<= "0110";
  85.         b<= "1000";
  86.         f0<='0';
  87.         f1<='0';
  88.          wait for 10 ns;
  89.         a<= "0110";
  90.         b<= "1000";
  91.         f0<='1';
  92.         f1<='0';
  93.          wait for 10 ns;
  94.         a<= "0110";
  95.         b<= "1000";
  96.         f0<='0';
  97.         f1<='1';
  98.          wait for 10 ns;
  99.         a<= "0110";
  100.         b<= "1000";
  101.         f0<='1';
  102.         f1<='1';
  103.  
  104.       -- insert stimulus here
  105.  
  106.      
  107.    end process;
  108.  
  109. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement