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

Subversion Repositories pif2wb

[/] [pif2wb/] [trunk/] [vhdl/] [tb_pif2wb.vhd] - Blame information for rev 12

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

Line No. Rev Author Line
1 6 sergio.tot
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
USE IEEE.STD_LOGIC_TEXTIO.ALL;
6
USE STD.TEXTIO.ALL;
7
 
8
ENTITY test_bridge IS
9
END test_bridge;
10
 
11
ARCHITECTURE testbench_arch OF test_bridge IS
12
    FILE RESULTS: TEXT OPEN WRITE_MODE IS "results.txt";
13
 
14
    COMPONENT top
15
        PORT (
16
            SCLK : In std_logic;
17
            CLKETH : In std_logic;
18
            SReset : In std_logic;
19
            PIReqVALID : In std_logic;
20
            PIReqCNTL : In std_logic_vector (7 DownTo 0);
21
            PIReqADRS : In std_logic_vector (31 DownTo 0);
22
            PIReqDATA : In std_logic_vector (31 DownTo 0);
23
            PIReqDataBE : In std_logic_vector (3 DownTo 0);
24
            PIRespRDY : In std_logic;
25
            probe_mtxd_pad_o : Out std_logic_vector (3 DownTo 0);
26
            probe_mtxen_pad_o : Out std_logic;
27
            mtxerr_pad_o : Out std_logic;
28
            probe_mrxd_pad_i : In std_logic_vector (3 DownTo 0);
29
            probe_mrxdv_pad_i : In std_logic;
30
            probe_mrxerr_pad_i : In std_logic;
31
            probe_mcoll_pad_i : In std_logic;
32
            probe_mcrs_pad_i : In std_logic;
33
            probe_mdc_pad_o : Out std_logic;
34
            probe_md_pad_i : In std_logic;
35
            probe_md_pad_o : Out std_logic;
36
            probe_md_padoe_o : Out std_logic;
37
            interrupt : Out std_logic
38
        );
39
    END COMPONENT;
40
 
41
    SIGNAL SCLK : std_logic := '0';
42
    SIGNAL CLKETH : std_logic := '0';
43
    SIGNAL SReset : std_logic := '0';
44
    SIGNAL PIReqVALID : std_logic := '0';
45
    SIGNAL PIReqCNTL : std_logic_vector (7 DownTo 0) := "00000000";
46
    SIGNAL PIReqADRS : std_logic_vector (31 DownTo 0) := "00000000000000000000000000000000";
47
    SIGNAL PIReqDATA : std_logic_vector (31 DownTo 0) := "00000000000000000000000000000000";
48
    SIGNAL PIReqDataBE : std_logic_vector (3 DownTo 0) := "0000";
49
    SIGNAL PIRespRDY : std_logic := '0';
50
    SIGNAL probe_mtxd_pad_o : std_logic_vector (3 DownTo 0) := "0000";
51
    SIGNAL probe_mtxen_pad_o : std_logic := '0';
52
    SIGNAL mtxerr_pad_o : std_logic := '0';
53
    SIGNAL probe_mrxd_pad_i : std_logic_vector (3 DownTo 0) := "0000";
54
    SIGNAL probe_mrxdv_pad_i : std_logic := '0';
55
    SIGNAL probe_mrxerr_pad_i : std_logic := '0';
56
    SIGNAL probe_mcoll_pad_i : std_logic := '0';
57
    SIGNAL probe_mcrs_pad_i : std_logic := '0';
58
    SIGNAL probe_mdc_pad_o : std_logic := '0';
59
    SIGNAL probe_md_pad_i : std_logic := '0';
60
    SIGNAL probe_md_pad_o : std_logic := '0';
61
    SIGNAL probe_md_padoe_o : std_logic := '0';
62
    SIGNAL interrupt : std_logic := '0';
63
 
64
    constant PERIOD_CLKETH : time := 40 ns;
65
    constant DUTY_CYCLE_CLKETH : real := 0.5;
66
    constant OFFSET_CLKETH : time := 100 ns;
67
    constant PERIOD_SCLK : time := 20 ns;
68
    constant DUTY_CYCLE_SCLK : real := 0.5;
69
    constant OFFSET_SCLK : time := 100 ns;
70
 
71
    BEGIN
72
        UUT : top
73
        PORT MAP (
74
            SCLK => SCLK,
75
            CLKETH => CLKETH,
76
            SReset => SReset,
77
            PIReqVALID => PIReqVALID,
78
            PIReqCNTL => PIReqCNTL,
79
            PIReqADRS => PIReqADRS,
80
            PIReqDATA => PIReqDATA,
81
            PIReqDataBE => PIReqDataBE,
82
            PIRespRDY => PIRespRDY,
83
            probe_mtxd_pad_o => probe_mtxd_pad_o,
84
            probe_mtxen_pad_o => probe_mtxen_pad_o,
85
            mtxerr_pad_o => mtxerr_pad_o,
86
            probe_mrxd_pad_i => probe_mrxd_pad_i,
87
            probe_mrxdv_pad_i => probe_mrxdv_pad_i,
88
            probe_mrxerr_pad_i => probe_mrxerr_pad_i,
89
            probe_mcoll_pad_i => probe_mcoll_pad_i,
90
            probe_mcrs_pad_i => probe_mcrs_pad_i,
91
            probe_mdc_pad_o => probe_mdc_pad_o,
92
            probe_md_pad_i => probe_md_pad_i,
93
            probe_md_pad_o => probe_md_pad_o,
94
            probe_md_padoe_o => probe_md_padoe_o,
95
            interrupt => interrupt
96
        );
97
 
98
        PROCESS    -- clock process for CLK ETHERNET CONTROLLER
99
        BEGIN
100
            WAIT for OFFSET_CLKETH;
101
            CLOCK_LOOP : LOOP
102
                CLKETH <= '0';
103
                WAIT FOR (PERIOD_CLKETH - (PERIOD_CLKETH * DUTY_CYCLE_CLKETH));
104
                CLKETH <= '1';
105
                WAIT FOR (PERIOD_CLKETH * DUTY_CYCLE_CLKETH);
106
            END LOOP CLOCK_LOOP;
107
        END PROCESS;
108
 
109
        PROCESS    -- clock process for SCLK
110
        BEGIN
111
            WAIT for OFFSET_SCLK;
112
            CLOCK_LOOP : LOOP
113
                SCLK <= '0';
114
                WAIT FOR (PERIOD_SCLK - (PERIOD_SCLK * DUTY_CYCLE_SCLK));
115
                SCLK <= '1';
116
                WAIT FOR (PERIOD_SCLK * DUTY_CYCLE_SCLK);
117
            END LOOP CLOCK_LOOP;
118
        END PROCESS;
119
 
120
        PROCESS    -- Process for CLKETH
121
            BEGIN
122
                WAIT FOR 2040 ns;
123
 
124
            END PROCESS;
125
 
126
            PROCESS    -- Process for SCLK
127
                BEGIN
128
                    -- -------------  Current Time:  95ns Reset the System
129
                    WAIT FOR 95 ns;
130
                    SReset <= '1';
131
                    PIRespRDY <= '1';
132
                    -- ------------------------------------- End reset
133
                    -- -------------  Current Time:  135ns
134
                    WAIT FOR 40 ns;
135
                    SReset <= '0';
136
                    -- ------------------------------------- Single Read at Address 0x60000194
137
                    -- -------------  Current Time:  175ns   Test address out of range
138
                    WAIT FOR 40 ns;
139
                    PIReqVALID <= '1';
140
                    PIReqCNTL <= "00000001";
141
                    PIReqADRS <= "01100000000000000000100100010000";
142
                    PIReqDATA <= "10000000000000000000000000000000";
143
                    PIReqDataBE <= "1111";
144
                    -- ------------------------------------- End of Single Read
145
                    -- -------------  Current Time:  195ns
146
                    WAIT FOR 20 ns;
147
                    PIReqVALID <= '0';
148
                    PIReqCNTL <= "11111111";
149
                    PIReqDataBE <= "0000";
150
                    -- ------------------------------------- Single Read at Address 0x80000000
151
                    -- -------------  Current Time:  235ns   First Ethernet register    
152
                    WAIT FOR 40 ns;
153
                    PIReqVALID <= '1';
154
                    PIReqCNTL <= "00000001";
155
                    PIReqADRS <= "10000000000000000000000000000000";
156
                    PIReqDataBE <= "1111";
157
                    -- ------------------------------------- End of Single Read
158
                    -- -------------  Current Time:  255ns
159
                    WAIT FOR 20 ns;
160
                    PIReqVALID <= '0';
161
                    PIReqCNTL <= "11111111";
162
                    PIReqDataBE <= "0000";
163
                    -- ------------------------------------- Single Write at Address 0x80000000
164
                    -- -------------  Current Time:  295ns
165
                    WAIT FOR 40 ns;
166
                    PIReqVALID <= '1';
167
                    PIReqCNTL <= "10000001";
168
                    PIReqDATA <= "00000000000000001111111111111111";
169
                    PIReqDataBE <= "1111";
170
                    -- ------------------------------------- End of Single Write
171
                    -- -------------  Current Time:  315ns
172
                    WAIT FOR 20 ns;
173
                    PIReqVALID <= '0';
174
                    PIReqCNTL <= "11111111";
175
                    PIReqDataBE <= "0000";
176
                    -- ------------------------------------- Single Read at Address 0x80000000
177
                    -- -------------  Current Time:  355ns
178
                    WAIT FOR 40 ns;
179
                    PIReqVALID <= '1';
180
                    PIReqCNTL <= "00000001";
181
                    PIReqDATA <= "10000000000000000000000000000000";
182
                    PIReqDataBE <= "1111";
183
                    -- ------------------------------------- End of Single Read
184
                    -- -------------  Current Time:  375ns
185
                    WAIT FOR 20 ns;
186
                    PIReqVALID <= '0';
187
                    PIReqCNTL <= "11111111";
188
                    PIReqDataBE <= "0000";
189
                    -- ------------------------------------- Single Write at Address 0x80000001
190
                    -- -------------  Current Time:  415ns
191
                    WAIT FOR 40 ns;
192
                    PIReqVALID <= '1';
193
                    PIReqCNTL <= "10000001";
194
                    PIReqADRS <= "10000000000000000000000000000001";
195
                    PIReqDATA <= "00000000000000001111111111111111";
196
                    PIReqDataBE <= "1111";
197
                    -- ------------------------------------- End of Single Write
198
                    -- -------------  Current Time:  435ns
199
                    WAIT FOR 20 ns;
200
                    PIReqVALID <= '0';
201
                    PIReqCNTL <= "11111111";
202
                    PIReqDataBE <= "0000";
203
                    -- ------------------------------------- Single Read at Address 0x80000001
204
                    -- -------------  Current Time:  475ns
205
                    WAIT FOR 40 ns;
206
                    PIReqVALID <= '1';
207
                    PIReqCNTL <= "00000001";
208
                    PIReqDATA <= "10000000000000000000000000000000";
209
                    PIReqDataBE <= "1111";
210
                    -- ------------------------------------- End of Single Read
211
                    -- -------------  Current Time:  495ns
212
                    WAIT FOR 20 ns;
213
                    PIReqVALID <= '0';
214
                    PIReqCNTL <= "11111111";
215
                    PIReqDataBE <= "0000";
216
                    -- ------------------------------------- Block Read. Start Address 0x80000002
217
                    -- -------------  Current Time:  575ns   Number of Transfers 2
218
                    WAIT FOR 80 ns;
219
                    PIReqVALID <= '1';
220
                    PIReqCNTL <= "00010001";
221
                    PIReqADRS <= "10000000000000000000000000000010";
222
                    PIReqDataBE <= "1111";
223
                    -- -------------------------------------
224
                    -- -------------  Current Time:  595ns
225
                    WAIT FOR 20 ns;
226
                    PIReqVALID <= '0';
227
                    PIReqCNTL <= "11111111";
228
                    PIReqADRS <= "01100000000000000000000110010100";
229
                    PIReqDataBE <= "0000";
230
                    -- -------------------------------------
231
                    -- -------------  Current Time:  635ns
232
                    WAIT FOR 40 ns;
233
                    PIReqDataBE <= "1111";
234
                    -- ------------------------------------- End of Block Read
235
                    -- -------------  Current Time:  655ns
236
                    WAIT FOR 20 ns;
237
                    PIReqDataBE <= "0000";
238
                    -- ------------------------------------- Block Write. Start Address 0x80000002
239
                    -- -------------  Current Time:  715ns   Number of Transfers 2
240
                    WAIT FOR 60 ns;
241
                    PIReqVALID <= '1';
242
                    PIReqCNTL <= "10010001";
243
                    PIReqADRS <= "10000000000000000000000000000010";
244
                    PIReqDATA <= "00000000000000001111111111111111";
245
                    PIReqDataBE <= "1111";
246
                    -- -------------------------------------
247
                    -- -------------  Current Time:  735ns
248
                    WAIT FOR 20 ns;
249
                    PIReqVALID <= '0';
250
                    PIReqCNTL <= "11111111";
251
                    PIReqDataBE <= "0000";
252
                    -- -------------------------------------
253
                    -- -------------  Current Time:  775ns
254
                    WAIT FOR 40 ns;
255
                    PIReqVALID <= '1';
256
                    PIReqDATA <= "00000000000000001111000011110000";
257
                    PIReqDataBE <= "1111";
258
                    -- ------------------------------------- End of Block Write
259
                    -- -------------  Current Time:  795ns
260
                    WAIT FOR 20 ns;
261
                    PIReqVALID <= '0';
262
                    PIReqADRS <= "01100000000000000000000110010100";
263
                    PIReqDataBE <= "0000";
264
                    -- ------------------------------------- Block Read. Start Address 0x80000002
265
                    -- -------------  Current Time:  915ns   Number of Transfers 2
266
                    WAIT FOR 120 ns;
267
                    PIReqVALID <= '1';
268
                    PIReqCNTL <= "00010001";
269
                    PIReqADRS <= "10000000000000000000000000000010";
270
                    PIReqDATA <= "10000000000000000000000000000000";
271
                    PIReqDataBE <= "1111";
272
                    -- -------------------------------------
273
                    -- -------------  Current Time:  935ns
274
                    WAIT FOR 20 ns;
275
                    PIReqVALID <= '0';
276
                    PIReqCNTL <= "11111111";
277
                    PIReqDataBE <= "0000";
278
                    -- -------------------------------------
279
                    -- -------------  Current Time:  1055ns
280
                    WAIT FOR 120 ns;
281
                    PIReqVALID <= '1';
282
                    PIReqCNTL <= "10010011";
283
                    PIReqDATA <= "00000000000000000000000000001111";
284
                    PIReqDataBE <= "1111";
285
                    -- ------------------------------------- End of Block Read
286
                    -- -------------  Current Time:  1075ns
287
                    WAIT FOR 20 ns;
288
                    PIReqVALID <= '0';
289
                    PIReqCNTL <= "11111111";
290
                    PIReqDataBE <= "0000";
291
                    -- ------------------------------------- Block Write. Start Address 0x80000002
292
                    -- -------------  Current Time:  1115ns  Number of Transfers 4
293
                    WAIT FOR 40 ns;
294
                    PIReqVALID <= '1';
295
                    PIReqDATA <= "00000000000000000000000011110000";
296
                    PIReqDataBE <= "1111";
297
                    -- -------------------------------------
298
                    -- -------------  Current Time:  1135ns
299
                    WAIT FOR 20 ns;
300
                    PIReqVALID <= '0';
301
                    PIReqDataBE <= "0000";
302
                    -- -------------------------------------
303
                    -- -------------  Current Time:  1175ns
304
                    WAIT FOR 40 ns;
305
                    PIReqVALID <= '1';
306
                    PIReqDATA <= "00000000000000000000111100000000";
307
                    PIReqDataBE <= "1111";
308
                    -- -------------------------------------
309
                    -- -------------  Current Time:  1195ns
310
                    WAIT FOR 20 ns;
311
                    PIReqVALID <= '0';
312
                    PIReqDataBE <= "0000";
313
                    -- -------------------------------------
314
                    -- -------------  Current Time:  1235ns
315
                    WAIT FOR 40 ns;
316
                    PIReqVALID <= '1';
317
                    PIReqDATA <= "00000000000000001111000000000000";
318
                    PIReqDataBE <= "1111";
319
                    -- ------------------------------------- End of Block Write
320
                    -- -------------  Current Time:  1255ns
321
                    WAIT FOR 20 ns;
322
                    PIReqVALID <= '0';
323
                    PIReqDataBE <= "0000";
324
                    -- ------------------------------------- Block Read. Start Address 0x80000002
325
                    -- -------------  Current Time:  1335ns  Number of Transfers 4
326
                    WAIT FOR 80 ns;
327
                    PIReqVALID <= '1';
328
                    PIReqCNTL <= "00010011";
329
                    PIReqDATA <= "10000000000000000000000000001111";
330
                    PIReqDataBE <= "1111";
331
                    -- -------------------------------------
332
                    -- -------------  Current Time:  1355ns
333
                    WAIT FOR 20 ns;
334
                    PIReqVALID <= '0';
335
                    PIReqCNTL <= "11111111";
336
                    PIReqDataBE <= "0000";
337
                    -- -------------------------------------
338
                    -- -------------  Current Time:  1395ns
339
                    WAIT FOR 40 ns;
340
                    PIReqDataBE <= "1111";
341
                    -- -------------------------------------
342
                    -- -------------  Current Time:  1415ns
343
                    WAIT FOR 20 ns;
344
                    PIReqDataBE <= "0000";
345
                    -- -------------------------------------
346
                    -- -------------  Current Time:  1455ns
347
                    WAIT FOR 40 ns;
348
                    PIReqDataBE <= "1111";
349
                    -- -------------------------------------
350
                    -- -------------  Current Time:  1475ns
351
                    WAIT FOR 20 ns;
352
                    PIReqDataBE <= "0000";
353
                    -- -------------------------------------
354
                    -- -------------  Current Time:  1515ns
355
                    WAIT FOR 40 ns;
356
                    PIReqDataBE <= "1111";
357
                    -- ------------------------------------- End of Block Read
358
                    -- -------------  Current Time:  1535ns
359
                    WAIT FOR 20 ns;
360
                    PIReqDataBE <= "0000";
361
                    -- ------------------------------------- End of Testbench
362
                    WAIT FOR 505 ns;
363
 
364
                END PROCESS;
365
 
366
        END testbench_arch;
367
 

powered by: WebSVN 2.1.0

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