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 3

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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