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

Subversion Repositories can

[/] [can/] [tags/] [rel_9/] [bench/] [verilog/] [can_testbench.v] - Blame information for rev 16

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

Line No. Rev Author Line
1 2 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  can_testbench.v                                             ////
4
////                                                              ////
5
////                                                              ////
6 9 mohor
////  This file is part of the CAN Protocol Controller            ////
7 2 mohor
////  http://www.opencores.org/projects/can/                      ////
8
////                                                              ////
9
////                                                              ////
10
////  Author(s):                                                  ////
11
////       Igor Mohor                                             ////
12
////       igorm@opencores.org                                    ////
13
////                                                              ////
14
////                                                              ////
15 9 mohor
////  All additional information is available in the README.txt   ////
16 2 mohor
////  file.                                                       ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20 9 mohor
//// Copyright (C) 2002, 2003 Authors                             ////
21 2 mohor
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48 16 mohor
// Revision 1.10  2003/01/10 17:51:28  mohor
49
// Temporary version (backup).
50
//
51 15 mohor
// Revision 1.9  2003/01/09 21:54:39  mohor
52
// rx fifo added. Not 100 % verified, yet.
53
//
54 14 mohor
// Revision 1.8  2003/01/08 02:09:43  mohor
55
// Acceptance filter added.
56
//
57 11 mohor
// Revision 1.7  2002/12/28 04:13:53  mohor
58
// Backup version.
59
//
60 10 mohor
// Revision 1.6  2002/12/27 00:12:48  mohor
61
// Header changed, testbench improved to send a frame (crc still missing).
62
//
63 9 mohor
// Revision 1.5  2002/12/26 16:00:29  mohor
64
// Testbench define file added. Clock divider register added.
65
//
66 8 mohor
// Revision 1.4  2002/12/26 01:33:01  mohor
67
// Tripple sampling supported.
68
//
69 7 mohor
// Revision 1.3  2002/12/25 23:44:12  mohor
70
// Commented lines removed.
71
//
72 6 mohor
// Revision 1.2  2002/12/25 14:16:54  mohor
73
// Synchronization working.
74
//
75 5 mohor
// Revision 1.1.1.1  2002/12/20 16:39:21  mohor
76
// Initial
77 2 mohor
//
78
//
79 5 mohor
//
80 2 mohor
 
81
// synopsys translate_off
82
`include "timescale.v"
83
// synopsys translate_on
84
`include "can_defines.v"
85 8 mohor
`include "can_testbench_defines.v"
86 2 mohor
 
87
module can_testbench();
88
 
89
 
90
 
91
parameter Tp = 1;
92 8 mohor
parameter BRP = 2*(`CAN_TIMING0_BRP + 1);
93 2 mohor
 
94
 
95
 
96
reg         clk;
97
reg         rst;
98
reg   [7:0] data_in;
99
wire  [7:0] data_out;
100
reg         cs, rw;
101
reg   [7:0] addr;
102
reg         rx;
103
integer     start_tb;
104 14 mohor
reg   [7:0] tmp_data;
105 2 mohor
 
106 11 mohor
// Instantiate can_top module
107 2 mohor
can_top i_can_top
108
(
109
  .clk(clk),
110
  .rst(rst),
111
  .data_in(data_in),
112
  .data_out(data_out),
113
  .cs(cs),
114
  .rw(rw),
115
  .addr(addr),
116 10 mohor
  .rx(rx)
117 2 mohor
);
118
 
119
 
120
// Generate clock signal 24 MHz
121
initial
122
begin
123
  clk=0;
124
  forever #20 clk = ~clk;
125
end
126
 
127
initial
128
begin
129
  start_tb = 0;
130
  data_in = 'hz;
131
  cs = 0;
132
  rw = 'hz;
133
  addr = 'hz;
134
  rx = 1;
135
  rst = 1;
136
  #200 rst = 0;
137 16 mohor
  #200 initialize_fifo;
138 2 mohor
  #200 start_tb = 1;
