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 93

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

powered by: WebSVN 2.1.0

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