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: 20:43:38 11/14/2011
|
20 |
|
|
-- Design Name: RegMultiplexer
|
21 |
|
|
-- Module Name: J:/projekty/elektronika/USB_to_HPIB/usbToHpib/src/test/RegMultiplexer_Test.vhd
|
22 |
|
|
-- Project Name: usbToGpib
|
23 |
|
|
-- Target Device:
|
24 |
|
|
-- Tool versions:
|
25 |
|
|
-- Description:
|
26 |
|
|
--
|
27 |
|
|
-- VHDL Test Bench Created by ISE for module: RegMultiplexer
|
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.wrapperComponents.all;
|
48 |
|
|
|
49 |
|
|
ENTITY RegMultiplexer_Test_vhd IS
|
50 |
|
|
END RegMultiplexer_Test_vhd;
|
51 |
|
|
|
52 |
|
|
ARCHITECTURE behavior OF RegMultiplexer_Test_vhd IS
|
53 |
|
|
|
54 |
|
|
-- clock definitions
|
55 |
|
|
constant clk_period : time := 2ps;
|
56 |
|
|
signal clk : std_logic := '0';
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
--Inputs
|
60 |
|
|
SIGNAL strobe : std_logic := '0';
|
61 |
|
|
SIGNAL data_in : std_logic_vector(15 downto 0) := (others=>'0');
|
62 |
|
|
SIGNAL reg_addr : std_logic_vector(14 downto 0) := (others=>'0');
|
63 |
|
|
SIGNAL reg_out_0 : std_logic_vector(15 downto 0) := "0000000000000001";
|
64 |
|
|
SIGNAL reg_out_1 : std_logic_vector(15 downto 0) := "0000000000000010";
|
65 |
|
|
SIGNAL reg_out_2 : std_logic_vector(15 downto 0) := "0000000000000011";
|
66 |
|
|
SIGNAL reg_out_3 : std_logic_vector(15 downto 0) := "0000000000000100";
|
67 |
|
|
SIGNAL reg_out_4 : std_logic_vector(15 downto 0) := "0000000000000101";
|
68 |
|
|
SIGNAL reg_out_5 : std_logic_vector(15 downto 0) := "0000000000000110";
|
69 |
|
|
SIGNAL reg_out_6 : std_logic_vector(15 downto 0) := "0000000000000111";
|
70 |
|
|
SIGNAL reg_out_7 : std_logic_vector(15 downto 0) := "0000000000001000";
|
71 |
|
|
SIGNAL reg_out_8 : std_logic_vector(15 downto 0) := "0000000000001001";
|
72 |
|
|
SIGNAL reg_out_9 : std_logic_vector(15 downto 0) := "0000000000001010";
|
73 |
|
|
SIGNAL reg_out_10 : std_logic_vector(15 downto 0) := "0000000000001011";
|
74 |
|
|
SIGNAL reg_out_11 : std_logic_vector(15 downto 0) := "0000000000001100";
|
75 |
|
|
SIGNAL reg_out_writer : std_logic_vector(15 downto 0) := "0000000000001101";
|
76 |
|
|
SIGNAL reg_out_reader : std_logic_vector(15 downto 0) := "0000000000001110";
|
77 |
|
|
|
78 |
|
|
--Outputs
|
79 |
|
|
SIGNAL data_out : std_logic_vector(15 downto 0);
|
80 |
|
|
SIGNAL reg_strobe_0 : std_logic;
|
81 |
|
|
SIGNAL reg_in_0 : std_logic_vector(15 downto 0);
|
82 |
|
|
SIGNAL reg_strobe_1 : std_logic;
|
83 |
|
|
SIGNAL reg_in_1 : std_logic_vector(15 downto 0);
|
84 |
|
|
SIGNAL reg_strobe_2 : std_logic;
|
85 |
|
|
SIGNAL reg_in_2 : std_logic_vector(15 downto 0);
|
86 |
|
|
SIGNAL reg_strobe_3 : std_logic;
|
87 |
|
|
SIGNAL reg_in_3 : std_logic_vector(15 downto 0);
|
88 |
|
|
SIGNAL reg_strobe_4 : std_logic;
|
89 |
|
|
SIGNAL reg_in_4 : std_logic_vector(15 downto 0);
|
90 |
|
|
SIGNAL reg_strobe_5 : std_logic;
|
91 |
|
|
SIGNAL reg_in_5 : std_logic_vector(15 downto 0);
|
92 |
|
|
SIGNAL reg_strobe_6 : std_logic;
|
93 |
|
|
SIGNAL reg_in_6 : std_logic_vector(15 downto 0);
|
94 |
|
|
SIGNAL reg_strobe_7 : std_logic;
|
95 |
|
|
SIGNAL reg_in_7 : std_logic_vector(15 downto 0);
|
96 |
|
|
SIGNAL reg_strobe_8 : std_logic;
|
97 |
|
|
SIGNAL reg_in_8 : std_logic_vector(15 downto 0);
|
98 |
|
|
SIGNAL reg_strobe_9 : std_logic;
|
99 |
|
|
SIGNAL reg_in_9 : std_logic_vector(15 downto 0);
|
100 |
|
|
SIGNAL reg_strobe_10 : std_logic;
|
101 |
|
|
SIGNAL reg_in_10 : std_logic_vector(15 downto 0);
|
102 |
|
|
SIGNAL reg_strobe_11 : std_logic;
|
103 |
|
|
SIGNAL reg_in_11 : std_logic_vector(15 downto 0);
|
104 |
|
|
SIGNAL reg_strobe_writer : std_logic;
|
105 |
|
|
SIGNAL reg_in_writer : std_logic_vector(15 downto 0);
|
106 |
|
|
SIGNAL reg_strobe_reader : std_logic;
|
107 |
|
|
SIGNAL reg_in_reader : std_logic_vector(15 downto 0);
|
108 |
|
|
|
109 |
|
|
BEGIN
|
110 |
|
|
|
111 |
|
|
-- Instantiate the Unit Under Test (UUT)
|
112 |
|
|
uut: RegMultiplexer generic map(READER_WRITER_BUF_LEN => 16) PORT MAP(
|
113 |
|
|
strobe => strobe,
|
114 |
|
|
data_in => data_in,
|
115 |
|
|
data_out => data_out,
|
116 |
|
|
reg_addr => reg_addr,
|
117 |
|
|
reg_strobe_0 => reg_strobe_0,
|
118 |
|
|
reg_in_0 => reg_in_0,
|
119 |
|
|
reg_out_0 => reg_out_0,
|
120 |
|
|
reg_strobe_1 => reg_strobe_1,
|
121 |
|
|
reg_in_1 => reg_in_1,
|
122 |
|
|
reg_out_1 => reg_out_1,
|
123 |
|
|
reg_strobe_2 => reg_strobe_2,
|
124 |
|
|
reg_in_2 => reg_in_2,
|
125 |
|
|
reg_out_2 => reg_out_2,
|
126 |
|
|
reg_strobe_3 => reg_strobe_3,
|
127 |
|
|
reg_in_3 => reg_in_3,
|
128 |
|
|
reg_out_3 => reg_out_3,
|
129 |
|
|
reg_strobe_4 => reg_strobe_4,
|
130 |
|
|
reg_in_4 => reg_in_4,
|
131 |
|
|
reg_out_4 => reg_out_4,
|
132 |
|
|
reg_strobe_5 => reg_strobe_5,
|
133 |
|
|
reg_in_5 => reg_in_5,
|
134 |
|
|
reg_out_5 => reg_out_5,
|
135 |
|
|
reg_strobe_6 => reg_strobe_6,
|
136 |
|
|
reg_in_6 => reg_in_6,
|
137 |
|
|
reg_out_6 => reg_out_6,
|
138 |
|
|
reg_strobe_7 => reg_strobe_7,
|
139 |
|
|
reg_in_7 => reg_in_7,
|
140 |
|
|
reg_out_7 => reg_out_7,
|
141 |
|
|
reg_strobe_8 => reg_strobe_8,
|
142 |
|
|
reg_in_8 => reg_in_8,
|
143 |
|
|
reg_out_8 => reg_out_8,
|
144 |
|
|
reg_strobe_9 => reg_strobe_9,
|
145 |
|
|
reg_in_9 => reg_in_9,
|
146 |
|
|
reg_out_9 => reg_out_9,
|
147 |
|
|
reg_strobe_10 => reg_strobe_10,
|
148 |
|
|
reg_in_10 => reg_in_10,
|
149 |
|
|
reg_out_10 => reg_out_10,
|
150 |
|
|
reg_strobe_11 => reg_strobe_11,
|
151 |
|
|
reg_in_11 => reg_in_11,
|
152 |
|
|
reg_out_11 => reg_out_11,
|
153 |
|
|
reg_strobe_other0 => reg_strobe_writer,
|
154 |
|
|
reg_in_other0 => reg_in_writer,
|
155 |
|
|
reg_out_other0 => reg_out_writer,
|
156 |
|
|
reg_strobe_other1 => reg_strobe_reader,
|
157 |
|
|
reg_in_other1 => reg_in_reader,
|
158 |
|
|
reg_out_other1 => reg_out_reader
|
159 |
|
|
);
|
160 |
|
|
|
161 |
|
|
-- Clock process definitions
|
162 |
|
|
clk_process :process
|
163 |
|
|
begin
|
164 |
|
|
clk <= '0';
|
165 |
|
|
wait for clk_period/2;
|
166 |
|
|
clk <= '1';
|
167 |
|
|
wait for clk_period/2;
|
168 |
|
|
end process;
|
169 |
|
|
|
170 |
|
|
strobe <= clk;
|
171 |
|
|
|
172 |
|
|
stim_proc : PROCESS
|
173 |
|
|
BEGIN
|
174 |
|
|
|
175 |
|
|
data_in <= "1010101010101010";
|
176 |
|
|
|
177 |
|
|
wait for clk_period * 10;
|
178 |
|
|
|
179 |
|
|
report "$$$ begin RegMultiplexer test $$$";
|
180 |
|
|
|
181 |
|
|
reg_addr <= "000000000000000";
|
182 |
|
|
wait for clk_period * 10;
|
183 |
|
|
reg_addr <= "000000000000001";
|
184 |
|
|
wait for clk_period * 10;
|
185 |
|
|
reg_addr <= "000000000000010";
|
186 |
|
|
wait for clk_period * 10;
|
187 |
|
|
reg_addr <= "000000000000011";
|
188 |
|
|
wait for clk_period * 10;
|
189 |
|
|
reg_addr <= "000000000000100";
|
190 |
|
|
wait for clk_period * 10;
|
191 |
|
|
reg_addr <= "000000000000101";
|
192 |
|
|
wait for clk_period * 10;
|
193 |
|
|
reg_addr <= "000000000000110";
|
194 |
|
|
wait for clk_period * 10;
|
195 |
|
|
reg_addr <= "000000000000111";
|
196 |
|
|
wait for clk_period * 10;
|
197 |
|
|
reg_addr <= "000000000001000";
|
198 |
|
|
wait for clk_period * 10;
|
199 |
|
|
reg_addr <= "000000000001001";
|
200 |
|
|
wait for clk_period * 10;
|
201 |
|
|
reg_addr <= "000000000001010";
|
202 |
|
|
wait for clk_period * 10;
|
203 |
|
|
reg_addr <= "000000000001011";
|
204 |
|
|
wait for clk_period * 10;
|
205 |
|
|
reg_addr <= "000000000001100";
|
206 |
|
|
wait for clk_period * 10;
|
207 |
|
|
reg_addr <= "000000000011100";
|
208 |
|
|
wait for clk_period * 10;
|
209 |
|
|
|
210 |
|
|
report "$$$ end RegMultiplexer test $$$";
|
211 |
|
|
|
212 |
|
|
wait; -- will wait forever
|
213 |
|
|
END PROCESS;
|
214 |
|
|
|
215 |
|
|
END;
|