139
end
140
 
141
 
142
// Main testbench
143
initial
144
begin
145
  wait(start_tb);
146
 
147 11 mohor
  // Set bus timing register 0
148 8 mohor
  write_register(8'h6, {`CAN_TIMING0_SJW, `CAN_TIMING0_BRP});
149
 
150 11 mohor
  // Set bus timing register 1
151 8 mohor
  write_register(8'h7, {`CAN_TIMING1_SAM, `CAN_TIMING1_TSEG2, `CAN_TIMING1_TSEG1});
152 11 mohor
 
153 14 mohor
 
154
 
155 11 mohor
  // Set Clock Divider register
156
  write_register(8'h31, {`CAN_CLOCK_DIVIDER_MODE, 7'h0});    // Setting the normal mode (not extended)
157 16 mohor
 
158 11 mohor
  // Set Acceptance Code and Acceptance Mask registers (their address differs for basic and extended mode
159
  if(`CAN_CLOCK_DIVIDER_MODE)   // Extended mode
160
    begin
161
      // Set Acceptance Code and Acceptance Mask registers
162
      write_register(8'h16, 8'ha6); // acceptance code 0
163
      write_register(8'h17, 8'hb0); // acceptance code 1
164
      write_register(8'h18, 8'h12); // acceptance code 2
165
      write_register(8'h19, 8'h34); // acceptance code 3
166
      write_register(8'h20, 8'h0); // acceptance mask 0
167
      write_register(8'h21, 8'h0); // acceptance mask 1
168
      write_register(8'h22, 8'h0); // acceptance mask 2
169
      write_register(8'h23, 8'h0); // acceptance mask 3
170
    end
171
  else
172
    begin
173
      // Set Acceptance Code and Acceptance Mask registers
174 16 mohor
//      write_register(8'h4, 8'ha6); // acceptance code
175
      write_register(8'h4, 8'h08); // acceptance code
176 11 mohor
      write_register(8'h5, 8'h00); // acceptance mask
177
    end
178 2 mohor
 
179
  #10;
180
  repeat (1000) @ (posedge clk);
181
 
182 11 mohor
  // Switch-off reset mode
183 10 mohor
  write_register(8'h0, {7'h0, ~(`CAN_MODE_RESET)});
184
 
185
  repeat (BRP) @ (posedge clk);   // At least BRP clocks needed before bus goes to dominant level. Otherwise 1 quant difference is possible
186
                                  // This difference is resynchronized later.
187 11 mohor
  repeat (7) send_bit(1);         // Sending EOF
188 10 mohor
 
189 9 mohor
//  test_synchronization;
190 10 mohor
 
191
 
192
 
193 11 mohor
  if(`CAN_CLOCK_DIVIDER_MODE)   // Extended mode
194
    begin
195 15 mohor
//      send_frame(0, 1, {26'h00000a6, 3'h5}, 2, 15'h2a11); // mode, rtr, id, length, crc
196 11 mohor
//      send_frame(0, 1, 29'h12567635, 2, 15'h75b4); // mode, rtr, id, length, crc
197 15 mohor
      send_frame(0, 1, {26'h00000a6, 3'h5}, 4'h2, 15'h2a11); // mode, rtr, id, length, crc
198 11 mohor
    end
199
  else
200
    begin
201 16 mohor
//      test_empty_fifo;    test currently switched off
202
      test_full_fifo;
203
    end
204 15 mohor
 
205
 
206
 
207 16 mohor
  $display("CAN Testbench finished !");
208
  $stop;
209
end
210 5 mohor
 
211 14 mohor
 
212
 
213
 
214 16 mohor
task test_empty_fifo;
215
  begin
216
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h3, 15'h6231); // mode, rtr, id, length, crc
217
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h7, 15'h6047); // mode, rtr, id, length, crc
218 15 mohor
 
219 16 mohor
    read_receive_buffer;
220
    fifo_info;
221 15 mohor
 
222 16 mohor
    release_rx_buffer;
223
    $display("\n\n");
224
    read_receive_buffer;
225
    fifo_info;
226 15 mohor
 
227 16 mohor
    release_rx_buffer;
228
    $display("\n\n");
229
    read_receive_buffer;
230
    fifo_info;
231 15 mohor
 
232 16 mohor
    release_rx_buffer;
233
    $display("\n\n");
234
    read_receive_buffer;
235
    fifo_info;
236 15 mohor
 
237 16 mohor
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
238 15 mohor
 
239 16 mohor
    $display("\n\n");
240
    read_receive_buffer;
241
    fifo_info;
242 2 mohor
 
243 16 mohor
    release_rx_buffer;
244
    $display("\n\n");
245
    read_receive_buffer;
246
    fifo_info;
247 2 mohor
 
248 16 mohor
    release_rx_buffer;
249
    $display("\n\n");
250
    read_receive_buffer;
251
    fifo_info;
252
  end
253
endtask
254 2 mohor
 
255
 
256 16 mohor
 
257
task test_full_fifo;
258
  begin
259
    release_rx_buffer;
260
    $display("\n\n");
261
    read_receive_buffer;
262
    fifo_info;
263
 
264
    read_overrun_info(0, 31);
265
 
266
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h0, 15'h3d18); // mode, rtr, id, length, crc
267
    read_receive_buffer;
268
    fifo_info;
269
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h1, 15'h00ca); // mode, rtr, id, length, crc
270
    read_receive_buffer;
271
    fifo_info;
272
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h2, 15'h744a); // mode, rtr, id, length, crc
273
    fifo_info;
274
    read_receive_buffer;
275
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h3, 15'h6231); // mode, rtr, id, length, crc
276
    fifo_info;
277
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h4, 15'h3051); // mode, rtr, id, length, crc
278
    fifo_info;
279
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h5, 15'h52ef); // mode, rtr, id, length, crc
280
    fifo_info;
281
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h6, 15'h2c03); // mode, rtr, id, length, crc
282
    fifo_info;
283
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h7, 15'h6047); // mode, rtr, id, length, crc
284
    fifo_info;
285
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
286
    fifo_info;
287
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
288
    fifo_info;
289
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
290
    fifo_info;
291
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
292
    fifo_info;
293
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
294
    fifo_info;
295
    read_overrun_info(0, 15);
296
 
297
    release_rx_buffer;
298
    release_rx_buffer;
299
    release_rx_buffer;
300
    read_receive_buffer;
301
    fifo_info;
302
    send_frame(0, 1, {26'h0000008, 3'h1}, 4'h8, 15'h30e1); // mode, rtr, id, length, crc
303
    fifo_info;
304
    read_overrun_info(0, 15);
305
    $display("\n\n");
306
 
307
    release_rx_buffer;
308
    read_receive_buffer;
309
    fifo_info;
310
 
311
    release_rx_buffer;
312
    read_receive_buffer;
313
    fifo_info;
314
 
315
    release_rx_buffer;
316
    read_receive_buffer;
317
    fifo_info;
318
 
319
    release_rx_buffer;
320
    read_receive_buffer;
321
    fifo_info;
322
 
323
    release_rx_buffer;
324
    read_receive_buffer;
325
    fifo_info;
326
 
327
    release_rx_buffer;
328
    read_receive_buffer;
329
    fifo_info;
330
 
331
    release_rx_buffer;
332
    read_receive_buffer;
333
    fifo_info;
334
 
335
    release_rx_buffer;
336
    read_receive_buffer;
337
    fifo_info;
338
 
339
    release_rx_buffer;
340
    read_receive_buffer;
341
    fifo_info;
342
 
343
    release_rx_buffer;
344
    read_receive_buffer;
345
    fifo_info;
346
 
347
    release_rx_buffer;
348
    read_receive_buffer;
349
    fifo_info;
350
 
351
    release_rx_buffer;
352
    read_receive_buffer;
353
    fifo_info;
354
 
355
    release_rx_buffer;
356
    read_receive_buffer;
357
    fifo_info;
358
 
359
 
360
  end
361
endtask
362
 
363
 
364
 
365
task initialize_fifo;
366
  integer i;
367
  begin
368
    for (i=0; i<32; i=i+1)
369
      begin
370
        can_testbench.i_can_top.i_can_bsp.i_can_fifo.length_info[i] = 0;
371
        can_testbench.i_can_top.i_can_bsp.i_can_fifo.overrun_info[i] = 0;
372
      end
373
 
374
    for (i=0; i<64; i=i+1)
375
      begin
376
        can_testbench.i_can_top.i_can_bsp.i_can_fifo.fifo[i] = 0;
377
      end
378
 
379
    $display("(%0t) Fifo initialized", $time);
380
  end
381
endtask
382
 
383
 
384
task read_overrun_info;
385
  input [4:0] start_addr;
386
  input [4:0] end_addr;
387
  integer i;
388
  begin
389
    for (i=start_addr; i<=end_addr; i=i+1)
390
      begin
391
        $display("len[0x%0x]=0x%0x", i, can_testbench.i_can_top.i_can_bsp.i_can_fifo.length_info[i]);
392
        $display("overrun[0x%0x]=0x%0x\n", i, can_testbench.i_can_top.i_can_bsp.i_can_fifo.overrun_info[i]);
393
      end
394
  end
395
endtask
396
 
397
 
398
task fifo_info;   // displaying how many packets and how many bytes are in fifo
399
  begin
400
    $display("(%0t) Currently %0d bytes in fifo (%0d packets)", $time, can_testbench.i_can_top.i_can_bsp.i_can_fifo.fifo_cnt,
401
    (can_testbench.i_can_top.i_can_bsp.i_can_fifo.wr_info_pointer - can_testbench.i_can_top.i_can_bsp.i_can_fifo.rd_info_pointer));
402
end
403
endtask
404
 
405
 
406 14 mohor
task read_register;
407
  input [7:0] reg_addr;
408
 
409
  begin
410
    @ (posedge clk);
411
    #1;
412
    addr = reg_addr;
413
    cs = 1;
414
    rw = 1;
415
    @ (posedge clk);
416
    $display("(%0t) Reading register [0x%0x] = 0x%0x", $time, addr, data_out);
417
    #1;
418
    addr = 'hz;
419
    cs = 0;
420
    rw = 'hz;
421
  end
422
endtask
423
 
424
 
425 2 mohor
task write_register;
426
  input [7:0] reg_addr;
427
  input [7:0] reg_data;
428
 
429
  begin
430
    @ (posedge clk);
431
    #1;
432
    addr = reg_addr;
433
    data_in = reg_data;
434
    cs = 1;
435
    rw = 0;
436
    @ (posedge clk);
437
    #1;
438
    addr = 'hz;
439
    data_in = 'hz;
440
    cs = 0;
441
    rw = 'hz;
442
  end
443
endtask
444 7 mohor
 
445
 
446 15 mohor
task read_receive_buffer;
447
  integer i;
448
  begin
449
    if(`CAN_CLOCK_DIVIDER_MODE)   // Extended mode
450
      begin
451
        for (i=8'h16; i<=8'h28; i=i+1)
452
          read_register(i);
453 16 mohor
        if (can_testbench.i_can_top.i_can_bsp.i_can_fifo.overrun_info[can_testbench.i_can_top.i_can_bsp.i_can_fifo.rd_info_pointer])
454
          $display("\nWARNING: This packet was received with overrun.");
455 15 mohor
      end
456
    else
457
      begin
458
        for (i=8'h20; i<=8'h29; i=i+1)
459
          read_register(i);
460 16 mohor
        if (can_testbench.i_can_top.i_can_bsp.i_can_fifo.overrun_info[can_testbench.i_can_top.i_can_bsp.i_can_fifo.rd_info_pointer])
461
          $display("\nWARNING: This packet was received with overrun.");
462 15 mohor
      end
463
  end
464
endtask
465
 
466
 
467
task release_rx_buffer;
468
  begin
469 16 mohor
    write_register(8'h1, 8'h4);
470
    $display("(%0t) Rx buffer released.", $time);
471
    repeat (2) @ (posedge clk);   // Time to decrement all the counters
472 15 mohor
  end
473
endtask
474
 
475
 
476 8 mohor
task test_synchronization;
477
  begin
478
    // Hard synchronization
479
    #1 rx=0;
480
    repeat (2*BRP) @ (posedge clk);
481
    repeat (8*BRP) @ (posedge clk);
482
    #1 rx=1;
483
    repeat (10*BRP) @ (posedge clk);
484
 
485
    // Resynchronization on time
486
    #1 rx=0;
487
    repeat (10*BRP) @ (posedge clk);
488
    #1 rx=1;
489
    repeat (10*BRP) @ (posedge clk);
490
 
491
    // Resynchronization late
492
    repeat (BRP) @ (posedge clk);
493
    repeat (BRP) @ (posedge clk);
494
    #1 rx=0;
495
    repeat (10*BRP) @ (posedge clk);
496
    #1 rx=1;
497
 
498
    // Resynchronization early
499
    repeat (8*BRP) @ (posedge clk);   // two frames too early
500
    #1 rx=0;
501
    repeat (10*BRP) @ (posedge clk);
502
    #1 rx=1;
503
    repeat (10*BRP) @ (posedge clk);
504
  end
505
endtask
506 7 mohor
 
507 8 mohor
 
508 9 mohor
task send_bit;
509
  input bit;
510
  integer cnt;
511
  begin
512
    #1 rx=bit;
513
    repeat ((`CAN_TIMING1_TSEG1 + `CAN_TIMING1_TSEG2 + 3)*BRP) @ (posedge clk);
514
  end
515
endtask
516
 
517
 
518 8 mohor
task send_frame;
519
  input mode;
520 11 mohor
  input remote_trans_req;
521 9 mohor
  input [28:0] id;
522
  input  [3:0] length;
523 11 mohor
  input [14:0] crc;
524 15 mohor
  integer pointer;
525 9 mohor
  integer cnt;
526 15 mohor
  integer total_bits;
527
  integer stuff_cnt;
528
  reg [117:0] data;
529 16 mohor
  reg         previous_bit;
530
  reg xxx;
531
  reg stuff;
532 15 mohor
  begin
533 9 mohor
 
534 16 mohor
    stuff_cnt = 1;
535
    stuff = 0;
536 15 mohor
 
537
    if(mode)          // Extended format
538
      data = {id[28:18], 1'b1, 1'b1, 1'b0, id[17:0], remote_trans_req, 2'h0, length};
539
    else              // Standard format
540
      data = {id[10:0], remote_trans_req, 1'b0, 1'b0, length};
541
 
542
    if(length)    // Send data if length is > 0
543
      begin
544
        for (cnt=1; cnt<=(2*length); cnt=cnt+1)  // data   (we are sending nibbles)
545
          data = {data[113:0], cnt[3:0]};
546
      end
547
 
548
    // Adding CRC
549
    data = {data[104:0], crc[14:0]};
550
 
551
 
552
    // Calculating pointer that points to the bit that will be send
553
    if(mode)          // Extended format
554
      pointer = 53 + 8 * length;
555
    else              // Standard format
556
      pointer = 32 + 8 * length;
557
 
558
    // This is how many bits we need to shift
559
    total_bits = pointer;
560
 
561
 
562 9 mohor
    send_bit(0);                        // SOF
563 16 mohor
    previous_bit = 0;
564 9 mohor
 
565 16 mohor
    for (cnt=0; cnt<=total_bits; cnt=cnt+1)
566 9 mohor
      begin
567 15 mohor
 
568 16 mohor
        xxx = data[pointer];
569
 
570
        if (stuff_cnt == 5)
571 9 mohor
          begin
572 16 mohor
            stuff_cnt = 1;
