OpenCores
URL https://opencores.org/ocsvn/gpib_controller/gpib_controller/trunk

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [test/] [RegsGpibFasade_test.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2 13 Andrewski
--This file is part of fpga_gpib_controller.
3 3 Andrewski
--
4 13 Andrewski
-- 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
 
14
-- 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
--------------------------------------------------------------------------------
17
-- Author: Andrzej Paluch
18
--
19 3 Andrewski
-- Create Date:   16:22:23 02/04/2012
20
-- Design Name:   
21 13 Andrewski
-- Module Name:   RegsGpibFasade_test.vhd
22 3 Andrewski
-- Project Name:  proto1
23
-- Target Device:  
24
-- Tool versions:  
25
-- Description:   
26
-- 
27
-- VHDL Test Bench Created by ISE for module: RegsGpibFasade
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
 
45
-- Uncomment the following library declaration if using
46
-- arithmetic functions with Signed or Unsigned values
47
--USE ieee.numeric_std.ALL;
48
 
49
use work.wrapperComponents.ALL;
50
 
51
ENTITY RegsGpibFasade_test IS
52
END RegsGpibFasade_test;
53
 
54
ARCHITECTURE behavior OF RegsGpibFasade_test IS
55
 
56
        component gpibCableEmulator is port (
57
                -- interface signals
58
                DIO_1 : in std_logic_vector (7 downto 0);
59
                output_valid_1 : in std_logic;
60
                DIO_2 : in std_logic_vector (7 downto 0);
61
                output_valid_2 : in std_logic;
62
                DIO : out std_logic_vector (7 downto 0);
63
                -- attention
64
                ATN_1 : in std_logic;
65
                ATN_2 : in std_logic;
66
                ATN : out std_logic;
67
                -- data valid
68
                DAV_1 : in std_logic;
69
                DAV_2 : in std_logic;
70
                DAV : out std_logic;
71
                -- not ready for data
72
                NRFD_1 : in std_logic;
73
                NRFD_2 : in std_logic;
74
                NRFD : out std_logic;
75
                -- no data accepted
76
                NDAC_1 : in std_logic;
77
                NDAC_2 : in std_logic;
78
                NDAC : out std_logic;
79
                -- end or identify
80
                EOI_1 : in std_logic;
81
                EOI_2 : in std_logic;
82
                EOI : out std_logic;
83
                -- service request
84
                SRQ_1 : in std_logic;
85
                SRQ_2 : in std_logic;
86
                SRQ : out std_logic;
87
                -- interface clear
88
                IFC_1 : in std_logic;
89
                IFC_2 : in std_logic;
90
                IFC : out std_logic;
91
                -- remote enable
92
                REN_1 : in std_logic;
93
                REN_2 : in std_logic;
94
                REN : out std_logic
95
        );
96
        end component;
97
 
98
   --Inputs
99
   signal reset : std_logic := '0';
100
   signal clk : std_logic := '0';
101
   signal DI : std_logic_vector(7 downto 0) := (others => '0');
102
   signal ATN_in : std_logic := '0';
103
   signal DAV_in : std_logic := '0';
104
   signal NRFD_in : std_logic := '0';
105
   signal NDAC_in : std_logic := '0';
106
   signal EOI_in : std_logic := '0';
107
   signal SRQ_in : std_logic := '0';
108
   signal IFC_in : std_logic := '0';
109
   signal REN_in : std_logic := '0';
110
   signal data_in : std_logic_vector(15 downto 0) := (others => '0');
111
   signal reg_addr : std_logic_vector(14 downto 0) := (others => '0');
112
   signal strobe_read : std_logic := '0';
113
   signal strobe_write : std_logic := '0';
114
 
115
        --Outputs
116
   signal DO : std_logic_vector(7 downto 0);
117
   signal output_valid : std_logic;
118
   signal ATN_out : std_logic;
119
   signal DAV_out : std_logic;
120
   signal NRFD_out : std_logic;
121
   signal NDAC_out : std_logic;
122
   signal EOI_out : std_logic;
123
   signal SRQ_out : std_logic;
124
   signal IFC_out : std_logic;
125
   signal REN_out : std_logic;
126
   signal data_out : std_logic_vector(15 downto 0);
127
   signal interrupt_line : std_logic;
128
   signal debug1 : std_logic;
129
 
130
   -- Clock period definitions
131
   constant clk_period : time := 10 ns;
132
 
133
BEGIN
134
 
135
        -- Instantiate the Unit Under Test (UUT)
136
        uut: RegsGpibFasade PORT MAP (
137
                reset => reset,
138
                clk => clk,
139
                DI => DI,
140
                DO => DO,
141
                output_valid => output_valid,
142
                ATN_in => ATN_in,
143
                ATN_out => ATN_out,
144
                DAV_in => DAV_in,
145
                DAV_out => DAV_out,
146
                NRFD_in => NRFD_in,
147
                NRFD_out => NRFD_out,
148
                NDAC_in => NDAC_in,
149
                NDAC_out => NDAC_out,
150
                EOI_in => EOI_in,
151
                EOI_out => EOI_out,
152
                SRQ_in => SRQ_in,
153
                SRQ_out => SRQ_out,
154
                IFC_in => IFC_in,
155
                IFC_out => IFC_out,
156
                REN_in => REN_in,
157
                REN_out => REN_out,
158
                data_in => data_in,
159
                data_out => data_out,
160
                reg_addr => reg_addr,
161
                strobe_read => strobe_read,
162
                strobe_write => strobe_write,
163
                interrupt_line => interrupt_line,
164
                debug1 => debug1
165
        );
166
 
167
        gce: gpibCableEmulator port map (
168
                -- interface signals
169
                DIO_1 => DO,
170
                output_valid_1 => output_valid,
171
                DIO_2 => "00000000",
172
                output_valid_2 => '0',
173
                DIO => DI,
174
                -- attention
175
                ATN_1 => ATN_out,
176
                ATN_2 => '0',
177
                ATN => ATN_in,
178
                -- data valid
179
                DAV_1 => DAV_out,
180
                DAV_2 => '0',
181
                DAV => DAV_in,
182
                -- not ready for data
183
                NRFD_1 => NRFD_out,
184
                NRFD_2 => '0',
185
                NRFD => NRFD_in,
186
                -- no data accepted
187
                NDAC_1 => NDAC_out,
188
                NDAC_2 => '0',
189
                NDAC => NDAC_in,
190
                -- end or identify
191
                EOI_1 => EOI_out,
192
                EOI_2 => '0',
193
                EOI => EOI_in,
194
                -- service request
195
                SRQ_1 => SRQ_out,
196
                SRQ_2 => '0',
197
                SRQ => SRQ_in,
198
                -- interface clear
199
                IFC_1 => IFC_out,
200
                IFC_2 => '0',
201
                IFC => IFC_in,
202
                -- remote enable
203
                REN_1 => REN_out,
204
                REN_2 => '0',
205
                REN => REN_in
206
        );
207
 
208
   -- Clock process definitions
209
   clk_process :process
210
   begin
211
                clk <= '0';
212
                wait for clk_period/2;
213
                clk <= '1';
214
                wait for clk_period/2;
215
   end process;
216
 
217
 
218
   -- Stimulus process
219
        stim_proc: process begin
220
 
221
                -- hold reset state for 10 clock cycles
222
                reset <= '1';
223
                wait for clk_period*10;
224
                reset <= '0';
225
                wait for clk_period*10;
226
 
227
                -- set rsc
228
                reg_addr <= "000000000000111";
229
                data_in <= "0000000001000000";
230
 
231
                wait for clk_period*2;
232
                strobe_write <= '1';
233
                wait for clk_period*2;
234
                strobe_write <= '0';
235
 
236
                wait for clk_period*20;
237
 
238
                -- set sic
239
                data_in <= "0000000011000000";
240
                wait for clk_period*2;
241
                strobe_write <= '1';
242
                wait for clk_period*2;
243
                strobe_write <= '0';
244
 
245
                wait for clk_period*20;
246
 
247
                -- reset sic
248
                data_in <= "0000000001000000";
249
                wait for clk_period*2;
250
                strobe_write <= '1';
251
                wait for clk_period*2;
252
                strobe_write <= '0';
253
 
254
                wait for clk_period*20;
255
 
256
                -- enable writer
257
                reg_addr <= "000000000001010";
258
                data_in <= "0000000000000010";
259
                wait for clk_period*2;
260
                strobe_write <= '1';
261
                wait for clk_period*2;
262
                strobe_write <= '0';
263
 
264
                -- self address to listen
265
                reg_addr <= "000000000001101";
266
                data_in <= "0000000000100001";
267
                wait for clk_period*2;
268
                strobe_write <= '1';
269
                wait for clk_period*2;
270
                strobe_write <= '0';
271
 
272
                -- self address to listen again
273
                reg_addr <= "000000000001101";
274
                data_in <= "0000000000100011";
275
                wait for clk_period*2;
276
                strobe_write <= '1';
277
                wait for clk_period*2;
278
                strobe_write <= '0';
279
 
280
                wait for clk_period*10;
281
 
282
                wait;
283
        end process;
284
 
285
END;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.