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

Subversion Repositories udp_ip_stack

[/] [udp_ip_stack/] [trunk/] [bench/] [vhdl/] [arp_tb.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 pjf
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   12:35:50 05/31/2011
6
-- Design Name:   
7
-- Module Name:   C:/Users/pjf/Documents/projects/fpga/xilinx/Network/arp1/arp_tb.vhd
8
-- Project Name:  arp1
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: arp
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19 8 pjf
-- Revision 0.02 - Added tests for ARP timeout
20 2 pjf
-- Additional Comments:
21
--
22
-- Notes: 
23
-- This testbench has been automatically generated using types std_logic and
24
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
25
-- that these types always be used for the top-level I/O of a design in order
26
-- to guarantee that the testbench will bind correctly to the post-implementation 
27
-- simulation model.
28
--------------------------------------------------------------------------------
29
LIBRARY ieee;
30
USE ieee.std_logic_1164.ALL;
31
USE ieee.numeric_std.ALL;
32
use work.arp_types.all;
33
 
34
ENTITY arp_tb IS
35
END arp_tb;
36
 
37
ARCHITECTURE behavior OF arp_tb IS
38
 
39
    -- Component Declaration for the Unit Under Test (UUT)
40
 
41
    COMPONENT arp
42 8 pjf
         generic (
43
                        CLOCK_FREQ                      : integer := 125000000;                                                 -- freq of data_in_clk -- needed to timout cntr
44
                        ARP_TIMEOUT                     : integer := 60                                                                 -- ARP response timeout (s)
45
                        );
46
    Port (
47 2 pjf
                        -- lookup request signals
48
                        arp_req_req                     : in arp_req_req_type;
49
                        arp_req_rslt            : out arp_req_rslt_type;
50
                        -- MAC layer RX signals
51
                        data_in_clk             : in  STD_LOGIC;
52
                        reset                           : in  STD_LOGIC;
53
                        data_in                                 : in  STD_LOGIC_VECTOR (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
54
                        data_in_valid           : in  STD_LOGIC;                                                                        -- indicates data_in valid on clock
55
                        data_in_last            : in  STD_LOGIC;                                                                        -- indicates last data in frame
56
                        -- MAC layer TX signals
57
                        mac_tx_req                      : out std_logic;                                                                        -- indicates that ip wants access to channel (stays up for as long as tx)
58
                        mac_tx_granted          : in std_logic;                                                                 -- indicates that access to channel has been granted            
59
                        data_out_clk            : in std_logic;
60
                        data_out_ready          : in std_logic;                                                                 -- indicates system ready to consume data
61
                        data_out_valid          : out std_logic;                                                                        -- indicates data out is valid
62 4 pjf
                        data_out_first          : out std_logic;                                                                        -- with data out valid indicates the first byte of a frame
63 2 pjf
                        data_out_last           : out std_logic;                                                                        -- with data out valid indicates the last byte of a frame
64
                        data_out                                : out std_logic_vector (7 downto 0);             -- ethernet frame (from dst mac addr through to last byte of frame)
65
                        -- system signals
66
                        our_mac_address         : in STD_LOGIC_VECTOR (47 downto 0);
67 8 pjf
                        our_ip_address  : in STD_LOGIC_VECTOR (31 downto 0);
68
                        control                         : in arp_control_type;
69 2 pjf
                        req_count                       : out STD_LOGIC_VECTOR(7 downto 0)                       -- count of arp pkts received
70 8 pjf
                        );
71 2 pjf
    END COMPONENT;
72
 
73
 
74
   --Inputs
75
   signal clk                                   : std_logic := '0';
76
   signal reset                                 : std_logic := '0';
77
   signal data_in                       : std_logic_vector(7 downto 0) := (others => '0');
78
   signal data_in_valid         : std_logic := '0';
79
   signal data_in_last          : std_logic := '0';
80
   signal our_mac_address       : std_logic_vector(47 downto 0) := (others => '0');
81
   signal our_ip_address        : std_logic_vector(31 downto 0) := (others => '0');
82
        signal data_out_ready   : std_logic;
83
        signal data_out_valid   : std_logic;
84 4 pjf
        signal data_out_first   : std_logic;
85 2 pjf
        signal data_out_last            : std_logic;
86
        signal data_out                 : std_logic_vector (7 downto 0);
87
        signal req_count                        : STD_LOGIC_VECTOR(7 downto 0);
88
        signal arp_req_req              : arp_req_req_type;
89
        signal arp_req_rslt             : arp_req_rslt_type;
90
        signal mac_tx_req                       : std_logic;
91
        signal mac_tx_granted   : std_logic;
92 8 pjf
        signal control                          : arp_control_type;
93 2 pjf
 
94
 
95
   -- Clock period definitions
96
   constant clk_period : time := 8 ns;
97
 
98
BEGIN
99
 
100
        -- Instantiate the Unit Under Test (UUT)
101 8 pjf
   uut: arp generic map (
102
                         CLOCK_FREQ                     => 10,                                          -- artificially low count to enable pragmatic testing
103
                         ARP_TIMEOUT            => 20
104
                         )
105
                         PORT MAP (
106 2 pjf
                        -- lookup request mappings
107
                         arp_req_req            => arp_req_req,
108
                         arp_req_rslt           => arp_req_rslt,
109
                        -- rx mappings
110
          data_in_clk           => clk,
111
          reset                                 => reset,
112
          data_in                       => data_in,
113
          data_in_valid         => data_in_valid,
114
          data_in_last          => data_in_last,
115
                         -- tx mappings
116
                         mac_tx_req                     => mac_tx_req,
117
                         mac_tx_granted => mac_tx_granted,
118
                         data_out_clk           => clk,
119
                         data_out_ready         => data_out_ready,
120 4 pjf
                         data_out_valid         => data_out_valid,
121
                         data_out_first => data_out_first,
122 2 pjf
                         data_out_last          => data_out_last,
123
                         data_out                       => data_out,
124
                         -- system mappings
125
          our_mac_address       => our_mac_address,
126 8 pjf
          our_ip_address        => our_ip_address,
127
                         control                                => control,
128 2 pjf
                         req_count                      => req_count
129
        );
130
 
131
   -- Clock process definitions
132
   clk_process :process
133
   begin
134
                clk <= '0';
135
                wait for clk_period/2;
136
                clk <= '1';
137
                wait for clk_period/2;
138
   end process;
139
 
140
 
141
   -- Stimulus process
142
   stim_proc: process
143
   begin
144
      -- hold reset state for 100 ns.
145
      wait for 100 ns;
146
 
147
                our_ip_address <= x"c0a80509";          -- 192.168.5.9
148
                our_mac_address <= x"002320212223";
149
                mac_tx_granted <= '1'; -- FIXME 0
150 8 pjf
                control.clear_cache <= '0';
151 2 pjf
 
152
                reset <= '1';
153
      wait for clk_period*10;
154
                reset <= '0';
155
      wait for clk_period*5;
156
 
157
                assert mac_tx_req = '0'                                  report "mac_tx_req asserted on reset";
158
 
159
      -- insert stimulus here
160
                arp_req_req.lookup_req <= '0';
161
                arp_req_req.ip <= (others => '0');
162
                data_out_ready <= '1';
163
 
164 8 pjf
                report "T1:  Send an ARP request: who has 192.168.5.9? Tell 192.168.5.1";
165 2 pjf
                data_in_valid <= '1';
166
                -- dst MAC (bc)
167
                data_in <= x"ff"; wait for clk_period;
168
                data_in <= x"ff"; wait for clk_period;
169
                data_in <= x"ff"; wait for clk_period;
170
                data_in <= x"ff"; wait for clk_period;
171
                data_in <= x"ff"; wait for clk_period;
172
                data_in <= x"ff"; wait for clk_period;
173
                -- src MAC
174
                data_in <= x"00"; wait for clk_period;
175
                data_in <= x"23"; wait for clk_period;
176
                data_in <= x"18"; wait for clk_period;
177
                data_in <= x"29"; wait for clk_period;
178
                data_in <= x"26"; wait for clk_period;
179
                data_in <= x"7c"; wait for clk_period;
180
                -- type
181
                data_in <= x"08"; wait for clk_period;
182
                data_in <= x"06"; wait for clk_period;
183
                -- HW type
184
                data_in <= x"00"; wait for clk_period;
185
                data_in <= x"01"; wait for clk_period;
186
                -- Protocol type
187
                data_in <= x"08"; wait for clk_period;
188
                data_in <= x"00"; wait for clk_period;
189
                -- HW size
190
                data_in <= x"06"; wait for clk_period;
191
                -- protocol size
192
                data_in <= x"04"; wait for clk_period;
193
                -- Opcode
194
                data_in <= x"00"; wait for clk_period;
195
                data_in <= x"01"; wait for clk_period;
196
                -- Sender MAC
197
                data_in <= x"00"; wait for clk_period;
198
                data_in <= x"23"; wait for clk_period;
199
                data_in <= x"18"; wait for clk_period;
200
                data_in <= x"29"; wait for clk_period;
201
                data_in <= x"26"; wait for clk_period;
202
                data_in <= x"7c"; wait for clk_period;
203
                -- Sender IP
204
                data_in <= x"c0"; wait for clk_period;
205
                data_in <= x"a8"; wait for clk_period;
206
                data_in <= x"05"; wait for clk_period;
207
                data_in <= x"01"; wait for clk_period;
208
                -- Target MAC
209
                data_in <= x"00"; wait for clk_period;
210
                data_in <= x"00"; wait for clk_period;
211
                data_in <= x"00"; wait for clk_period;
212
                data_in <= x"00"; wait for clk_period;
213
                data_in <= x"00"; wait for clk_period;
214
                data_in <= x"00"; wait for clk_period;
215
                -- Target IP
216
                data_in <= x"c0"; wait for clk_period;
217
                data_in <= x"a8"; wait for clk_period;
218
                data_in <= x"05"; wait for clk_period;
219
                data_in <= x"09"; wait for clk_period;
220
                data_in <= x"00"; wait for clk_period;
221
                data_in <= x"00"; wait for clk_period;
222
                data_in <= x"00"; wait for clk_period;
223
                data_in_last <= '1';
224
                data_in <= x"00"; wait for clk_period;
225
                data_in_last <= '0';
226
                data_in_valid <= '0';
227
 
228
                -- check tx arbitration signals
229
 
230
                assert mac_tx_req = '1'                                 report "T1: mac_tx_req not set";
231
 
232
                -- ready to tx
233
                data_out_ready <= '1';
234
                mac_tx_granted <= '1';
235
                wait for clk_period*10;
236
                data_out_ready <= '0';
237
                wait for clk_period*2;
238
                data_out_ready <= '1';
239
                wait for clk_period*50;
240
 
241 8 pjf
                report "T2: Send another ARP request: who has 192.168.5.9? Tell 192.168.5.1, holding off transmitter";
242 2 pjf
                data_out_ready <= '0';
243
                data_in_valid <= '1';
244
                -- dst MAC (bc)
245
                data_in <= x"ff"; wait for clk_period;
246
                data_in <= x"ff"; wait for clk_period;
247
                data_in <= x"ff"; wait for clk_period;
248
                data_in <= x"ff"; wait for clk_period;
249
                data_in <= x"ff"; wait for clk_period;
250
                data_in <= x"ff"; wait for clk_period;
251
                -- src MAC
252
                data_in <= x"00"; wait for clk_period;
253
                data_in <= x"23"; wait for clk_period;
254
                data_in <= x"18"; wait for clk_period;
255
                data_in <= x"29"; wait for clk_period;
256
                data_in <= x"26"; wait for clk_period;
257
                data_in <= x"7c"; wait for clk_period;
258
                -- type
259
                data_in <= x"08"; wait for clk_period;
260
                data_in <= x"06"; wait for clk_period;
261
                -- HW type
262
                data_in <= x"00"; wait for clk_period;
263
                data_in <= x"01"; wait for clk_period;
264
                -- Protocol type
265
                data_in <= x"08"; wait for clk_period;
266
                data_in <= x"00"; wait for clk_period;
267
                -- HW size
268
                data_in <= x"06"; wait for clk_period;
269
                -- protocol size
270
                data_in <= x"04"; wait for clk_period;
271
                -- Opcode
272
                data_in <= x"00"; wait for clk_period;
273
                data_in <= x"01"; wait for clk_period;
274
                -- Sender MAC
275
                data_in <= x"00"; wait for clk_period;
276
                data_in <= x"23"; wait for clk_period;
277
                data_in <= x"18"; wait for clk_period;
278
                data_in <= x"29"; wait for clk_period;
279
                data_in <= x"26"; wait for clk_period;
280
                data_in <= x"7c"; wait for clk_period;
281
                -- Sender IP
282
                data_in <= x"c0"; wait for clk_period;
283
                data_in <= x"a8"; wait for clk_period;
284
                data_in <= x"05"; wait for clk_period;
285
                data_in <= x"01"; wait for clk_period;
286
                -- Target MAC
287
                data_in <= x"00"; wait for clk_period;
288
                data_in <= x"00"; wait for clk_period;
289
                data_in <= x"00"; wait for clk_period;
290
                data_in <= x"00"; wait for clk_period;
291
                data_in <= x"00"; wait for clk_period;
292
                data_in <= x"00"; wait for clk_period;
293
                -- Target IP
294
                data_in <= x"c0"; wait for clk_period;
295
                data_in <= x"a8"; wait for clk_period;
296
                data_in <= x"05"; wait for clk_period;
297
                data_in <= x"09"; wait for clk_period;
298
                data_in <= x"00"; wait for clk_period;
299
                data_in <= x"00"; wait for clk_period;
300
                data_in <= x"00"; wait for clk_period;
301
                data_in_last <= '1';
302
                data_in <= x"00"; wait for clk_period;
303
                data_in_last <= '0';
304
                data_in_valid <= '0';
305
 
306
                -- ready to tx
307
                wait for clk_period*10;
308
                data_out_ready <= '1';
309
 
310
                wait for clk_period*50;
311 8 pjf
 
312
                report "T3 Send a request for the IP that is already cached";
313 2 pjf
                arp_req_req.ip <= x"c0a80501";
314
                arp_req_req.lookup_req <= '1';
315
                wait for clk_period;
316 8 pjf
                assert arp_req_rslt.got_mac = '1'                               report "T3: should have got mac";
317
                assert arp_req_rslt.mac = x"00231829267c"               report "T3: incorrect mac";
318
                assert arp_req_rslt.got_err = '0'                                report "T3: should not have got err";
319 2 pjf
                arp_req_req.lookup_req <= '0';
320 8 pjf
                wait for clk_period;
321
                wait for clk_period*10;
322
 
323
                wait for clk_period*20;
324
                assert mac_tx_req = '0'                                          report "T3: should not be requesting TX channel";
325
 
326
                report "T4: Request 192.168.5.3 (not cached= and Send an ARP reply: 192.168.5.3 has mac 02:12:03:23:04:54";
327 2 pjf
                arp_req_req.ip <= x"c0a80503";
328
                arp_req_req.lookup_req <= '1';
329
                wait for clk_period;
330
                arp_req_req.lookup_req <= '0';
331 8 pjf
                wait for clk_period*20;
332
                assert mac_tx_req = '1'                                         report "T4: should be requesting TX channel";
333
                wait for clk_period*50;
334 2 pjf
                -- Send the reply
335
                data_out_ready <= '1';
336
 
337
                data_in_valid <= '1';
338
                -- dst MAC (bc)
339
                data_in <= x"ff"; wait for clk_period;
340
                data_in <= x"ff"; wait for clk_period;
341
                data_in <= x"ff"; wait for clk_period;
342
                data_in <= x"ff"; wait for clk_period;
343
                data_in <= x"ff"; wait for clk_period;
344
                data_in <= x"ff"; wait for clk_period;
345
                -- src MAC
346
                data_in <= x"02"; wait for clk_period;
347
                data_in <= x"12"; wait for clk_period;
348
                data_in <= x"03"; wait for clk_period;
349
                data_in <= x"23"; wait for clk_period;
350
                data_in <= x"04"; wait for clk_period;
351
                data_in <= x"54"; wait for clk_period;
352
                -- type
353
                data_in <= x"08"; wait for clk_period;
354
                data_in <= x"06"; wait for clk_period;
355
                -- HW type
356
                data_in <= x"00"; wait for clk_period;
357
                data_in <= x"01"; wait for clk_period;
358
                -- Protocol type
359
                data_in <= x"08"; wait for clk_period;
360
                data_in <= x"00"; wait for clk_period;
361
                -- HW size
362
                data_in <= x"06"; wait for clk_period;
363
                -- protocol size
364
                data_in <= x"04"; wait for clk_period;
365
                -- Opcode
366
                data_in <= x"00"; wait for clk_period;
367
                data_in <= x"02"; wait for clk_period;
368
                -- Sender MAC
369
                data_in <= x"02"; wait for clk_period;
370
                data_in <= x"12"; wait for clk_period;
371
                data_in <= x"03"; wait for clk_period;
372
                data_in <= x"23"; wait for clk_period;
373
                data_in <= x"04"; wait for clk_period;
374
                data_in <= x"54"; wait for clk_period;
375
                -- Sender IP
376
                data_in <= x"c0"; wait for clk_period;
377
                data_in <= x"a8"; wait for clk_period;
378
                data_in <= x"05"; wait for clk_period;
379
                data_in <= x"03"; wait for clk_period;
380
                -- Target MAC
381
                data_in <= x"00"; wait for clk_period;
382
                data_in <= x"23"; wait for clk_period;
383
                data_in <= x"20"; wait for clk_period;
384
                data_in <= x"21"; wait for clk_period;
385
                data_in <= x"22"; wait for clk_period;
386
                data_in <= x"23"; wait for clk_period;
387
                -- Target IP
388
                data_in <= x"c0"; wait for clk_period;
389
                data_in <= x"a8"; wait for clk_period;
390
                data_in <= x"05"; wait for clk_period;
391
                data_in <= x"09"; wait for clk_period;
392
                data_in <= x"00"; wait for clk_period;
393
                data_in <= x"00"; wait for clk_period;
394
                data_in <= x"00"; wait for clk_period;
395
                data_in_last <= '1';
396
                data_in <= x"00"; wait for clk_period;
397
                data_in_last <= '0';
398 8 pjf
                data_in_valid <= '0';
399
                wait for clk_period;
400
                assert arp_req_rslt.got_mac = '1'                               report "T4: should have got mac";
401
                assert arp_req_rslt.mac = x"021203230454"               report "T4: incorrect mac";
402
                assert arp_req_rslt.got_err = '0'                                report "T4: should not have got err";
403
                wait for clk_period*10;
404 2 pjf
 
405 8 pjf
                report "T5: Request 192.168.5.4 (not cached), dont send a reply and wait for timeout";
406
                arp_req_req.ip <= x"c0a80504";
407
                arp_req_req.lookup_req <= '1';
408
                wait for clk_period;
409
                arp_req_req.lookup_req <= '0';
410
                wait for clk_period*20;
411
                assert mac_tx_req = '1'                                         report "T5: should be requesting TX channel";
412
                wait for clk_period*200;
413
                assert arp_req_rslt.got_mac = '0'                report "T5: should not have got mac";
414
                assert arp_req_rslt.got_err = '1'               report "T5: should have got err";
415
 
416
                report "T6: Request 192.168.5.7 (not cached= and Send an ARP reply: 192.168.5.7 has mac 02:15:03:23:04:54";
417
                arp_req_req.ip <= x"c0a80507";
418
                arp_req_req.lookup_req <= '1';
419
                wait for clk_period;
420
                assert arp_req_rslt.got_mac = '0'                                report "T6: should not yet have mac";
421
                assert arp_req_rslt.got_err = '0'                                report "T6: should not have got err";
422
 
423
                arp_req_req.lookup_req <= '0';
424
                wait for clk_period*20;
425
                assert mac_tx_req = '1'                                         report "T6: should be requesting TX channel";
426
                wait for clk_period*50;
427
                -- Send the reply
428
                data_out_ready <= '1';
429
 
430
                data_in_valid <= '1';
431
                -- dst MAC (bc)
432
                data_in <= x"ff"; wait for clk_period;
433
                data_in <= x"ff"; wait for clk_period;
434
                data_in <= x"ff"; wait for clk_period;
435
                data_in <= x"ff"; wait for clk_period;
436
                data_in <= x"ff"; wait for clk_period;
437
                data_in <= x"ff"; wait for clk_period;
438
                -- src MAC
439
                data_in <= x"02"; wait for clk_period;
440
                data_in <= x"15"; wait for clk_period;
441
                data_in <= x"03"; wait for clk_period;
442
                data_in <= x"23"; wait for clk_period;
443
                data_in <= x"04"; wait for clk_period;
444
                data_in <= x"54"; wait for clk_period;
445
                -- type
446
                data_in <= x"08"; wait for clk_period;
447
                data_in <= x"06"; wait for clk_period;
448
                -- HW type
449
                data_in <= x"00"; wait for clk_period;
450
                data_in <= x"01"; wait for clk_period;
451
                -- Protocol type
452
                data_in <= x"08"; wait for clk_period;
453
                data_in <= x"00"; wait for clk_period;
454
                -- HW size
455
                data_in <= x"06"; wait for clk_period;
456
                -- protocol size
457
                data_in <= x"04"; wait for clk_period;
458
                -- Opcode
459
                data_in <= x"00"; wait for clk_period;
460
                data_in <= x"02"; wait for clk_period;
461
                -- Sender MAC
462
                data_in <= x"02"; wait for clk_period;
463
                data_in <= x"15"; wait for clk_period;
464
                data_in <= x"03"; wait for clk_period;
465
                data_in <= x"23"; wait for clk_period;
466
                data_in <= x"04"; wait for clk_period;
467
                data_in <= x"54"; wait for clk_period;
468
                -- Sender IP
469
                data_in <= x"c0"; wait for clk_period;
470
                data_in <= x"a8"; wait for clk_period;
471
                data_in <= x"05"; wait for clk_period;
472
                data_in <= x"07"; wait for clk_period;
473
                -- Target MAC
474
                data_in <= x"00"; wait for clk_period;
475
                data_in <= x"23"; wait for clk_period;
476
                data_in <= x"20"; wait for clk_period;
477
                data_in <= x"21"; wait for clk_period;
478
                data_in <= x"22"; wait for clk_period;
479
                data_in <= x"23"; wait for clk_period;
480
                -- Target IP
481
                data_in <= x"c0"; wait for clk_period;
482
                data_in <= x"a8"; wait for clk_period;
483
                data_in <= x"05"; wait for clk_period;
484
                data_in <= x"09"; wait for clk_period;
485
                data_in <= x"00"; wait for clk_period;
486
                data_in <= x"00"; wait for clk_period;
487
                data_in <= x"00"; wait for clk_period;
488
                data_in_last <= '1';
489
                data_in <= x"00"; wait for clk_period;
490
                data_in_last <= '0';
491
                data_in_valid <= '0';
492
                wait for clk_period;
493
                assert arp_req_rslt.got_mac = '1'                               report "T6: should have got mac";
494
                assert arp_req_rslt.mac = x"021503230454"               report "T6: incorrect mac";
495
                assert arp_req_rslt.got_err = '0'                                report "T6: should not have got err";
496
                wait for clk_period*10;
497
 
498
                report "T7: Request 192.168.5.7 again an expect it to be in the cache";
499
                arp_req_req.ip <= x"c0a80507";
500
                arp_req_req.lookup_req <= '1';
501
                wait for clk_period;
502
                assert arp_req_rslt.got_mac = '1'                               report "T7: should have mac";
503
                assert arp_req_rslt.got_err = '0'                                report "T7: should not have got err";
504
 
505
                arp_req_req.lookup_req <= '0';
506
                wait for clk_period*20;
507
 
508
                report "T8: Clear the cache, Request 192.168.5.7 again an expect a 'who has' to be sent";
509
                control.clear_cache <= '1';
510
                wait for clk_period;
511
                control.clear_cache <= '0';
512
                wait for clk_period;
513
 
514
                arp_req_req.ip <= x"c0a80507";
515
                arp_req_req.lookup_req <= '1';
516
                wait for clk_period;
517
                assert arp_req_rslt.got_mac = '0'                                report "T8: should not yet have mac";
518
                assert arp_req_rslt.got_err = '0'                                report "T8: should not have got err";
519
 
520
                arp_req_req.lookup_req <= '0';
521
                wait for clk_period*20;
522
 
523
 
524
                assert mac_tx_req = '1'                                                         report "T8: should be requesting TX channel";
525
                wait for clk_period*50;
526
                -- Send the reply
527
                data_out_ready <= '1';
528
 
529
                data_in_valid <= '1';
530
                -- dst MAC (bc)
531
                data_in <= x"ff"; wait for clk_period;
532
                data_in <= x"ff"; wait for clk_period;
533
                data_in <= x"ff"; wait for clk_period;
534
                data_in <= x"ff"; wait for clk_period;
535
                data_in <= x"ff"; wait for clk_period;
536
                data_in <= x"ff"; wait for clk_period;
537
                -- src MAC
538
                data_in <= x"02"; wait for clk_period;
539
                data_in <= x"15"; wait for clk_period;
540
                data_in <= x"03"; wait for clk_period;
541
                data_in <= x"23"; wait for clk_period;
542
                data_in <= x"04"; wait for clk_period;
543
                data_in <= x"54"; wait for clk_period;
544
                -- type
545
                data_in <= x"08"; wait for clk_period;
546
                data_in <= x"06"; wait for clk_period;
547
                -- HW type
548
                data_in <= x"00"; wait for clk_period;
549
                data_in <= x"01"; wait for clk_period;
550
                -- Protocol type
551
                data_in <= x"08"; wait for clk_period;
552
                data_in <= x"00"; wait for clk_period;
553
                -- HW size
554
                data_in <= x"06"; wait for clk_period;
555
                -- protocol size
556
                data_in <= x"04"; wait for clk_period;
557
                -- Opcode
558
                data_in <= x"00"; wait for clk_period;
559
                data_in <= x"02"; wait for clk_period;
560
                -- Sender MAC
561
                data_in <= x"02"; wait for clk_period;
562
                data_in <= x"15"; wait for clk_period;
563
                data_in <= x"03"; wait for clk_period;
564
                data_in <= x"23"; wait for clk_period;
565
                data_in <= x"55"; wait for clk_period;
566
                data_in <= x"54"; wait for clk_period;
567
                -- Sender IP
568
                data_in <= x"c0"; wait for clk_period;
569
                data_in <= x"a8"; wait for clk_period;
570
                data_in <= x"05"; wait for clk_period;
571
                data_in <= x"07"; wait for clk_period;
572
                -- Target MAC
573
                data_in <= x"00"; wait for clk_period;
574
                data_in <= x"23"; wait for clk_period;
575
                data_in <= x"20"; wait for clk_period;
576
                data_in <= x"21"; wait for clk_period;
577
                data_in <= x"22"; wait for clk_period;
578
                data_in <= x"23"; wait for clk_period;
579
                -- Target IP
580
                data_in <= x"c0"; wait for clk_period;
581
                data_in <= x"a8"; wait for clk_period;
582
                data_in <= x"05"; wait for clk_period;
583
                data_in <= x"09"; wait for clk_period;
584
                data_in <= x"00"; wait for clk_period;
585
                data_in <= x"00"; wait for clk_period;
586
                data_in <= x"00"; wait for clk_period;
587
                data_in_last <= '1';
588
                data_in <= x"00"; wait for clk_period;
589
                data_in_last <= '0';
590
                data_in_valid <= '0';
591
                wait for clk_period;
592
                assert arp_req_rslt.got_mac = '1'                               report "T8: should have got mac";
593
                assert arp_req_rslt.mac = x"021503235554"               report "T8: incorrect mac";
594
                assert arp_req_rslt.got_err = '0'                                report "T8: should not have got err";
595
                wait for clk_period*10;
596
 
597 2 pjf
                report "--- end of tests ---";
598
      wait;
599
   end process;
600
 
601
END;

powered by: WebSVN 2.1.0

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