Advertisement
Guest User

Untitled

a guest
May 26th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.88 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:   03:41:21 05/25/2016
  6. -- Design Name:  
  7. -- Module Name:   E:/xilinx/Ny mapp/lab5/DataMemory_tb.vhd
  8. -- Project Name:  lab5
  9. -- Target Device:  
  10. -- Tool versions:  
  11. -- Description:  
  12. --
  13. -- VHDL Test Bench Created by ISE for module: DataMemory
  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.  
  31. -- Uncomment the following library declaration if using
  32. -- arithmetic functions with Signed or Unsigned values
  33. --USE ieee.numeric_std.ALL;
  34.  
  35. ENTITY DataMemory_tb IS
  36. END DataMemory_tb;
  37.  
  38. ARCHITECTURE behavior OF DataMemory_tb IS
  39.  
  40.     -- Component Declaration for the Unit Under Test (UUT)
  41.  
  42.     COMPONENT DataMemory
  43.     PORT(
  44.          Clk : IN  std_logic;
  45.          Reset : IN  std_logic;
  46.          MemWE : IN  std_logic;
  47.          Address : IN  std_logic_vector(31 downto 0);
  48.          DataIn : IN  std_logic_vector(31 downto 0);
  49.          DataOut : OUT  std_logic_vector(31 downto 0)
  50.         );
  51.     END COMPONENT;
  52.    
  53.  
  54.    --Inputs
  55.    signal Clk : std_logic := '0';
  56.    signal Reset : std_logic := '0';
  57.    signal MemWE : std_logic := '0';
  58.    signal Address : std_logic_vector(31 downto 0) := (others => '0');
  59.    signal DataIn : std_logic_vector(31 downto 0) := (others => '0');
  60.  
  61.     --Outputs
  62.    signal DataOut : std_logic_vector(31 downto 0);
  63.  
  64.    -- Clock period definitions
  65.    constant Clk_period : time := 10 ns;
  66.  
  67. BEGIN
  68.  
  69.     -- Instantiate the Unit Under Test (UUT)
  70.    uut: DataMemory PORT MAP (
  71.           Clk => Clk,
  72.           Reset => Reset,
  73.           MemWE => MemWE,
  74.           Address => Address,
  75.           DataIn => DataIn,
  76.           DataOut => DataOut
  77.         );
  78.  
  79.    -- Clock process definitions
  80.    Clk_process :process
  81.    begin
  82.         Clk <= '0';
  83.         wait for Clk_period/2;
  84.         Clk <= '1';
  85.         wait for Clk_period/2;
  86.    end process;
  87.  
  88.  
  89.    -- Stimulus process
  90.    stim_proc: process
  91.    begin       
  92.       -- hold reset state for 100 ns.
  93.             Reset <= '1';
  94.       wait for 2 ns;
  95.             Reset <= '0';
  96.         wait for 50 ns;
  97.             MemWE <= '1';
  98.             Address <= X"00000010";
  99.             DataIn  <= X"00000001";
  100.         wait for 50 ns;
  101.             Address <= X"00000100";
  102.             DataIn  <= X"00000011";
  103.         wait for 50 ns;
  104.             MemWE <= '0';
  105.             Address <= X"01100100";
  106.             DataIn  <= X"00000100";
  107.         wait;  
  108.        
  109.            
  110.       -- insert stimulus here
  111.    end process;
  112.  
  113. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement