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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [rel_21/] [bench/] [verilog/] [dbg_tb.v] - Blame information for rev 95

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

Line No. Rev Author Line
1 2 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  dbg_tb.v                                                    ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC/OpenRISC Development Interface ////
7 36 mohor
////  http://www.opencores.org/projects/DebugInterface/           ////
8 2 mohor
////                                                              ////
9
////  Author(s):                                                  ////
10 80 mohor
////       Igor Mohor (igorm@opencores.org)                       ////
11 2 mohor
////                                                              ////
12
////                                                              ////
13
////  All additional information is avaliable in the README.txt   ////
14
////  file.                                                       ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18 80 mohor
//// Copyright (C) 2000 - 2003 Authors                            ////
19 2 mohor
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS Revision History
44
//
45
// $Log: not supported by cvs2svn $
46 95 mohor
// Revision 1.22  2004/01/13 11:28:30  mohor
47
// tmp version.
48
//
49 93 mohor
// Revision 1.21  2004/01/10 07:50:41  mohor
50
// temp version.
51
//
52 92 mohor
// Revision 1.20  2004/01/09 12:49:23  mohor
53
// tmp version.
54
//
55 91 mohor
// Revision 1.19  2004/01/08 17:53:12  mohor
56
// tmp version.
57
//
58 90 mohor
// Revision 1.18  2004/01/07 11:59:48  mohor
59
// temp4 version.
60
//
61 89 mohor
// Revision 1.17  2004/01/06 17:14:59  mohor
62
// temp3 version.
63
//
64 88 mohor
// Revision 1.16  2004/01/05 12:16:50  mohor
65
// tmp2 version.
66
//
67 87 mohor
// Revision 1.15  2003/12/23 14:26:01  mohor
68
// New version of the debug interface. Not finished, yet.
69
//
70 80 mohor
// Revision 1.14  2003/10/23 16:16:30  mohor
71
// CRC logic changed.
72
//
73 73 mohor
// Revision 1.13  2003/08/28 13:54:33  simons
74
// Three more chains added for cpu debug access.
75
//
76 63 simons
// Revision 1.12  2002/05/07 14:44:52  mohor
77
// mon_cntl_o signals that controls monitor mux added.
78
//
79 47 mohor
// Revision 1.11  2002/03/12 14:32:26  mohor
80
// Few outputs for boundary scan chain added.
81
//
82 38 mohor
// Revision 1.10  2002/03/08 15:27:08  mohor
83
// Structure changed. Hooks for jtag chain added.
84
//
85 36 mohor
// Revision 1.9  2001/10/19 11:39:20  mohor
86
// dbg_timescale.v changed to timescale.v This is done for the simulation of
87
// few different cores in a single project.
88
//
89 17 mohor
// Revision 1.8  2001/10/17 10:39:17  mohor
90
// bs_chain_o added.
91
//
92 15 mohor
// Revision 1.7  2001/10/16 10:10:18  mohor
93
// Signal names changed to lowercase.
94
//
95 13 mohor
// Revision 1.6  2001/10/15 09:52:50  mohor
96
// Wishbone interface added, few fixes for better performance,
97
// hooks for boundary scan testing added.
98
//
99 12 mohor
// Revision 1.5  2001/09/24 14:06:12  mohor
100
// Changes connected to the OpenRISC access (SPR read, SPR write).
101
//
102 11 mohor
// Revision 1.4  2001/09/20 10:10:29  mohor
103
// Working version. Few bugs fixed, comments added.
104
//
105 9 mohor
// Revision 1.3  2001/09/19 11:54:03  mohor
106
// Minor changes for simulation.
107
//
108 6 mohor
// Revision 1.2  2001/09/18 14:12:43  mohor
109
// Trace fixed. Some registers changed, trace simplified.
110
//
111 5 mohor
// Revision 1.1.1.1  2001/09/13 13:49:19  mohor
112
// Initial official release.
113
//
114 2 mohor
// Revision 1.3  2001/06/01 22:23:40  mohor
115
// This is a backup. It is not a fully working version. Not for use, yet.
116
//
117
// Revision 1.2  2001/05/18 13:10:05  mohor
118
// Headers changed. All additional information is now avaliable in the README.txt file.
119
//
120
// Revision 1.1.1.1  2001/05/18 06:35:15  mohor
121
// Initial release
122
//
123
//
124
 
125
 
126 17 mohor
`include "timescale.v"
127 2 mohor
`include "dbg_defines.v"
128 80 mohor
`include "dbg_wb_defines.v"
129
//`include "dbg_tb_defines.v"
130 2 mohor
 
131
// Test bench
132
module dbg_tb;
133
 
134 80 mohor
parameter TCLK = 50;   // Clock half period (Clok period = 100 ns => 10 MHz)
135 2 mohor
 
136 80 mohor
reg   tms_pad_i;
137
reg   tck_pad_i;
138
reg   trst_pad_i;
139
reg   tdi_pad_i;
140
wire  tdo_pad_o;
141
wire  tdo_padoe_o;
142 2 mohor
 
143 80 mohor
wire  shift_dr_o;
144
wire  pause_dr_o;
145
wire  update_dr_o;
146 2 mohor
 
147 80 mohor
wire  extest_select_o;
148
wire  sample_preload_select_o;
149
wire  mbist_select_o;
150
wire  debug_select_o;
151 2 mohor
 
152 80 mohor
// WISHBONE common signals
153
reg   wb_rst_i;
154
reg   wb_clk_i;
155
 
156
// WISHBONE master interface
157
wire [31:0] wb_adr_o;
158
wire [31:0] wb_dat_o;
159
wire [31:0] wb_dat_i;
160
wire        wb_cyc_o;
161
wire        wb_stb_o;
162
wire  [3:0] wb_sel_o;
163
wire        wb_we_o;
164
wire        wb_ack_i;
165
wire        wb_cab_o;
166
wire        wb_err_i;
167
wire  [2:0] wb_cti_o;
168
wire  [1:0] wb_bte_o;
169 2 mohor
 
170 87 mohor
// Text used for easier debugging
171
reg  [99:0] test_text;
172 88 mohor
reg   [2:0] last_wb_cmd;
173
reg  [99:0] last_wb_cmd_text;
174
reg  [31:0] wb_data;
175 2 mohor
 
176
 
177 12 mohor
 
178 80 mohor
wire  tdo_o;
179 12 mohor
 
180 80 mohor
wire  debug_tdi_i;
181
wire  bs_chain_tdi_i;
182
wire  mbist_tdi_i;
183 73 mohor
 
184 80 mohor
reg   test_enabled;
185 73 mohor
 
186 80 mohor
reg [31:0] result;
187 2 mohor
 
188 88 mohor
reg [31:0] tmp_crc;
189
reg [31:0] shifted_in_crc;
190
 
191 80 mohor
wire tdo;
192 73 mohor
 
193 80 mohor
assign tdo = tdo_padoe_o? tdo_pad_o : 1'hz;
194 73 mohor
 
195 80 mohor
// Connecting TAP module
196
tap_top i_tap_top (
197
                    .tms_pad_i(tms_pad_i),
198
                    .tck_pad_i(tck_pad_i),
199
                    .trst_pad_i(!trst_pad_i),
200
                    .tdi_pad_i(tdi_pad_i),
201
                    .tdo_pad_o(tdo_pad_o),
202
                    .tdo_padoe_o(tdo_padoe_o),
203 38 mohor
 
204 80 mohor
                    // TAP states
205
                    .shift_dr_o(shift_dr_o),
206
                    .pause_dr_o(pause_dr_o),
207
                    .update_dr_o(update_dr_o),
208 38 mohor
 
209 80 mohor
                    // Select signals for boundary scan or mbist
210
                    .extest_select_o(extest_select_o),
211
                    .sample_preload_select_o(sample_preload_select_o),
212
                    .mbist_select_o(mbist_select_o),
213
                    .debug_select_o(debug_select_o),
214 2 mohor
 
215 80 mohor
                    // TDO signal that is connected to TDI of sub-modules.
216
                    .tdo_o(tdo_o),
217 38 mohor
 
218 80 mohor
                    // TDI signals from sub-modules
219
                    .debug_tdi_i(debug_tdi_i),        // from debug module
220
                    .bs_chain_tdi_i(bs_chain_tdi_i),  // from Boundary Scan Chain
221
                    .mbist_tdi_i(mbist_tdi_i)         // from Mbist Chain
222 73 mohor
 
223 38 mohor
               );
224 2 mohor
 
225
 
226 80 mohor
dbg_top i_dbg_top  (
227
                    .tck_i(tck_pad_i),
228
                    .tdi_i(tdo_o),
229
                    .tdo_o(debug_tdi_i),
230
 
231
                    // TAP states
232
                    .shift_dr_i   (shift_dr_o),
233
                    .pause_dr_i   (pause_dr_o),
234
                    .update_dr_i  (update_dr_o),
235
 
236
                    // Instructions
237
                    .debug_select_i(debug_select_o),
238 12 mohor
 
239 80 mohor
                    // WISHBONE common signals
240
                    .wb_rst_i      (wb_rst_i),
241
                    .wb_clk_i      (wb_clk_i),
242
 
243
                    // WISHBONE master interface
244
                    .wb_adr_o      (wb_adr_o),
245
                    .wb_dat_o      (wb_dat_o),
246
                    .wb_dat_i      (wb_dat_i),
247
                    .wb_cyc_o      (wb_cyc_o),
248
                    .wb_stb_o      (wb_stb_o),
249
                    .wb_sel_o      (wb_sel_o),
250
                    .wb_we_o       (wb_we_o),
251
                    .wb_ack_i      (wb_ack_i),
252
                    .wb_cab_o      (wb_cab_o),
253
                    .wb_err_i      (wb_err_i),
254
                    .wb_cti_o      (wb_cti_o),
255
                    .wb_bte_o      (wb_bte_o)
256
                   );
257 12 mohor
 
258
 
259 80 mohor
wb_slave_behavioral wb_slave
260
                   (
261
                    .CLK_I(wb_clk_i),
262
                    .RST_I(wb_rst_i),
263
                    .ACK_O(wb_ack_i),
264
                    .ADR_I(wb_adr_o),
265
                    .CYC_I(wb_cyc_o),
266
                    .DAT_O(wb_dat_i),
267
                    .DAT_I(wb_dat_o),
268
                    .ERR_O(wb_err_i),
269
                    .RTY_O(),      // NOT USED for now!
270
                    .SEL_I(wb_sel_o),
271
                    .STB_I(wb_stb_o),
272
                    .WE_I (wb_we_o),
273
                    .CAB_I(1'b0)
274
                   );
275 2 mohor
 
276
 
277 80 mohor
// Initial values
278 2 mohor
initial
279
begin
280 80 mohor
  test_enabled = 1'b0;
281 88 mohor
  wb_data = 32'h01234567;
282 80 mohor
  trst_pad_i = 1'b1;
283
  tms_pad_i = 1'hz;
284
  tck_pad_i = 1'hz;
285
  tdi_pad_i = 1'hz;
286
 
287
  #100;
288
  trst_pad_i = 1'b0;
289
  #100;
290
  trst_pad_i = 1'b1;
291
  #1 test_enabled<=#1 1'b1;
292 2 mohor
end
293
 
294 80 mohor
initial
295
begin
296
  wb_rst_i = 1'b0;
297
  #1000;
298
  wb_rst_i = 1'b1;
299
  #1000;
300
  wb_rst_i = 1'b0;
301 2 mohor
 
302 80 mohor
  // Initial values for wishbone slave model
303
  wb_slave.cycle_response(`ACK_RESPONSE, 8'h55, 8'h2);   // (`ACK_RESPONSE, wbs_waits, wbs_retries);
304
end
305
 
306
initial
307 2 mohor
begin
308 80 mohor
  wb_clk_i = 1'b0;
309
  forever #5 wb_clk_i = ~wb_clk_i;
310 2 mohor
end
311
 
312 80 mohor
always @ (posedge test_enabled)
313
begin
314 2 mohor
 
315 80 mohor
  $display("//////////////////////////////////////////////////////////////////");
316
  $display("//                                                              //");
317
  $display("//  (%0t) dbg_tb starting                                     //", $time);
318
  $display("//                                                              //");
319
  $display("//////////////////////////////////////////////////////////////////");
320 2 mohor
 
321 80 mohor
  initialize_memory(32'h12340000, 32'h00100000);  // Initialize 0x100000 bytes starting from address 0x12340000
322 2 mohor
 
323 80 mohor
  reset_tap;
324 95 mohor
 
325
  #500;
326 80 mohor
  goto_run_test_idle;
327 12 mohor
 
328 80 mohor
  // Testing read and write to internal registers
329
  #10000;
330
  set_instruction(`IDCODE);
331
  read_id_code;
332 12 mohor
 
333 80 mohor
  set_instruction(`DEBUG);
334
  #10000;
335 2 mohor
 
336 80 mohor
  chain_select(`WISHBONE_SCAN_CHAIN, 32'hf2bcd929);
337 12 mohor
 
338 80 mohor
//  #10000;
339
//  xxx(4'b1001, 32'he579b242);
340 12 mohor
 
341 80 mohor
  #10000;
342 2 mohor
 
343 88 mohor
//  debug_wishbone(`WB_READ8, 1'b0, 32'h12345678, 16'h4, 32'h57ecda62, result, "abc 1"); // {command, ready, addr, length, crc, result, text}
344
//  debug_wishbone(`WB_READ8, 1'b0, 32'h12345679, 16'h4, 32'h563476e5, result, "abc 2"); // {command, ready, addr, length, crc, result, text}
345
//  debug_wishbone(`WB_READ8, 1'b0, 32'h1234567a, 16'h4, 32'h545d836c, result, "abc 3"); // {command, ready, addr, length, crc, result, text}
346
//
347
//  debug_wishbone(`WB_READ16, 1'b0, 32'h12345678, 16'h4, 32'h86156251, result, "abc 4"); // {command, ready, addr, length, crc, result, text}
348
//  debug_wishbone(`WB_READ16, 1'b0, 32'h1234567a, 16'h4, 32'h85a43b5f, result, "abc 5"); // {command, ready, addr, length, crc, result, text}
349
//
350 90 mohor
  debug_wishbone(`WB_READ32, 1'b0, 32'h12345678, 16'h4, 32'hc9420a40, result, "read32 1"); // {command, ready, addr, length, crc, result, text}
351 88 mohor
//
352
//  debug_wishbone(`WB_READ16, 1'b0, 32'h12345679, 16'h4, 32'h87cdced6, result, "abc 6"); // {command, ready, addr, length, crc, result, text}
353 2 mohor
 
354 80 mohor
  #10000;
355
//  xxx(4'b1001, 32'he579b242);
356
 
357 90 mohor
  debug_wishbone(`WB_READ32, 1'b1, 32'h12345678, 16'h4, 32'hc9420a40, result, "read32 2"); // {command, ready, addr, length, crc, result, text}
358 87 mohor
 
359
  #10000;
360 80 mohor
  wb_slave.cycle_response(`ACK_RESPONSE, 8'h55, 8'h2);   // (`ACK_RESPONSE, wbs_waits, wbs_retries);
361 90 mohor
  debug_wishbone(`WB_READ32, 1'b1, 32'h12346668, 16'h4, 32'hc935a962, result, "read32 3"); // {command, ready, addr, length, crc, result, text}
362 80 mohor
 
363
  #10000;
364 88 mohor
  wb_slave.cycle_response(`ERR_RESPONSE, 8'h03, 8'h2);   // (`ERR_RESPONSE, wbs_waits, wbs_retries);
365 90 mohor
  debug_wishbone(`WB_READ32, 1'b1, 32'h12346668, 16'h4, 32'hc935a962, result, "read32 4"); // {command, ready, addr, length, crc, result, text}
366 80 mohor
 
367
  #10000;
368 88 mohor
  debug_wishbone(`WB_STATUS, 1'b0, 32'h0, 16'h0, 32'hc7b0424d, result, "status 1"); // {command, ready, addr, length, crc, result, text}
369 80 mohor
 
370 87 mohor
  #10000;
371 88 mohor
  debug_wishbone(`WB_STATUS, 1'b0, 32'h0, 16'h0, 32'hc7b0424d, result, "status 2"); // {command, ready, addr, length, crc, result, text}
372 80 mohor
 
373 87 mohor
  #10000;
374 92 mohor
  wb_slave.cycle_response(`ACK_RESPONSE, 8'h0a, 8'h2);   // (`ACK_RESPONSE, wbs_waits, wbs_retries);
375 90 mohor
  debug_wishbone(`WB_READ32, 1'b1, 32'h12347778, 16'hc, 32'hd9ce3bbe, result, "read32 5"); // {command, ready, addr, length, crc, result, text}
376 80 mohor
 
377 87 mohor
  #10000;
378 90 mohor
  debug_wishbone(`WB_WRITE32, 1'b0, 32'h12346668, 16'h8, 32'hc5a58ff5, result, "wr32 len8"); // {command, ready, addr, length, crc, result, text}
379 87 mohor
 
380
  #10000;
381 90 mohor
  debug_wishbone(`WB_WRITE16, 1'b0, 32'h12344446, 16'h8, 32'hed029606, result, "wr16 len8"); // {command, ready, addr, length, crc, result, text}
382 87 mohor
 
383 88 mohor
  #10000;
384 91 mohor
  debug_wishbone(`WB_WRITE8, 1'b0, 32'h1234010e, 16'h8, 32'h359e2d2a, result, "wr8 len8"); // {command, ready, addr, length, crc, result, text}
385 87 mohor
 
386 88 mohor
  #10000;
387 90 mohor
  debug_wishbone(`WB_GO, 1'b0, 32'h0, 16'h0, 32'h5e9dd377, result, "go 1"); // {command, ready, addr, length, crc, result, text}
388 87 mohor
 
389 89 mohor
  #10000;
390 90 mohor
  debug_wishbone(`WB_READ32, 1'b1, 32'h12340100, 16'hc, 32'h8bbeb90d, result, "read32 6"); // {command, ready, addr, length, crc, result, text}
391 88 mohor
 
392 89 mohor
  #10000;
393 90 mohor
  debug_wishbone(`WB_READ16, 1'b1, 32'h12340102, 16'he, 32'hcedab37c, result, "read16 7"); // {command, ready, addr, length, crc, result, text}
394 88 mohor
 
395 90 mohor
  #10000;
396 93 mohor
  debug_wishbone(`WB_READ8, 1'b1, 32'h12348804, 16'h6, 32'hbe993245, result, "read8 8"); // {command, ready, addr, length, crc, result, text}
397 89 mohor
 
398 90 mohor
  #10000;
399
  debug_wishbone(`WB_GO, 1'b0, 32'h0, 16'h0, 32'hd4b43491, result, "go 2"); // {command, ready, addr, length, crc, result, text}
400 89 mohor
 
401
 
402 90 mohor
 
403
 
404 80 mohor
/*
405
  // Testing read and write to CPU0 registers
406
  #10000;
407
  set_instruction(`CHAIN_SELECT);
408
  chain_select(`CPU_DEBUG_CHAIN_0, 8'h12);  // {chain, crc}
409
  set_instruction(`DEBUG);
410
  WriteCPURegister(32'h11001100, 32'h00110011, 8'h86);  // {data, addr, crc}
411
 
412
  ReadCPURegister(32'h11001100, 8'hdb);                 // {addr, crc}
413
  ReadCPURegister(32'h11001100, 8'hdb);                 // {addr, crc}
414
*/
415
  #5000 gen_clk(1);            // One extra TCLK for debugging purposes
416 95 mohor
  $display("\n\nSimulation end.");
417 5 mohor
  #1000 $stop;
418 80 mohor
 
419 2 mohor
end
420
 
421 80 mohor
 
422
task initialize_memory;
423
  input [31:0] start_addr;
424
  input [31:0] length;
425
  integer i;
426
  reg [31:0] addr;
427
  begin
428
    for (i=0; i<length; i=i+4)
429
      begin
430
        addr = start_addr + i;
431
        wb_slave.wr_mem(addr, {addr[7:0], addr[15:8], addr[23:16], addr[31:24]}, 4'hf);    // adr, data, sel
432
      end
433
  end
434
endtask
435
 
436
 
437
 
438 2 mohor
// Generation of the TCLK signal
439 80 mohor
task gen_clk;
440
  input [7:0] num;
441 2 mohor
  integer i;
442
  begin
443 80 mohor
    for(i=0; i<num; i=i+1)
444 2 mohor
      begin
445 80 mohor
        #TCLK tck_pad_i<=1;
446
        #TCLK tck_pad_i<=0;
447 2 mohor
      end
448
  end
449
endtask
450
 
451
 
452
// TAP reset
453 80 mohor
task reset_tap;
454 2 mohor
  begin
455 80 mohor
    $display("(%0t) Task reset_tap", $time);
456
    tms_pad_i<=#1 1'b1;
457 95 mohor
    gen_clk(5);
458 2 mohor
  end
459
endtask
460
 
461
 
462
// Goes to RunTestIdle state
463 80 mohor
task goto_run_test_idle;
464 2 mohor
  begin
465 80 mohor
    $display("(%0t) Task goto_run_test_idle", $time);
466
    tms_pad_i<=#1 1'b0;
467
    gen_clk(1);
468 2 mohor
  end
469
endtask
470
 
471
 
472
// sets the instruction to the IR register and goes to the RunTestIdle state
473 80 mohor
task set_instruction;
474
  input [3:0] instr;
475 2 mohor
  integer i;
476
 
477
  begin
478 80 mohor
    $display("(%0t) Task set_instruction", $time);
479
    tms_pad_i<=#1 1;
480
    gen_clk(2);
481
    tms_pad_i<=#1 0;
482
    gen_clk(2);  // we are in shiftIR
483 2 mohor
 
484
    for(i=0; i<`IR_LENGTH-1; i=i+1)
485
    begin
486 80 mohor
      tdi_pad_i<=#1 instr[i];
487
      gen_clk(1);
488 2 mohor
    end
489
 
490 80 mohor
    tdi_pad_i<=#1 instr[i]; // last shift
491
    tms_pad_i<=#1 1;        // going out of shiftIR
492
    gen_clk(1);
493 90 mohor
    tdi_pad_i<=#1 'hz;    // tri-state
494 80 mohor
    gen_clk(1);
495
    tms_pad_i<=#1 0;
496
    gen_clk(1);       // we are in RunTestIdle
497 2 mohor
  end
498
endtask
499
 
500
 
501 80 mohor
// Reads the ID code
502
task read_id_code;
503
  begin
504
    $display("(%0t) Task read_id_code", $time);
505
    tms_pad_i<=#1 1;
506
    gen_clk(1);
507
    tms_pad_i<=#1 0;
508
    gen_clk(2);  // we are in shiftDR
509
 
510
    tdi_pad_i<=#1 0;
511
    gen_clk(31);
512
 
513
    tms_pad_i<=#1 1;        // going out of shiftIR
514
    gen_clk(1);
515
 
516
    tdi_pad_i<=#1 'hz; // tri-state
517
    gen_clk(1);
518
    tms_pad_i<=#1 0;
519
    gen_clk(1);       // we are in RunTestIdle
520
  end
521
endtask
522
 
523
 
524 2 mohor
// sets the selected scan chain and goes to the RunTestIdle state
525 80 mohor
task chain_select;
526
  input [3:0]  data;
527
  input [31:0] crc;
528 2 mohor
  integer i;
529
 
530
  begin
531 80 mohor
    $display("(%0t) Task chain_select", $time);
532
    tms_pad_i<=#1 1;
533
    gen_clk(1);
534
    tms_pad_i<=#1 0;
535
    gen_clk(2);  // we are in shiftDR
536 2 mohor
 
537 80 mohor
    tdi_pad_i<=#1 1'b1; // chain_select bit
538
    gen_clk(1);
539
 
540 2 mohor
    for(i=0; i<`CHAIN_ID_LENGTH; i=i+1)
541
    begin
542 80 mohor
      tdi_pad_i<=#1 data[i];
543
      gen_clk(1);
544 2 mohor
    end
545
 
546 80 mohor
    for(i=0; i<`CRC_LEN; i=i+1)
547 2 mohor
    begin
548 80 mohor
      tdi_pad_i<=#1 crc[`CRC_LEN -1-i];
549
      gen_clk(1);
550 2 mohor
    end
551
 
552 80 mohor
    gen_clk(`STATUS_LEN);   // Generating 5 clocks to read out status.
553
 
554
 
555
    for(i=0; i<`CRC_LEN -1; i=i+1)
556
    begin
557
      tdi_pad_i<=#1 1'b0;
558
      gen_clk(1);
559
    end
560
 
561
    tdi_pad_i<=#1 crc[i]; // last crc
562
    tms_pad_i<=#1 1;
563
    gen_clk(1);         // to exit1_dr
564
 
565
    tdi_pad_i<=#1 'hz;  // tri-state
566
    tms_pad_i<=#1 1;
567
    gen_clk(1);         // to update_dr
568
    tms_pad_i<=#1 0;
569
    gen_clk(1);         // to run_test_idle
570 2 mohor
  end
571
endtask
572
 
573
 
574 87 mohor
 
575
 
576
 
577
 
578
 
579 80 mohor
task debug_wishbone;
580
  input [2:0]   command;
581 87 mohor
  input         ready;
582 80 mohor
  input [31:0]  addr;
583
  input [15:0]  length;
584
  input [31:0]  crc;
585
  output [31:0] result;
586 87 mohor
  input [99:0]  text;
587 80 mohor
  integer i;
588
 
589 2 mohor
  begin
590 80 mohor
   $write("(%0t) Task debug_wishbone: ", $time);
591 2 mohor
 
592 87 mohor
    test_text = text;
593 88 mohor
    shifted_in_crc = crc;
594 36 mohor
 
595 80 mohor
    case (command)
596
      `WB_STATUS   :
597
        begin
598 88 mohor
          $display("wb_status (crc=0x%0x (%0s))", crc, text);
599
          debug_wishbone_status(command, crc);
600
          last_wb_cmd = `WB_STATUS;  last_wb_cmd_text = "WB_STATUS";
601 80 mohor
        end
602
      `WB_READ8    :
603
        begin
604 87 mohor
          $display("wb_read8 (ready=%0d, adr=0x%0x, length=0x%0x, crc=0x%0x (%0s))", ready, addr, length, crc, text);
605
          debug_wishbone_set_addr(command, ready, addr, length, crc);
606 88 mohor
          last_wb_cmd = `WB_READ8;  last_wb_cmd_text = "WB_READ8";
607 80 mohor
        end
608
      `WB_READ16   :
609
        begin
610 87 mohor
          $display("wb_read16 (ready=%0d, adr=0x%0x, length=0x%0x, crc=0x%0x (%0s))", ready, addr, length, crc, text);
611
          debug_wishbone_set_addr(command, ready, addr, length, crc);
612 88 mohor
          last_wb_cmd = `WB_READ16;  last_wb_cmd_text = "WB_READ16";
613 80 mohor
        end
614
      `WB_READ32   :
615
        begin
616 87 mohor
          $display("wb_read32 (ready=%0d, adr=0x%0x, length=0x%0x, crc=0x%0x (%0s))", ready, addr, length, crc, text);
617
          debug_wishbone_set_addr(command, ready, addr, length, crc);
618 88 mohor
          last_wb_cmd = `WB_READ32;  last_wb_cmd_text = "WB_READ32";
619 80 mohor
        end
620
      `WB_WRITE8   :
621
        begin
622 88 mohor
          $display("wb_write8 (adr=0x%0x, length=0x%0x, crc=0x%0x (%0s))", addr, length, crc, text);
623 87 mohor
          debug_wishbone_set_addr(command, ready, addr, length, crc);
624 88 mohor
          last_wb_cmd = `WB_WRITE8;  last_wb_cmd_text = "WB_WRITE8";
625 80 mohor
        end
626
      `WB_WRITE16  :
627
        begin
628 88 mohor
          $display("wb_write16 (adr=0x%0x, length=0x%0x, crc=0x%0x (%0s))", addr, length, crc, text);
629 87 mohor
          debug_wishbone_set_addr(command, ready, addr, length, crc);
630 88 mohor
          last_wb_cmd = `WB_WRITE16;  last_wb_cmd_text = "WB_WRITE16";
631 80 mohor
        end
632
      `WB_WRITE32  :
633
        begin
634 88 mohor
          $display("wb_write32 (adr=0x%0x, length=0x%0x, crc=0x%0x (%0s))", addr, length, crc, text);
635 87 mohor
          debug_wishbone_set_addr(command, ready, addr, length, crc);
636 88 mohor
          last_wb_cmd = `WB_WRITE32;  last_wb_cmd_text = "WB_WRITE32";
637 80 mohor
        end
638
      `WB_GO       :
639
        begin
640 87 mohor
          $display("wb_go, crc=0x%0x (%0s))", crc, text);
641 88 mohor
          debug_wishbone_go(command, crc);
642 93 mohor
//          $display("wb_go_tmp, crc=0x%0x (%0s))", crc, text);
643
//          debug_wishbone_go_tmp(command, crc);
644 88 mohor
          last_wb_cmd = `WB_GO;  last_wb_cmd_text = "WB_GO";
645 80 mohor
        end
646
    endcase
647 2 mohor
  end
648 87 mohor
endtask       // debug_wishbone
649 2 mohor
 
650
 
651 80 mohor
 
652
 
653
 
654
 
655 87 mohor
task debug_wishbone_set_addr;
656 80 mohor
  input [2:0]   command;
657 87 mohor
  input         wait_for_wb_ready;
658 80 mohor
  input [31:0]  addr;
659
  input [15:0]  length;
660
  input [31:0]  crc;
661
  integer i;
662
 
663
  begin
664 87 mohor
    $display("(%0t) Task debug_wishbone_set_addr: ", $time);
665 80 mohor
 
666
    tms_pad_i<=#1 1;
667
    gen_clk(1);
668
    tms_pad_i<=#1 0;
669
    gen_clk(2);  // we are in shiftDR
670
 
671
    tdi_pad_i<=#1 1'b0; // chain_select bit = 0
672
    gen_clk(1);
673
 
674 88 mohor
    for(i=2; i>=0; i=i-1)
675 80 mohor
    begin
676
      tdi_pad_i<=#1 command[i]; // command
677
      gen_clk(1);
678
    end
679
 
680 88 mohor
    for(i=31; i>=0; i=i-1)       // address
681 80 mohor
    begin
682
      tdi_pad_i<=#1 addr[i];
683
      gen_clk(1);
684
    end
685 87 mohor
 
686 88 mohor
    for(i=15; i>=0; i=i-1)       // length
687 80 mohor
    begin
688
      tdi_pad_i<=#1 length[i];
689
      gen_clk(1);
690
    end
691
 
692 88 mohor
    for(i=31; i>=0; i=i-1)
693 80 mohor
    begin
694 88 mohor
      tdi_pad_i<=#1 crc[i];
695 80 mohor
      gen_clk(1);
696
    end
697
 
698 92 mohor
    tdi_pad_i<=#1 'hz;
699 87 mohor
    if (wait_for_wb_ready)
700
      begin
701
        gen_clk(`STATUS_LEN -1);   // Generating 4 clocks to read out status. Going to pause_dr at the end
702
        tms_pad_i<=#1 1;
703
        gen_clk(1);       // to exit1_dr
704
        tms_pad_i<=#1 0;
705
        gen_clk(1);       // to pause_dr
706
 
707
        while (dbg_tb.tdo_pad_o)     // waiting for wb to send "ready" 
708
        begin
709
          gen_clk(1);       // staying in pause_dr
710
        end
711
 
712
        tms_pad_i<=#1 1;
713
        gen_clk(1);       // to exit2_dr
714
        tms_pad_i<=#1 0;
715
        gen_clk(1);       // to shift_dr
716
      end
717
    else
718
      gen_clk(`STATUS_LEN);   // Generating 4 clocks to read out status.
719 80 mohor
 
720 88 mohor
    for(i=0; i<`CRC_LEN -1; i=i+1)  // Getting in the CRC
721 80 mohor
    begin
722
      gen_clk(1);
723
    end
724
 
725
    tms_pad_i<=#1 1;
726
    gen_clk(1);         // to exit1_dr
727
 
728
    tms_pad_i<=#1 1;
729
    gen_clk(1);         // to update_dr
730
    tms_pad_i<=#1 0;
731
    gen_clk(1);         // to run_test_idle
732
  end
733 87 mohor
endtask       // debug_wishbone_set_addr
734 80 mohor
 
735
 
736
 
737
 
738
 
739 88 mohor
task debug_wishbone_status;
740
  input [2:0]   command;
741
  input [31:0]  crc;
742
  integer i;
743
 
744
  begin
745
    $display("(%0t) Task debug_wishbone_status: ", $time);
746 80 mohor
 
747 88 mohor
    tms_pad_i<=#1 1;
748
    gen_clk(1);
749
    tms_pad_i<=#1 0;
750
    gen_clk(2);  // we are in shiftDR
751 87 mohor
 
752 88 mohor
    tdi_pad_i<=#1 1'b0; // chain_select bit = 0
753
    gen_clk(1);
754 87 mohor
 
755 88 mohor
    for(i=2; i>=0; i=i-1)
756
    begin
757
      tdi_pad_i<=#1 command[i]; // command
758
      gen_clk(1);
759
    end
760 87 mohor
 
761 88 mohor
    for(i=31; i>=0; i=i-1)      // crc
762
    begin
763
      tdi_pad_i<=#1 crc[i];
764
      gen_clk(1);
765
    end
766
 
767 92 mohor
    tdi_pad_i<=#1 1'hz;
768 88 mohor
    gen_clk(`STATUS_LEN);   // Generating 4 clocks to read out status.
769
 
770
    for(i=0; i<`CRC_LEN -1; i=i+1)  // Getting in the CRC
771
    begin
772
      gen_clk(1);
773
    end
774
 
775
    tms_pad_i<=#1 1;
776
    gen_clk(1);         // to exit1_dr
777
 
778
    tms_pad_i<=#1 1;
779
    gen_clk(1);         // to update_dr
780
    tms_pad_i<=#1 0;
781
    gen_clk(1);         // to run_test_idle
782
  end
783
endtask       // debug_wishbone_status
784
 
785
 
786
 
787
 
788
task debug_wishbone_go;
789
  input [2:0]   command;
790
  input [31:0]  crc;
791 90 mohor
  integer i;
792
  reg   [4:0]   pointer;
793
 
794 2 mohor
  begin
795 88 mohor
    $display("(%0t) Task debug_wishbone_go (previous command was %0s): ", $time, last_wb_cmd_text);
796
 
797 80 mohor
    tms_pad_i<=#1 1;
798
    gen_clk(1);
799
    tms_pad_i<=#1 0;
800
    gen_clk(2);  // we are in shiftDR
801 2 mohor
 
802 88 mohor
    tdi_pad_i<=#1 1'b0; // chain_select bit = 0
803 80 mohor
    gen_clk(1);
804 88 mohor
 
805
    for(i=2; i>=0; i=i-1)
806
    begin
807
      tdi_pad_i<=#1 command[i]; // command
808
      gen_clk(1);
809
    end
810
 
811
 
812
    if ((last_wb_cmd == `WB_WRITE8) | (last_wb_cmd == `WB_WRITE16) | (last_wb_cmd == `WB_WRITE32))  // When WB_WRITEx was previously activated, data needs to be shifted.
813
      begin
814 90 mohor
        for (i=0; i<(dbg_tb.i_dbg_top.i_dbg_wb.len << 3); i=i+1)
815 88 mohor
          begin
816 90 mohor
            if (!(i%32))
817 88 mohor
              begin
818 90 mohor
                wb_data = wb_data + 32'h11111111;
819
                $display("\t\twb_data = 0x%x", wb_data);
820 88 mohor
              end
821 90 mohor
            pointer = 31-i[4:0];
822
            tdi_pad_i<=#1 wb_data[pointer];
823
            gen_clk(1);
824
 
825 88 mohor
          end
826
      end
827
 
828
 
829
    for(i=31; i>=0; i=i-1)      // crc
830
    begin
831
      tdi_pad_i<=#1 crc[i];
832
      gen_clk(1);
833
    end
834
 
835 92 mohor
    tdi_pad_i<=#1 1'hz;
836 90 mohor
 
837
 
838
 
839
    if ((last_wb_cmd == `WB_READ8) | (last_wb_cmd == `WB_READ16) | (last_wb_cmd == `WB_READ32))  // When WB_WRITEx was previously activated, data needs to be shifted.
840
      begin
841 95 mohor
        $display("\t\tGenerating %0d clocks to read %0d data bytes.", dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_limit, dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_limit>>3);
842
        for (i=0; i<(dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_limit); i=i+1)
843 92 mohor
          gen_clk(1);
844 90 mohor
      end
845
 
846
 
847 88 mohor
    gen_clk(`STATUS_LEN);   // Generating 4 clocks to read out status.
848
 
849
    for(i=0; i<`CRC_LEN -1; i=i+1)  // Getting in the CRC
850
    begin
851
      gen_clk(1);
852
    end
853
 
854
    tms_pad_i<=#1 1;
855
    gen_clk(1);         // to exit1_dr
856
 
857
    tms_pad_i<=#1 1;
858
    gen_clk(1);         // to update_dr
859 80 mohor
    tms_pad_i<=#1 0;
860 88 mohor
    gen_clk(1);         // to run_test_idle
861 2 mohor
  end
862 88 mohor
endtask       // debug_wishbone_go
863 2 mohor
 
864
 
865 88 mohor
 
866
 
867
 
868 93 mohor
task debug_wishbone_go_tmp;
869
  input [2:0]   command;
870
  input [31:0]  crc;
871
  integer i;
872
  reg   [4:0]   pointer;
873
 
874
  begin
875
    $display("(%0t) Task debug_wishbone_go_tmp (previous command was %0s): ", $time, last_wb_cmd_text);
876 88 mohor
 
877 93 mohor
    tms_pad_i<=#1 1;
878
    gen_clk(1);
879
    tms_pad_i<=#1 0;
880
    gen_clk(2);  // we are in shiftDR
881 88 mohor
 
882 93 mohor
    tdi_pad_i<=#1 1'b0; // chain_select bit = 0
883
    gen_clk(1);
884 88 mohor
 
885 93 mohor
    for(i=2; i>=0; i=i-1)
886
    begin
887
      tdi_pad_i<=#1 command[i]; // command
888
      gen_clk(1);
889
    end
890 88 mohor
 
891
 
892 93 mohor
    if ((last_wb_cmd == `WB_WRITE8) | (last_wb_cmd == `WB_WRITE16) | (last_wb_cmd == `WB_WRITE32))  // When WB_WRITEx was previously activated, data needs to be shifted.
893
      begin
894
        for (i=0; i<(dbg_tb.i_dbg_top.i_dbg_wb.len << 3); i=i+1)
895
          begin
896
            if (!(i%32))
897
              begin
898
                wb_data = wb_data + 32'h11111111;
899
                $display("\t\twb_data = 0x%x", wb_data);
900
              end
901
            pointer = 31-i[4:0];
902
            tdi_pad_i<=#1 wb_data[pointer];
903
            gen_clk(1);
904 2 mohor
 
905 93 mohor
          end
906
      end
907 2 mohor
 
908
 
909 93 mohor
    for(i=31; i>=0; i=i-1)      // crc
910
    begin
911
      tdi_pad_i<=#1 crc[i];
912
      gen_clk(1);
913
    end
914
 
915
    tdi_pad_i<=#1 1'hz;
916
 
917
 
918
 
919
    if ((last_wb_cmd == `WB_READ8) | (last_wb_cmd == `WB_READ16) | (last_wb_cmd == `WB_READ32))  // When WB_WRITEx was previously activated, data needs to be shifted.
920
      begin
921
        $display("\t\tGenerating %0d clocks to read %0d data bytes.", dbg_tb.i_dbg_top.i_dbg_wb.len << 3, dbg_tb.i_dbg_top.i_dbg_wb.len);
922
        $display("\t\tFirst half");
923
//        for (i=0; i<(dbg_tb.i_dbg_top.i_dbg_wb.len << 3); i=i+1)
924
 
925
        for (i=0; i<(dbg_tb.i_dbg_top.i_dbg_wb.len << 3)/2; i=i+1)
926
          begin
927
          gen_clk(1);
928
          end
929
 
930
        tms_pad_i<=#1 1;
931
        gen_clk(1);         // to exit1_dr
932
        tms_pad_i<=#1 0;
933
        gen_clk(1);         // to pause_dr
934
        gen_clk(1000);      // wait in pause_dr
935
        tms_pad_i<=#1 1;
936
        gen_clk(1);         // to exit2_dr
937
        tms_pad_i<=#1 0;    // to shift_dr
938
        gen_clk(1);
939
 
940
        $display("\t\tSecond half");
941
        for (i=0; i<(dbg_tb.i_dbg_top.i_dbg_wb.len << 3)/2; i=i+1)
942
          begin
943
          gen_clk(1);
944
          end
945
 
946
      end
947
 
948
 
949
    gen_clk(`STATUS_LEN);   // Generating 4 clocks to read out status.
950
 
951
    for(i=0; i<`CRC_LEN -1; i=i+1)  // Getting in the CRC
952
    begin
953
      gen_clk(1);
954
    end
955
 
956
    tms_pad_i<=#1 1;
957
    gen_clk(1);         // to exit1_dr
958
 
959
    tms_pad_i<=#1 1;
960
    gen_clk(1);         // to update_dr
961
    tms_pad_i<=#1 0;
962
    gen_clk(1);         // to run_test_idle
963
  end
964
endtask       // debug_wishbone_go_tmp
965
 
966
 
967
 
968
 
969
 
970
 
971
 
972
 
973
 
974
 
975
 
976
 
977
 
978 2 mohor
/**********************************************************************************
979
*                                                                                 *
980
*   Printing the information to the screen                                        *
981
*                                                                                 *
982
**********************************************************************************/
983
 
984 80 mohor
always @ (posedge tck_pad_i)
985 2 mohor
begin
986 80 mohor
  if(dbg_tb.i_tap_top.update_ir)
987
    case(dbg_tb.i_tap_top.jtag_ir[`IR_LENGTH-1:0])
988
      `EXTEST         : $display("\tInstruction EXTEST entered");
989
      `SAMPLE_PRELOAD : $display("\tInstruction SAMPLE_PRELOAD entered");
990
      `IDCODE         : $display("\tInstruction IDCODE entered");
991
      `MBIST          : $display("\tInstruction MBIST entered");
992
      `DEBUG          : $display("\tInstruction DEBUG entered");
993
      `BYPASS         : $display("\tInstruction BYPASS entered");
994
                default           :     $display("\n\tInstruction not valid. Instruction BYPASS activated !!!");
995 2 mohor
    endcase
996
end
997
 
998
 
999
 
1000
// Print shifted IDCode
1001 80 mohor
reg [31:0] tmp_data;
1002
always @ (posedge tck_pad_i)
1003 2 mohor
begin
1004 80 mohor
  if(dbg_tb.i_tap_top.idcode_select)
1005 2 mohor
    begin
1006 80 mohor
      if(dbg_tb.i_tap_top.shift_dr)
1007
        tmp_data[31:0]<=#1 {dbg_tb.tdo, tmp_data[31:1]};
1008 2 mohor
      else
1009 80 mohor
      if(dbg_tb.i_tap_top.update_dr)
1010
        if (tmp_data[31:0] != `IDCODE_VALUE)
1011 73 mohor
          begin
1012
            $display("(%0t) ERROR: IDCODE not correct", $time);
1013
            $stop;
1014
          end
1015
        else
1016 80 mohor
          $display("\t\tIDCode = 0x%h", tmp_data[31:0]);
1017 2 mohor
    end
1018
end
1019
 
1020
 
1021 80 mohor
// We never use following states: exit2_ir,  exit2_dr,  pause_ir or pause_dr
1022
always @ (posedge tck_pad_i)
1023 2 mohor
begin
1024 80 mohor
  if(dbg_tb.i_tap_top.pause_ir | dbg_tb.i_tap_top.exit2_ir)
1025 2 mohor
    begin
1026 80 mohor
      $display("\n(%0t) ERROR: State pause_ir or exit2_ir detected.", $time);
1027
      $display("(%0t) Simulation stopped !!!", $time);
1028
      $stop;
1029 2 mohor
    end
1030
end
1031
 
1032
 
1033 80 mohor
// sets the selected scan chain and goes to the RunTestIdle state
1034
task xxx;
1035
  input [3:0]  data;
1036
  input [31:0] crc;
1037
  integer i;
1038
 
1039
  begin
1040
    $display("(%0t) Task xxx", $time);
1041
    tms_pad_i<=#1 1;
1042
    gen_clk(1);
1043
    tms_pad_i<=#1 0;
1044
    gen_clk(2);  // we are in shiftDR
1045
 
1046
    for(i=0; i<4; i=i+1)
1047 73 mohor
    begin
1048 80 mohor
      tdi_pad_i<=#1 data[i];
1049
      gen_clk(1);
1050 73 mohor
    end
1051
 
1052 80 mohor
    for(i=0; i<`CRC_LEN; i=i+1)
1053
    begin
1054
      tdi_pad_i<=#1 crc[`CRC_LEN - 1 - i];
1055
      gen_clk(1);
1056
    end
1057 73 mohor
 
1058 80 mohor
    gen_clk(`STATUS_LEN);   // Generating 5 clocks to read out status.
1059 73 mohor
 
1060
 
1061 80 mohor
    for(i=0; i<`CRC_LEN -1; i=i+1)
1062
    begin
1063
      tdi_pad_i<=#1 1'b0;
1064
      gen_clk(1);
1065
    end
1066 73 mohor
 
1067 80 mohor
    tdi_pad_i<=#1 crc[i]; // last crc
1068
    tms_pad_i<=#1 1;
1069
    gen_clk(1);         // to exit1_dr
1070 73 mohor
 
1071 80 mohor
    tdi_pad_i<=#1 'hz;  // tri-state
1072
    tms_pad_i<=#1 1;
1073
    gen_clk(1);         // to update_dr
1074
    tms_pad_i<=#1 0;
1075
    gen_clk(1);         // to run_test_idle
1076
  end
1077
endtask
1078 2 mohor
 
1079
 
1080 88 mohor
// Printing CRC
1081
//always @ (posedge dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_end)
1082
always @ (posedge dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_end or posedge dbg_tb.i_dbg_top.i_dbg_wb.addr_len_cnt_end)
1083
begin
1084
  #2;
1085
  if (dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_end & dbg_tb.i_dbg_top.i_dbg_wb.addr_len_cnt_end)
1086
    tmp_crc = dbg_tb.i_dbg_top.i_dbg_crc32_d1_in.crc;
1087
end
1088 80 mohor
 
1089
 
1090 88 mohor
// Detecting CRC error
1091
always @ (posedge dbg_tb.i_dbg_top.i_dbg_wb.crc_cnt_end)
1092
begin
1093
  #2;
1094
  if (~dbg_tb.i_dbg_top.crc_match)
1095
    begin
1096
      $display("\t\tCRC ERROR !!!");
1097
      $display("\t\tCRC needed (%0s) = 0x%0x , shifted_in = 0x%0x", test_text, tmp_crc, shifted_in_crc);
1098 90 mohor
      $stop;
1099 88 mohor
    end
1100
end
1101 80 mohor
 
1102 88 mohor
 
1103 90 mohor
 
1104
// Detecting errors in counters
1105
always @ (dbg_tb.i_dbg_top.i_dbg_wb.cmd_cnt or
1106
          dbg_tb.i_dbg_top.i_dbg_wb.cmd_cnt_end or
1107
          dbg_tb.i_dbg_top.i_dbg_wb.addr_len_cnt or
1108
          dbg_tb.i_dbg_top.i_dbg_wb.addr_len_cnt_end or
1109
          dbg_tb.i_dbg_top.i_dbg_wb.data_cnt or
1110
          dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_end or
1111
          dbg_tb.i_dbg_top.i_dbg_wb.cmd_cnt_en or
1112
          dbg_tb.i_dbg_top.i_dbg_wb.addr_len_cnt_en or
1113
          dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_en or
1114
          dbg_tb.i_dbg_top.i_dbg_wb.crc_cnt_en or
1115
          dbg_tb.i_dbg_top.i_dbg_wb.status_cnt1
1116
          //dbg_tb.i_dbg_top.i_dbg_wb.status_cnt2 or
1117
          //dbg_tb.i_dbg_top.i_dbg_wb.status_cnt3 or
1118
          //dbg_tb.i_dbg_top.i_dbg_wb.status_cnt4
1119
          // dbg_tb.i_dbg_top.i_dbg_wb. or
1120
         )
1121
begin
1122
  if ((~dbg_tb.i_dbg_top.i_dbg_wb.cmd_cnt_end) & (
1123
                                                  dbg_tb.i_dbg_top.i_dbg_wb.addr_len_cnt_en |
1124
                                                  dbg_tb.i_dbg_top.i_dbg_wb.data_cnt_en     |
1125
                                                  dbg_tb.i_dbg_top.i_dbg_wb.crc_cnt_en      |
1126
                                                  dbg_tb.i_dbg_top.i_dbg_wb.status_cnt1
1127
                                                 )
1128
     )
1129
    begin
1130
      $display("\n\n\t\t(%0t) ERROR in counters !!!", $time);
1131
      #10000;
1132
      $stop;
1133
    end
1134
 
1135
 
1136
 
1137
end
1138
 
1139
 
1140
 
1141
 
1142
 
1143 91 mohor
 
1144 80 mohor
endmodule // dbg_tb
1145
 
1146
 

powered by: WebSVN 2.1.0

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