| 1 |
13 |
Andrewski |
--------------------------------------------------------------------------------
|
| 2 |
|
|
--This file is part of fpga_gpib_controller.
|
| 3 |
|
|
--
|
| 4 |
|
|
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
|
| 5 |
|
|
-- it under the terms of the GNU General Public License as published by
|
| 6 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
| 7 |
|
|
-- (at your option) any later version.
|
| 8 |
|
|
--
|
| 9 |
|
|
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
|
| 10 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
|
|
-- GNU General Public License for more details.
|
| 13 |
3 |
Andrewski |
|
| 14 |
13 |
Andrewski |
-- You should have received a copy of the GNU General Public License
|
| 15 |
|
|
-- along with Fpga_gpib_controller. If not, see <http://www.gnu.org/licenses/>.
|
| 16 |
3 |
Andrewski |
--------------------------------------------------------------------------------
|
| 17 |
13 |
Andrewski |
-- Author: Andrzej Paluch
|
| 18 |
3 |
Andrewski |
--
|
| 19 |
|
|
-- Create Date: 23:50:53 11/16/2011
|
| 20 |
|
|
-- Design Name: MemoryBlock
|
| 21 |
|
|
-- Module Name: J:/projekty/elektronika/USB_to_HPIB/usbToHpib/src/test/MemoryBlock_Test.vhd
|
| 22 |
|
|
-- Project Name: usbToGpib
|
| 23 |
|
|
-- Target Device:
|
| 24 |
|
|
-- Tool versions:
|
| 25 |
|
|
-- Description:
|
| 26 |
|
|
--
|
| 27 |
|
|
-- VHDL Test Bench Created by ISE for module: MemoryBlock
|
| 28 |
|
|
--
|
| 29 |
|
|
-- Dependencies:
|
| 30 |
|
|
--
|
| 31 |
|
|
-- Revision:
|
| 32 |
|
|
-- Revision 0.01 - File Created
|
| 33 |
|
|
-- Additional Comments:
|
| 34 |
|
|
--
|
| 35 |
|
|
-- Notes:
|
| 36 |
|
|
-- This testbench has been automatically generated using types std_logic and
|
| 37 |
|
|
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
| 38 |
|
|
-- that these types always be used for the top-level I/O of a design in order
|
| 39 |
|
|
-- to guarantee that the testbench will bind correctly to the post-implementation
|
| 40 |
|
|
-- simulation model.
|
| 41 |
|
|
--------------------------------------------------------------------------------
|
| 42 |
|
|
LIBRARY ieee;
|
| 43 |
|
|
USE ieee.std_logic_1164.ALL;
|
| 44 |
|
|
USE ieee.std_logic_unsigned.all;
|
| 45 |
|
|
USE ieee.numeric_std.ALL;
|
| 46 |
|
|
|
| 47 |
|
|
use work.helperComponents.all;
|
| 48 |
|
|
|
| 49 |
|
|
ENTITY MemoryBlock_Test_vhd IS
|
| 50 |
|
|
END MemoryBlock_Test_vhd;
|
| 51 |
|
|
|
| 52 |
|
|
ARCHITECTURE behavior OF MemoryBlock_Test_vhd IS
|
| 53 |
|
|
|
| 54 |
|
|
constant clk_period : time := 1us;
|
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
|
|
SIGNAL reset : std_logic := '0';
|
| 58 |
|
|
SIGNAL clk : std_logic := '0';
|
| 59 |
|
|
-------------------------------------------------
|
| 60 |
|
|
SIGNAL p1_addr : std_logic_vector(10 downto 0) := (others => '0');
|
| 61 |
|
|
SIGNAL p1_data_in : std_logic_vector(7 downto 0) := (others => '0');
|
| 62 |
|
|
SIGNAL p1_data_out : std_logic_vector(7 downto 0);
|
| 63 |
|
|
SIGNAL p1_strobe : std_logic := '0';
|
| 64 |
|
|
-------------------------------------------------
|
| 65 |
|
|
SIGNAL p2_addr : std_logic_vector(10 downto 0) := (others => '0');
|
| 66 |
|
|
SIGNAL p2_data_in : std_logic_vector(7 downto 0) := (others => '0');
|
| 67 |
|
|
SIGNAL p2_data_out : std_logic_vector(7 downto 0);
|
| 68 |
|
|
SIGNAL p2_strobe : std_logic := '0';
|
| 69 |
|
|
|
| 70 |
|
|
BEGIN
|
| 71 |
|
|
|
| 72 |
|
|
-- Instantiate the Unit Under Test (UUT)
|
| 73 |
|
|
uut: MemoryBlock port map (
|
| 74 |
|
|
reset => reset,
|
| 75 |
|
|
clk => clk,
|
| 76 |
|
|
-------------------------------------------------
|
| 77 |
|
|
p1_addr => p1_addr,
|
| 78 |
|
|
p1_data_in => p1_data_in,
|
| 79 |
|
|
p1_strobe => p1_strobe,
|
| 80 |
|
|
p1_data_out => p1_data_out,
|
| 81 |
|
|
-------------------------------------------------
|
| 82 |
|
|
p2_addr => p2_addr,
|
| 83 |
|
|
p2_data_in => p2_data_in,
|
| 84 |
|
|
p2_strobe => p2_strobe,
|
| 85 |
|
|
p2_data_out => p2_data_out
|
| 86 |
|
|
);
|
| 87 |
|
|
|
| 88 |
|
|
-- Clock process definitions
|
| 89 |
|
|
clk_process :process
|
| 90 |
|
|
begin
|
| 91 |
|
|
clk <= '0';
|
| 92 |
|
|
wait for clk_period/2;
|
| 93 |
|
|
clk <= '1';
|
| 94 |
|
|
wait for clk_period/2;
|
| 95 |
|
|
end process;
|
| 96 |
|
|
|
| 97 |
|
|
stim_proc: PROCESS
|
| 98 |
|
|
BEGIN
|
| 99 |
|
|
|
| 100 |
|
|
reset <= '1';
|
| 101 |
|
|
wait for clk_period*4;
|
| 102 |
|
|
reset <= '0';
|
| 103 |
|
|
wait for clk_period*20;
|
| 104 |
|
|
|
| 105 |
|
|
p1_addr <= "00000000000";
|
| 106 |
|
|
p2_addr <= "00000000000";
|
| 107 |
|
|
p1_data_in <= "10101010";
|
| 108 |
|
|
|
| 109 |
|
|
wait for clk_period/2;
|
| 110 |
|
|
|
| 111 |
|
|
p1_strobe <= '1';
|
| 112 |
|
|
wait for clk_period;
|
| 113 |
|
|
p1_strobe <= '0';
|
| 114 |
|
|
|
| 115 |
|
|
wait for clk_period*4;
|
| 116 |
|
|
|
| 117 |
|
|
p2_addr <= "00000000101";
|
| 118 |
|
|
p2_data_in <= "11010101";
|
| 119 |
|
|
|
| 120 |
|
|
wait for clk_period;
|
| 121 |
|
|
|
| 122 |
|
|
p2_strobe <= '1';
|
| 123 |
|
|
wait for clk_period;
|
| 124 |
|
|
p2_strobe <= '0';
|
| 125 |
|
|
|
| 126 |
|
|
wait for clk_period*4;
|
| 127 |
|
|
|
| 128 |
|
|
p1_addr <= "00000000101";
|
| 129 |
|
|
|
| 130 |
|
|
wait; -- will wait forever
|
| 131 |
|
|
END PROCESS;
|
| 132 |
|
|
|
| 133 |
|
|
END;
|