573
            total_bits = total_bits + 1;      //    ??????   Check this
574
            stuff = 1;
575
            send_bit(~data[pointer+1]);
576
            previous_bit = ~data[pointer+1];
577 9 mohor
          end
578 16 mohor
//        else if (data[pointer] == previous_bit)
579
//          stuff_cnt <= stuff_cnt + 1;
580
        else
581 11 mohor
          begin
582 16 mohor
            if (data[pointer] == previous_bit)
583
              stuff_cnt <= stuff_cnt + 1;
584
            else
585
              stuff_cnt <= 1;
586
 
587
            stuff = 0;
588
            send_bit(data[pointer]);        // Bit stuffing comes here !!!
589
            previous_bit = data[pointer];
590
            pointer = pointer - 1;
591 11 mohor
          end
592
      end
593 9 mohor
 
594 11 mohor
 
595
    // Nothing send after the data (just recessive bit)
596 16 mohor
    repeat (13) send_bit(1);         // CRC delimiter + ack + ack delimiter + EOF   !!! Check what is the minimum value for which core works ok
597 9 mohor
 
598
 
599
 
600 8 mohor
  end
601
endtask
602
 
603
 
604 16 mohor
 
605
 
606 11 mohor
// State machine monitor (btl)
607 7 mohor
always @ (posedge clk)
608
begin
609
  if(can_testbench.i_can_top.i_can_btl.go_sync & can_testbench.i_can_top.i_can_btl.go_seg1 | can_testbench.i_can_top.i_can_btl.go_sync & can_testbench.i_can_top.i_can_btl.go_seg2 |
610
     can_testbench.i_can_top.i_can_btl.go_seg1 & can_testbench.i_can_top.i_can_btl.go_seg2)
611 10 mohor
    begin
612
      $display("(%0t) ERROR multiple go_sync, go_seg1 or go_seg2 occurance\n\n", $time);
613
      #1000;
614
      $stop;
615
    end
616 7 mohor
 
617
  if(can_testbench.i_can_top.i_can_btl.sync & can_testbench.i_can_top.i_can_btl.seg1 | can_testbench.i_can_top.i_can_btl.sync & can_testbench.i_can_top.i_can_btl.seg2 |
618
     can_testbench.i_can_top.i_can_btl.seg1 & can_testbench.i_can_top.i_can_btl.seg2)
619 10 mohor
    begin
620
      $display("(%0t) ERROR multiple sync, seg1 or seg2 occurance\n\n", $time);
621
      #1000;
622
      $stop;
623
    end
624 7 mohor
end
625
 
626 10 mohor
/* stuff_error monitor (bsp)
627
always @ (posedge clk)
628
begin
629
  if(can_testbench.i_can_top.i_can_bsp.stuff_error)
630
    begin
631
      $display("\n\n(%0t) Stuff error occured in can_bsp.v file\n\n", $time);
632
      $stop;                                      After everything is finished add another condition (something like & (~idle)) and enable stop
633
    end
634
end
635
*/
636
 
637 16 mohor
/*
638
// CRC monitor (used until proper CRC generation is used in testbench
639
always @ (posedge clk)
640
begin
641
  if (can_testbench.i_can_top.i_can_bsp.crc_error)
642
    $display("Calculated crc = 0x%0x, crc_in = 0x%0x", can_testbench.i_can_top.i_can_bsp.calculated_crc, can_testbench.i_can_top.i_can_bsp.crc_in);
643
end
644
*/
645 10 mohor
 
646 16 mohor
 
647
 
648
 
649
/*
650
// overrun monitor
651
always @ (posedge clk)
652
begin
653
  if (can_testbench.i_can_top.i_can_bsp.i_can_fifo.wr & can_testbench.i_can_top.i_can_bsp.i_can_fifo.fifo_full)
654
    $display("(%0t)overrun", $time);
655
end
656
*/
657
 
658
 
659 2 mohor
endmodule
660 16 mohor
 

powered by: WebSVN 2.1.0

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