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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [dbg_if/] [dbg_wb.v] - Blame information for rev 360

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

Line No. Rev Author Line
1 6 julius
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  dbg_wb.v                                                    ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC Debug Interface.               ////
7
////  http://www.opencores.org/projects/DebugInterface/           ////
8
////                                                              ////
9
////  Author(s):                                                  ////
10
////       Igor Mohor (igorm@opencores.org)                       ////
11
////                                                              ////
12
////                                                              ////
13
////  All additional information is avaliable in the README.txt   ////
14
////  file.                                                       ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2000 - 2004 Authors                            ////
19
////                                                              ////
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: dbg_wb.v,v $
46
// Revision 1.23  2004/04/01 17:21:22  igorm
47
// Changes for the FormalPRO.
48
//
49
// Revision 1.22  2004/04/01 11:56:59  igorm
50
// Port names and defines for the supported CPUs changed.
51
//
52
// Revision 1.21  2004/03/31 14:34:09  igorm
53
// data_cnt_lim length changed to reduce number of warnings.
54
//
55
// Revision 1.20  2004/03/28 20:27:02  igorm
56
// New release of the debug interface (3rd. release).
57
//
58
// Revision 1.19  2004/03/22 16:35:46  igorm
59
// Temp version before changing dbg interface.
60
//
61
// Revision 1.18  2004/01/25 14:04:18  mohor
62
// All flipflops are reset.
63
//
64
// Revision 1.17  2004/01/22 13:58:53  mohor
65
// Port signals are all set to zero after reset.
66
//
67
// Revision 1.16  2004/01/19 07:32:41  simons
68
// Reset values width added because of FV, a good sentence changed because some tools can not handle it.
69
//
70
// Revision 1.15  2004/01/17 18:01:24  mohor
71
// New version.
72
//
73
// Revision 1.14  2004/01/16 14:51:33  mohor
74
// cpu registers added.
75
//
76
// Revision 1.13  2004/01/15 12:09:43  mohor
77
// Working.
78
//
79
// Revision 1.12  2004/01/14 22:59:18  mohor
80
// Temp version.
81
//
82
// Revision 1.11  2004/01/14 12:29:40  mohor
83
// temp version. Resets will be changed in next version.
84
//
85
// Revision 1.10  2004/01/13 11:28:14  mohor
86
// tmp version.
87
//
88
// Revision 1.9  2004/01/10 07:50:24  mohor
89
// temp version.
90
//
91
// Revision 1.8  2004/01/09 12:48:44  mohor
92
// tmp version.
93
//
94
// Revision 1.7  2004/01/08 17:53:36  mohor
95
// tmp version.
96
//
97
// Revision 1.6  2004/01/07 11:58:56  mohor
98
// temp4 version.
99
//
100
// Revision 1.5  2004/01/06 17:15:19  mohor
101
// temp3 version.
102
//
103
// Revision 1.4  2004/01/05 12:16:00  mohor
104
// tmp2 version.
105
//
106
// Revision 1.3  2003/12/23 16:22:46  mohor
107
// Tmp version.
108
//
109
// Revision 1.2  2003/12/23 15:26:26  mohor
110
// Small fix.
111
//
112
// Revision 1.1  2003/12/23 15:09:04  mohor
113
// New directory structure. New version of the debug interface.
114
//
115
//
116
//
117
 
118
// synopsys translate_off
119
`include "timescale.v"
120
// synopsys translate_on
121
`include "dbg_wb_defines.v"
122
 
123
// Top module
124
module dbg_wb(
125
                // JTAG signals
126
                tck_i,
127
                tdi_i,
128
                tdo_o,
129
 
130
                // TAP states
131
                shift_dr_i,
132
                pause_dr_i,
133
                update_dr_i,
134
 
135
                wishbone_ce_i,
136
                crc_match_i,
137
                crc_en_o,
138
                shift_crc_o,
139
                rst_i,
140
 
141
                // WISHBONE common signals
142
                wb_clk_i,
143
 
144
                // WISHBONE master interface
145
                wb_adr_o, wb_dat_o, wb_dat_i, wb_cyc_o, wb_stb_o, wb_sel_o,
146
                wb_we_o, wb_ack_i, wb_cab_o, wb_err_i, wb_cti_o, wb_bte_o
147
 
148
              );
149
 
150
// JTAG signals
151
input         tck_i;
152
input         tdi_i;
153
output        tdo_o;
154
 
155
// TAP states
156
input         shift_dr_i;
157
input         pause_dr_i;
158
input         update_dr_i;
159
 
160
input         wishbone_ce_i;
161
input         crc_match_i;
162
output        crc_en_o;
163
output        shift_crc_o;
164
input         rst_i;
165
// WISHBONE common signals
166
input         wb_clk_i;
167
 
168
// WISHBONE master interface
169
output [31:0] wb_adr_o;
170
output [31:0] wb_dat_o;
171
input  [31:0] wb_dat_i;
172
output        wb_cyc_o;
173
output        wb_stb_o;
174
output  [3:0] wb_sel_o;
175
output        wb_we_o;
176
input         wb_ack_i;
177
output        wb_cab_o;
178
input         wb_err_i;
179
output  [2:0] wb_cti_o;
180
output  [1:0] wb_bte_o;
181
 
182
reg           wb_cyc_o;
183
 
184
reg           tdo_o;
185
 
186
reg    [31:0] wb_dat_tmp, wb_dat_dsff;
187
reg    [31:0] wb_adr_dsff;
188
reg     [3:0] wb_sel_dsff;
189
reg           wb_we_dsff;
190
reg    [`DBG_WB_DR_LEN -1 :0] dr;
191
wire          enable;
192
wire          cmd_cnt_en;
193
reg     [`DBG_WB_CMD_CNT_WIDTH -1:0] cmd_cnt;
194
wire          cmd_cnt_end;
195
reg           cmd_cnt_end_q;
196
reg           addr_len_cnt_en;
197
reg     [5:0] addr_len_cnt;
198
wire          addr_len_cnt_end;
199
reg           addr_len_cnt_end_q;
200
reg           crc_cnt_en;
201
reg     [`DBG_WB_CRC_CNT_WIDTH -1:0] crc_cnt;
202
wire          crc_cnt_end;
203
reg           crc_cnt_end_q;
204
reg           data_cnt_en;
205
reg    [`DBG_WB_DATA_CNT_WIDTH:0] data_cnt;
206
reg    [`DBG_WB_DATA_CNT_LIM_WIDTH:0] data_cnt_limit;
207
wire          data_cnt_end;
208
reg           data_cnt_end_q;
209
 
210
reg           crc_match_reg;
211
 
212
reg    [`DBG_WB_ACC_TYPE_LEN -1:0] acc_type;
213
reg    [`DBG_WB_ADR_LEN -1:0] adr;
214
reg    [`DBG_WB_LEN_LEN -1:0] len;
215
reg    [`DBG_WB_LEN_LEN:0]    len_var;
216
reg           start_rd_tck;
217
reg           rd_tck_started;
218
reg           start_rd_csff;
219
reg           start_wb_rd;
220
reg           start_wb_rd_q;
221
reg           start_wr_tck;
222
reg           start_wr_csff;
223
reg           start_wb_wr;
224
reg           start_wb_wr_q;
225
 
226
reg           status_cnt_en;
227
wire          status_cnt_end;
228
 
229
wire          byte, half, long;
230
reg           byte_q, half_q, long_q;
231
 
232
reg [`DBG_WB_STATUS_CNT_WIDTH -1:0] status_cnt;
233
 
234
reg [`DBG_WB_STATUS_LEN -1:0] status;
235
 
236
reg           wb_error, wb_error_csff, wb_error_tck;
237
reg           wb_overrun, wb_overrun_csff, wb_overrun_tck;
238
reg           underrun_tck;
239
 
240
reg           busy_wb;
241
reg           busy_tck;
242
reg           wb_end;
243
reg           wb_end_rst;
244
reg           wb_end_rst_csff;
245
reg           wb_end_csff;
246
reg           wb_end_tck, wb_end_tck_q;
247
reg           busy_csff;
248
reg           latch_data;
249
reg           update_dr_csff, update_dr_wb;
250
 
251
reg           set_addr, set_addr_csff, set_addr_wb, set_addr_wb_q;
252
wire   [31:0] input_data;
253
 
254
wire          len_eq_0;
255
wire          crc_cnt_31;
256
 
257
reg     [1:0] ptr;
258
reg     [2:0] fifo_cnt;
259
wire          fifo_full;
260
wire          fifo_empty;
261
reg     [7:0] mem [0:3];
262
reg     [2:0] mem_ptr_dsff;
263
reg           wishbone_ce_csff;
264
reg           mem_ptr_init;
265
reg [`DBG_WB_CMD_LEN -1: 0] curr_cmd;
266
wire          curr_cmd_go;
267
reg           curr_cmd_go_q;
268
wire          curr_cmd_wr_comm;
269
wire          curr_cmd_rd_comm;
270
wire          acc_type_read;
271
wire          acc_type_write;
272
wire          acc_type_8bit;
273
wire          acc_type_16bit;
274
wire          acc_type_32bit;
275
 
276
 
277
assign enable = wishbone_ce_i & shift_dr_i;
278
assign crc_en_o = enable & crc_cnt_end & (~status_cnt_end);
279
assign shift_crc_o = enable & status_cnt_end;  // Signals dbg module to shift out the CRC
280
 
281
assign curr_cmd_go      = (curr_cmd == `DBG_WB_GO) && cmd_cnt_end;
282
assign curr_cmd_wr_comm = (curr_cmd == `DBG_WB_WR_COMM) && cmd_cnt_end;
283
assign curr_cmd_rd_comm = (curr_cmd == `DBG_WB_RD_COMM) && cmd_cnt_end;
284
 
285
assign acc_type_read    = (acc_type == `DBG_WB_READ8  || acc_type == `DBG_WB_READ16  || acc_type == `DBG_WB_READ32);
286
assign acc_type_write   = (acc_type == `DBG_WB_WRITE8 || acc_type == `DBG_WB_WRITE16 || acc_type == `DBG_WB_WRITE32);
287
 
288
assign acc_type_8bit    = (acc_type == `DBG_WB_READ8  || acc_type == `DBG_WB_WRITE8);
289
assign acc_type_16bit   = (acc_type == `DBG_WB_READ16 || acc_type == `DBG_WB_WRITE16);
290
assign acc_type_32bit   = (acc_type == `DBG_WB_READ32 || acc_type == `DBG_WB_WRITE32);
291
 
292
 
293
// Selecting where to take the data from
294
always @ (posedge tck_i or posedge rst_i)
295
begin
296
  if (rst_i)
297 360 julius
    ptr <=  2'h0;
298 6 julius
  else if (update_dr_i)
299 360 julius
    ptr <=  2'h0;
300 6 julius
  else if (curr_cmd_go && acc_type_read && crc_cnt_31) // first latch
301 360 julius
    ptr <=  ptr + 1'b1;
302 6 julius
  else if (curr_cmd_go && acc_type_read && byte && (!byte_q))
303
    ptr <= ptr + 1'd1;
304
end
305
 
306
 
307
// Shift register for shifting in and out the data
308
always @ (posedge tck_i or posedge rst_i)
309
begin
310
  if (rst_i)
311
    begin
312 360 julius
      latch_data <=  1'b0;
313
      dr <=  {`DBG_WB_DR_LEN{1'b0}};
314 6 julius
    end
315
  else if (curr_cmd_rd_comm && crc_cnt_31)  // Latching data (from iternal regs)
316
    begin
317 360 julius
      dr[`DBG_WB_ACC_TYPE_LEN + `DBG_WB_ADR_LEN + `DBG_WB_LEN_LEN -1:0] <=  {acc_type, adr, len};
318 6 julius
    end
319
  else if (acc_type_read && curr_cmd_go && crc_cnt_31)  // Latchind first data (from WB)
320
    begin
321 360 julius
      dr[31:0] <=  input_data[31:0];
322
      latch_data <=  1'b1;
323 6 julius
    end
324
  else if (acc_type_read && curr_cmd_go && crc_cnt_end) // Latching data (from WB)
325
    begin
326
      if (acc_type == `DBG_WB_READ8)
327
        begin
328
          if(byte & (~byte_q))
329
            begin
330
              case (ptr)    // synthesis parallel_case
331 360 julius
                2'b00 : dr[31:24] <=  input_data[31:24];
332
                2'b01 : dr[31:24] <=  input_data[23:16];
333
                2'b10 : dr[31:24] <=  input_data[15:8];
334
                2'b11 : dr[31:24] <=  input_data[7:0];
335 6 julius
              endcase
336 360 julius
              latch_data <=  1'b1;
337 6 julius
            end
338
          else
339
            begin
340 46 julius
               if (enable) // jb
341 360 julius
                 dr[31:24] <=  {dr[30:24], 1'b0};
342
              latch_data <=  1'b0;
343 6 julius
            end
344
        end
345
      else if (acc_type == `DBG_WB_READ16)
346
        begin
347
          if(half & (~half_q))
348
            begin
349
              if (ptr[1])
350 360 julius
                dr[31:16] <=  input_data[15:0];
351 6 julius
              else
352 360 julius
                dr[31:16] <=  input_data[31:16];
353
              latch_data <=  1'b1;
354 6 julius
            end
355
          else
356
            begin
357 46 julius
               if (enable) // jb
358 360 julius
                 dr[31:16] <=  {dr[30:16], 1'b0};
359
              latch_data <=  1'b0;
360 6 julius
            end
361
        end
362
      else if (acc_type == `DBG_WB_READ32)
363
        begin
364
          if(long & (~long_q))
365
            begin
366 360 julius
              dr[31:0] <=  input_data[31:0];
367
              latch_data <=  1'b1;
368 6 julius
            end
369
          else
370
            begin
371 46 julius
               if (enable) // jb
372 360 julius
                 dr[31:0] <=  {dr[30:0], 1'b0};
373
              latch_data <=  1'b0;
374 6 julius
            end
375
        end
376
    end
377
  else if (enable && (!addr_len_cnt_end))
378
    begin
379 360 julius
      dr <=  {dr[`DBG_WB_DR_LEN -2:0], tdi_i};
380 6 julius
    end
381
end
382
 
383
 
384
 
385
assign cmd_cnt_en = enable & (~cmd_cnt_end);
386
 
387
 
388
// Command counter
389
always @ (posedge tck_i or posedge rst_i)
390
begin
391
  if (rst_i)
392 360 julius
    cmd_cnt <=  {`DBG_WB_CMD_CNT_WIDTH{1'b0}};
393 6 julius
  else if (update_dr_i)
394 360 julius
    cmd_cnt <=  {`DBG_WB_CMD_CNT_WIDTH{1'b0}};
395 6 julius
  else if (cmd_cnt_en)
396 360 julius
    cmd_cnt <=  cmd_cnt + 1'b1;
397 6 julius
end
398
 
399
 
400
// Assigning current command
401
always @ (posedge tck_i or posedge rst_i)
402
begin
403
  if (rst_i)
404 360 julius
    curr_cmd <=  {`DBG_WB_CMD_LEN{1'b0}};
405 6 julius
  else if (update_dr_i)
406 360 julius
    curr_cmd <=  {`DBG_WB_CMD_LEN{1'b0}};
407 6 julius
  else if (cmd_cnt == (`DBG_WB_CMD_LEN -1))
408 360 julius
    curr_cmd <=  {dr[`DBG_WB_CMD_LEN-2 :0], tdi_i};
409 6 julius
end
410
 
411
 
412
// Assigning current command
413
always @ (posedge tck_i or posedge rst_i)
414
begin
415
  if (rst_i)
416 360 julius
    curr_cmd_go_q <=  1'b0;
417 6 julius
  else
418 360 julius
    curr_cmd_go_q <=  curr_cmd_go;
419 6 julius
end
420
 
421
 
422
always @ (enable or cmd_cnt_end or addr_len_cnt_end or curr_cmd_wr_comm or curr_cmd_rd_comm or crc_cnt_end)
423
begin
424
  if (enable && (!addr_len_cnt_end))
425
    begin
426
      if (cmd_cnt_end && curr_cmd_wr_comm)
427
        addr_len_cnt_en = 1'b1;
428
      else if (crc_cnt_end && curr_cmd_rd_comm)
429
        addr_len_cnt_en = 1'b1;
430
      else
431
        addr_len_cnt_en = 1'b0;
432
    end
433
  else
434
    addr_len_cnt_en = 1'b0;
435
end
436
 
437
 
438
// Address/length counter
439
always @ (posedge tck_i or posedge rst_i)
440
begin
441
  if (rst_i)
442 360 julius
    addr_len_cnt <=  6'h0;
443 6 julius
  else if (update_dr_i)
444 360 julius
    addr_len_cnt <=  6'h0;
445 6 julius
  else if (addr_len_cnt_en)
446 360 julius
    addr_len_cnt <=  addr_len_cnt + 1'b1;
447 6 julius
end
448
 
449
 
450
always @ (enable or data_cnt_end or cmd_cnt_end or curr_cmd_go or acc_type_write or acc_type_read or crc_cnt_end)
451
begin
452
  if (enable && (!data_cnt_end))
453
    begin
454
      if (cmd_cnt_end && curr_cmd_go && acc_type_write)
455
        data_cnt_en = 1'b1;
456
      else if (crc_cnt_end && curr_cmd_go && acc_type_read)
457
        data_cnt_en = 1'b1;
458
      else
459
        data_cnt_en = 1'b0;
460
    end
461
  else
462
    data_cnt_en = 1'b0;
463
end
464
 
465
 
466
// Data counter
467
always @ (posedge tck_i or posedge rst_i)
468
begin
469
  if (rst_i)
470 360 julius
    data_cnt <=  {`DBG_WB_DATA_CNT_WIDTH{1'b0}};
471 6 julius
  else if (update_dr_i)
472 360 julius
    data_cnt <=  {`DBG_WB_DATA_CNT_WIDTH{1'b0}};
473 6 julius
  else if (data_cnt_en)
474 360 julius
    data_cnt <=  data_cnt + 1'b1;
475 6 julius
end
476
 
477
 
478
 
479
// Upper limit. Data counter counts until this value is reached.
480
always @ (posedge tck_i or posedge rst_i)
481
begin
482
  if (rst_i)
483 360 julius
    data_cnt_limit <=  {`DBG_WB_DATA_CNT_LIM_WIDTH{1'b0}};
484 6 julius
  else if (update_dr_i)
485 360 julius
    data_cnt_limit <=  len + 1'b1;
486 6 julius
end
487
 
488
 
489
always @ (enable or crc_cnt_end or curr_cmd_rd_comm or curr_cmd_wr_comm or curr_cmd_go or addr_len_cnt_end or data_cnt_end or acc_type_write or acc_type_read or cmd_cnt_end)
490
begin
491
  if (enable && (!crc_cnt_end) && cmd_cnt_end)
492
    begin
493
      if (addr_len_cnt_end && curr_cmd_wr_comm)
494
        crc_cnt_en = 1'b1;
495
      else if (data_cnt_end && curr_cmd_go && acc_type_write)
496
        crc_cnt_en = 1'b1;
497
      else if (cmd_cnt_end && (curr_cmd_go && acc_type_read || curr_cmd_rd_comm))
498
        crc_cnt_en = 1'b1;
499
      else
500
        crc_cnt_en = 1'b0;
501
    end
502
  else
503
    crc_cnt_en = 1'b0;
504
end
505 46 julius
 
506 6 julius
 
507
// crc counter
508
always @ (posedge tck_i or posedge rst_i)
509
begin
510
  if (rst_i)
511 360 julius
    crc_cnt <=  {`DBG_WB_CRC_CNT_WIDTH{1'b0}};
512 6 julius
  else if(crc_cnt_en)
513 360 julius
    crc_cnt <=  crc_cnt + 1'b1;
514 6 julius
  else if (update_dr_i)
515 360 julius
    crc_cnt <=  {`DBG_WB_CRC_CNT_WIDTH{1'b0}};
516 6 julius
end
517
 
518
assign cmd_cnt_end      = cmd_cnt      == `DBG_WB_CMD_LEN;
519
assign addr_len_cnt_end = addr_len_cnt == `DBG_WB_DR_LEN;
520
assign crc_cnt_end      = crc_cnt      == `DBG_WB_CRC_CNT_WIDTH'd32;
521
assign crc_cnt_31       = crc_cnt      == `DBG_WB_CRC_CNT_WIDTH'd31;
522
assign data_cnt_end     = (data_cnt    == {data_cnt_limit, 3'b000});
523
 
524
always @ (posedge tck_i or posedge rst_i)
525
begin
526
  if (rst_i)
527
    begin
528 360 julius
      crc_cnt_end_q       <=  1'b0;
529
      cmd_cnt_end_q       <=  1'b0;
530
      data_cnt_end_q      <=  1'b0;
531
      addr_len_cnt_end_q  <=  1'b0;
532 6 julius
    end
533
  else
534
    begin
535 360 julius
      crc_cnt_end_q       <=  crc_cnt_end;
536
      cmd_cnt_end_q       <=  cmd_cnt_end;
537
      data_cnt_end_q      <=  data_cnt_end;
538
      addr_len_cnt_end_q  <=  addr_len_cnt_end;
539 6 julius
    end
540
end
541
 
542
 
543
// Status counter is made of 4 serialy connected registers
544
always @ (posedge tck_i or posedge rst_i)
545
begin
546
  if (rst_i)
547 360 julius
    status_cnt <=  {`DBG_WB_STATUS_CNT_WIDTH{1'b0}};
548 6 julius
  else if (update_dr_i)
549 360 julius
    status_cnt <=  {`DBG_WB_STATUS_CNT_WIDTH{1'b0}};
550 6 julius
  else if (status_cnt_en)
551 360 julius
    status_cnt <=  status_cnt + 1'b1;
552 6 julius
end
553
 
554
 
555
always @ (enable or status_cnt_end or crc_cnt_end or curr_cmd_rd_comm or curr_cmd_wr_comm or curr_cmd_go or acc_type_write or acc_type_read or data_cnt_end or addr_len_cnt_end)
556
begin
557
  if (enable && (!status_cnt_end))
558
    begin
559
      if (crc_cnt_end && curr_cmd_wr_comm)
560
        status_cnt_en = 1'b1;
561
      else if (crc_cnt_end && curr_cmd_go && acc_type_write)
562
        status_cnt_en = 1'b1;
563
      else if (data_cnt_end && curr_cmd_go && acc_type_read)
564
        status_cnt_en = 1'b1;
565
      else if (addr_len_cnt_end && curr_cmd_rd_comm)
566
        status_cnt_en = 1'b1;
567
      else
568
        status_cnt_en = 1'b0;
569
    end
570
  else
571
    status_cnt_en = 1'b0;
572
end
573
 
574
 
575
assign status_cnt_end = status_cnt == `DBG_WB_STATUS_LEN;
576
 
577
 
578
// Latching acc_type, address and length
579
always @ (posedge tck_i or posedge rst_i)
580
begin
581
  if (rst_i)
582
    begin
583 360 julius
      acc_type  <=  {`DBG_WB_ACC_TYPE_LEN{1'b0}};
584
      adr       <=  {`DBG_WB_ADR_LEN{1'b0}};
585
      len       <=  {`DBG_WB_LEN_LEN{1'b0}};
586
      set_addr  <=  1'b0;
587 6 julius
    end
588
  else if(crc_cnt_end && (!crc_cnt_end_q) && crc_match_i && curr_cmd_wr_comm)
589
    begin
590 360 julius
      acc_type  <=  dr[`DBG_WB_ACC_TYPE_LEN + `DBG_WB_ADR_LEN + `DBG_WB_LEN_LEN -1 : `DBG_WB_ADR_LEN + `DBG_WB_LEN_LEN];
591
      adr       <=  dr[`DBG_WB_ADR_LEN + `DBG_WB_LEN_LEN -1 : `DBG_WB_LEN_LEN];
592
      len       <=  dr[`DBG_WB_LEN_LEN -1:0];
593
      set_addr  <=  1'b1;
594 6 julius
    end
595
  else if(wb_end_tck)               // Writing back the address
596
    begin
597 360 julius
      adr  <=  wb_adr_dsff;
598 6 julius
    end
599
  else
600 360 julius
    set_addr <=  1'b0;
601 6 julius
end
602
 
603
 
604
always @ (posedge tck_i or posedge rst_i)
605
begin
606
  if (rst_i)
607 360 julius
    crc_match_reg <=  1'b0;
608 6 julius
  else if(crc_cnt_end & (~crc_cnt_end_q))
609 360 julius
    crc_match_reg <=  crc_match_i;
610 6 julius
end
611
 
612
// Length counter
613
always @ (posedge tck_i or posedge rst_i)
614
begin
615
  if (rst_i)
616 360 julius
    len_var <=  {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
617 6 julius
  else if(update_dr_i)
618 360 julius
    len_var <=  len + 1'b1;
619 6 julius
  else if (start_rd_tck)
620
    begin
621
      case (acc_type)  // synthesis parallel_case
622
        `DBG_WB_READ8 :
623
                    if (len_var > 'd1)
624 360 julius
                      len_var <=  len_var - 1'd1;
625 6 julius
                    else
626 360 julius
                      len_var <=  {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
627 6 julius
        `DBG_WB_READ16:
628
                    if (len_var > 'd2)
629 360 julius
                      len_var <=  len_var - 2'd2;
630 6 julius
                    else
631 360 julius
                      len_var <=  {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
632 6 julius
        `DBG_WB_READ32:
633
                    if (len_var > 'd4)
634 360 julius
                      len_var <=  len_var - 3'd4;
635 6 julius
                    else
636 360 julius
                      len_var <=  {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
637
        default:      len_var <=  {1'bx, {`DBG_WB_LEN_LEN{1'bx}}};
638 6 julius
      endcase
639
    end
640
end
641
 
642
 
643
assign len_eq_0 = len_var == 'h0;
644
 
645
 
646
assign byte = data_cnt[2:0] == 3'd7;
647
assign half = data_cnt[3:0] == 4'd15;
648
assign long = data_cnt[4:0] == 5'd31;
649
 
650
 
651
always @ (posedge tck_i or posedge rst_i)
652
begin
653
  if (rst_i)
654
    begin
655 360 julius
      byte_q <=   1'b0;
656
      half_q <=   1'b0;
657
      long_q <=   1'b0;
658 6 julius
    end
659
  else
660
    begin
661 360 julius
      byte_q <=  byte;
662
      half_q <=  half;
663
      long_q <=  long;
664 6 julius
    end
665
end
666
 
667
 
668
// Start wishbone write cycle
669
always @ (posedge tck_i or posedge rst_i)
670
begin
671
  if (rst_i)
672
    begin
673 360 julius
      start_wr_tck <=  1'b0;
674
      wb_dat_tmp <=  32'h0;
675 6 julius
    end
676
  else if (curr_cmd_go && acc_type_write)
677
    begin
678
      case (acc_type)  // synthesis parallel_case full_case
679
        `DBG_WB_WRITE8  : begin
680
                        if (byte_q)
681
                          begin
682 360 julius
                            start_wr_tck <=  1'b1;
683
                            wb_dat_tmp <=  {4{dr[7:0]}};
684 6 julius
                          end
685
                        else
686
                          begin
687 360 julius
                            start_wr_tck <=  1'b0;
688 6 julius
                          end
689
                      end
690
        `DBG_WB_WRITE16 : begin
691
                        if (half_q)
692
                          begin
693 360 julius
                            start_wr_tck <=  1'b1;
694
                            wb_dat_tmp <=  {2{dr[15:0]}};
695 6 julius
                          end
696
                        else
697
                          begin
698 360 julius
                            start_wr_tck <=  1'b0;
699 6 julius
                          end
700
                      end
701
        `DBG_WB_WRITE32 : begin
702
                        if (long_q)
703
                          begin
704 360 julius
                            start_wr_tck <=  1'b1;
705
                            wb_dat_tmp <=  dr[31:0];
706 6 julius
                          end
707
                        else
708
                          begin
709 360 julius
                            start_wr_tck <=  1'b0;
710 6 julius
                          end
711
                      end
712
      endcase
713
    end
714
  else
715 360 julius
    start_wr_tck <=  1'b0;
716 6 julius
end
717
 
718
 
719
// wb_dat_o in WB clk domain
720
always @ (posedge wb_clk_i)
721
begin
722 360 julius
  wb_dat_dsff <=  wb_dat_tmp;
723 6 julius
end
724
 
725
assign wb_dat_o = wb_dat_dsff;
726
 
727
 
728
// Start wishbone read cycle
729
always @ (posedge tck_i or posedge rst_i)
730
begin
731
  if (rst_i)
732 360 julius
    start_rd_tck <=  1'b0;
733 6 julius
  else if (curr_cmd_go && (!curr_cmd_go_q) && acc_type_read)              // First read after cmd is entered
734 360 julius
    start_rd_tck <=  1'b1;
735 6 julius
  else if ((!start_rd_tck) && curr_cmd_go && acc_type_read  && (!len_eq_0) && (!fifo_full) && (!rd_tck_started))
736 360 julius
    start_rd_tck <=  1'b1;
737 6 julius
  else
738 360 julius
    start_rd_tck <=  1'b0;
739 6 julius
end
740
 
741
 
742
always @ (posedge tck_i or posedge rst_i)
743
begin
744
  if (rst_i)
745 360 julius
    rd_tck_started <=  1'b0;
746 6 julius
  else if (update_dr_i || wb_end_tck && (!wb_end_tck_q))
747 360 julius
    rd_tck_started <=  1'b0;
748 6 julius
  else if (start_rd_tck)
749 360 julius
    rd_tck_started <=  1'b1;
750 6 julius
end
751
 
752
 
753
 
754
always @ (posedge wb_clk_i or posedge rst_i)
755
begin
756
  if (rst_i)
757
    begin
758 360 julius
      start_rd_csff   <=  1'b0;
759
      start_wb_rd     <=  1'b0;
760
      start_wb_rd_q   <=  1'b0;
761 6 julius
 
762 360 julius
      start_wr_csff   <=  1'b0;
763
      start_wb_wr     <=  1'b0;
764
      start_wb_wr_q   <=  1'b0;
765 6 julius
 
766 360 julius
      set_addr_csff   <=  1'b0;
767
      set_addr_wb     <=  1'b0;
768
      set_addr_wb_q   <=  1'b0;
769 6 julius
    end
770
  else
771
    begin
772 360 julius
      start_rd_csff   <=  start_rd_tck;
773
      start_wb_rd     <=  start_rd_csff;
774
      start_wb_rd_q   <=  start_wb_rd;
775 6 julius
 
776 360 julius
      start_wr_csff   <=  start_wr_tck;
777
      start_wb_wr     <=  start_wr_csff;
778
      start_wb_wr_q   <=  start_wb_wr;
779 6 julius
 
780 360 julius
      set_addr_csff   <=  set_addr;
781
      set_addr_wb     <=  set_addr_csff;
782
      set_addr_wb_q   <=  set_addr_wb;
783 6 julius
    end
784
end
785
 
786
 
787
// wb_cyc_o
788
always @ (posedge wb_clk_i or posedge rst_i)
789
begin
790
  if (rst_i)
791 360 julius
    wb_cyc_o <=  1'b0;
792 6 julius
  else if ((start_wb_wr && (!start_wb_wr_q)) || (start_wb_rd && (!start_wb_rd_q)))
793 360 julius
    wb_cyc_o <=  1'b1;
794 6 julius
  else if (wb_ack_i || wb_err_i)
795 360 julius
    wb_cyc_o <=  1'b0;
796 6 julius
end
797
 
798
 
799
// wb_adr_o logic
800
always @ (posedge wb_clk_i or posedge rst_i)
801
begin
802
  if (rst_i)
803 360 julius
    wb_adr_dsff <=  32'h0;
804 6 julius
  else if (set_addr_wb && (!set_addr_wb_q)) // Setting starting address
805 360 julius
    wb_adr_dsff <=  adr;
806 6 julius
  else if (wb_ack_i)
807
    begin
808
      if ((acc_type == `DBG_WB_WRITE8) || (acc_type == `DBG_WB_READ8))
809 360 julius
        wb_adr_dsff <=  wb_adr_dsff + 1'd1;
810 6 julius
      else if ((acc_type == `DBG_WB_WRITE16) || (acc_type == `DBG_WB_READ16))
811 360 julius
        wb_adr_dsff <=  wb_adr_dsff + 2'd2;
812 6 julius
      else
813 360 julius
        wb_adr_dsff <=  wb_adr_dsff + 3'd4;
814 6 julius
    end
815
end
816
 
817
 
818
assign wb_adr_o = wb_adr_dsff;
819
 
820
 
821
//    adr   byte  |  short  |  long
822
//     0    1000     1100      1111
823
//     1    0100     err       err
824
//     2    0010     0011      err
825
//     3    0001     err       err
826
// wb_sel_o logic
827
 
828
always @ (posedge wb_clk_i or posedge rst_i)
829
begin
830
  if (rst_i)
831 360 julius
    wb_sel_dsff[3:0] <=  4'h0;
832 6 julius
  else
833
    begin
834
      case ({wb_adr_dsff[1:0], acc_type_8bit, acc_type_16bit, acc_type_32bit}) // synthesis parallel_case
835 360 julius
        {2'd0, 3'b100} : wb_sel_dsff[3:0] <=  4'h8;
836
        {2'd0, 3'b010} : wb_sel_dsff[3:0] <=  4'hC;
837
        {2'd0, 3'b001} : wb_sel_dsff[3:0] <=  4'hF;
838
        {2'd1, 3'b100} : wb_sel_dsff[3:0] <=  4'h4;
839
        {2'd2, 3'b100} : wb_sel_dsff[3:0] <=  4'h2;
840
        {2'd2, 3'b010} : wb_sel_dsff[3:0] <=  4'h3;
841
        {2'd3, 3'b100} : wb_sel_dsff[3:0] <=  4'h1;
842
        default:         wb_sel_dsff[3:0] <=  4'hx;
843 6 julius
      endcase
844
    end
845
end
846
 
847
 
848
assign wb_sel_o = wb_sel_dsff;
849
 
850
 
851
always @ (posedge wb_clk_i)
852
begin
853 360 julius
  wb_we_dsff <=  curr_cmd_go && acc_type_write;
854 6 julius
end
855
 
856
 
857
assign wb_we_o = wb_we_dsff;
858
assign wb_cab_o = 1'b0;
859
assign wb_stb_o = wb_cyc_o;
860
assign wb_cti_o = 3'h0;     // always performing single access
861
assign wb_bte_o = 2'h0;     // always performing single access
862
 
863
 
864
 
865
// Logic for detecting end of transaction
866
always @ (posedge wb_clk_i or posedge rst_i)
867
begin
868
  if (rst_i)
869 360 julius
    wb_end <=  1'b0;
870 6 julius
  else if (wb_ack_i || wb_err_i)
871 360 julius
    wb_end <=  1'b1;
872 6 julius
  else if (wb_end_rst)
873 360 julius
    wb_end <=  1'b0;
874 6 julius
end
875
 
876
 
877
always @ (posedge tck_i or posedge rst_i)
878
begin
879
  if (rst_i)
880
    begin
881 360 julius
      wb_end_csff  <=  1'b0;
882
      wb_end_tck   <=  1'b0;
883
      wb_end_tck_q <=  1'b0;
884 6 julius
    end
885
  else
886
    begin
887 360 julius
      wb_end_csff  <=  wb_end;
888
      wb_end_tck   <=  wb_end_csff;
889
      wb_end_tck_q <=  wb_end_tck;
890 6 julius
    end
891
end
892
 
893
 
894
always @ (posedge wb_clk_i or posedge rst_i)
895
begin
896
  if (rst_i)
897
    begin
898 360 julius
      wb_end_rst_csff <=  1'b0;
899
      wb_end_rst      <=  1'b0;
900 6 julius
    end
901
  else
902
    begin
903 360 julius
      wb_end_rst_csff <=  wb_end_tck;
904
      wb_end_rst      <=  wb_end_rst_csff;
905 6 julius
    end
906
end
907
 
908
 
909
always @ (posedge wb_clk_i or posedge rst_i)
910
begin
911
  if (rst_i)
912 360 julius
    busy_wb <=  1'b0;
913 6 julius
  else if (wb_end_rst)
914 360 julius
    busy_wb <=  1'b0;
915 6 julius
  else if (wb_cyc_o)
916 360 julius
    busy_wb <=  1'b1;
917 6 julius
end
918
 
919
 
920
always @ (posedge tck_i or posedge rst_i)
921
begin
922
  if (rst_i)
923
    begin
924 360 julius
      busy_csff       <=  1'b0;
925
      busy_tck        <=  1'b0;
926 6 julius
 
927 360 julius
      update_dr_csff  <=  1'b0;
928
      update_dr_wb    <=  1'b0;
929 6 julius
    end
930
  else
931
    begin
932 360 julius
      busy_csff       <=  busy_wb;
933
      busy_tck        <=  busy_csff;
934 6 julius
 
935 360 julius
      update_dr_csff  <=  update_dr_i;
936
      update_dr_wb    <=  update_dr_csff;
937 6 julius
    end
938
end
939
 
940
 
941
// Detecting WB error
942
always @ (posedge wb_clk_i or posedge rst_i)
943
begin
944
  if (rst_i)
945 360 julius
    wb_error <=  1'b0;
946 6 julius
  else if(wb_err_i)
947 360 julius
    wb_error <=  1'b1;
948 6 julius
  else if(update_dr_wb) // error remains active until update_dr arrives
949 360 julius
    wb_error <=  1'b0;
950 6 julius
end
951
 
952
 
953
// Detecting overrun when write operation.
954
always @ (posedge wb_clk_i or posedge rst_i)
955
begin
956
  if (rst_i)
957 360 julius
    wb_overrun <=  1'b0;
958 6 julius
  else if(start_wb_wr && (!start_wb_wr_q) && wb_cyc_o)
959 360 julius
    wb_overrun <=  1'b1;
960 6 julius
  else if(update_dr_wb) // error remains active until update_dr arrives
961 360 julius
    wb_overrun <=  1'b0;
962 6 julius
end
963
 
964
 
965
// Detecting underrun when read operation
966
always @ (posedge tck_i or posedge rst_i)
967
begin
968
  if (rst_i)
969 360 julius
    underrun_tck <=  1'b0;
970 6 julius
  else if(latch_data && fifo_empty && (!data_cnt_end))
971 360 julius
    underrun_tck <=  1'b1;
972 6 julius
  else if(update_dr_i) // error remains active until update_dr arrives
973 360 julius
    underrun_tck <=  1'b0;
974 6 julius
end
975
 
976
 
977
always @ (posedge tck_i or posedge rst_i)
978
begin
979
  if (rst_i)
980
    begin
981 360 julius
      wb_error_csff   <=  1'b0;
982
      wb_error_tck    <=  1'b0;
983 6 julius
 
984 360 julius
      wb_overrun_csff <=  1'b0;
985
      wb_overrun_tck  <=  1'b0;
986 6 julius
    end
987
  else
988
    begin
989 360 julius
      wb_error_csff   <=  wb_error;
990
      wb_error_tck    <=  wb_error_csff;
991 6 julius
 
992 360 julius
      wb_overrun_csff <=  wb_overrun;
993
      wb_overrun_tck  <=  wb_overrun_csff;
994 6 julius
    end
995
end
996
 
997
 
998
 
999
always @ (posedge wb_clk_i or posedge rst_i)
1000
begin
1001
  if (rst_i)
1002
    begin
1003 360 julius
      wishbone_ce_csff  <=  1'b0;
1004
      mem_ptr_init      <=  1'b0;
1005 6 julius
    end
1006
  else
1007
    begin
1008 360 julius
      wishbone_ce_csff  <=   wishbone_ce_i;
1009
      mem_ptr_init      <=  ~wishbone_ce_csff;
1010 6 julius
    end
1011
end
1012
 
1013
 
1014
// Logic for latching data that is read from wishbone
1015
always @ (posedge wb_clk_i or posedge rst_i)
1016
begin
1017
  if (rst_i)
1018 360 julius
    mem_ptr_dsff <=  3'h0;
1019 6 julius
  else if(mem_ptr_init)
1020 360 julius
    mem_ptr_dsff <=  3'h0;
1021 6 julius
  else if (wb_ack_i)
1022
    begin
1023
      if (acc_type == `DBG_WB_READ8)
1024 360 julius
        mem_ptr_dsff <=  mem_ptr_dsff + 1'd1;
1025 6 julius
      else if (acc_type == `DBG_WB_READ16)
1026 360 julius
        mem_ptr_dsff <=  mem_ptr_dsff + 2'd2;
1027 6 julius
    end
1028
end
1029
 
1030
 
1031
// Logic for latching data that is read from wishbone
1032
always @ (posedge wb_clk_i)
1033
begin
1034
  if (wb_ack_i)
1035
    begin
1036
      case (wb_sel_dsff)    // synthesis parallel_case
1037 360 julius
        4'b1000  :  mem[mem_ptr_dsff[1:0]] <=  wb_dat_i[31:24];            // byte
1038
        4'b0100  :  mem[mem_ptr_dsff[1:0]] <=  wb_dat_i[23:16];            // byte
1039
        4'b0010  :  mem[mem_ptr_dsff[1:0]] <=  wb_dat_i[15:08];            // byte
1040
        4'b0001  :  mem[mem_ptr_dsff[1:0]] <=  wb_dat_i[07:00];            // byte
1041 6 julius
 
1042
        4'b1100  :                                                      // half
1043
                    begin
1044 360 julius
                      mem[mem_ptr_dsff[1:0]]      <=  wb_dat_i[31:24];
1045
                      mem[mem_ptr_dsff[1:0]+1'b1] <=  wb_dat_i[23:16];
1046 6 julius
                    end
1047
        4'b0011  :                                                      // half
1048
                    begin
1049 360 julius
                      mem[mem_ptr_dsff[1:0]]      <=  wb_dat_i[15:08];
1050
                      mem[mem_ptr_dsff[1:0]+1'b1] <=  wb_dat_i[07:00];
1051 6 julius
                    end
1052
        4'b1111  :                                                      // long
1053
                    begin
1054 360 julius
                      mem[0] <=  wb_dat_i[31:24];
1055
                      mem[1] <=  wb_dat_i[23:16];
1056
                      mem[2] <=  wb_dat_i[15:08];
1057
                      mem[3] <=  wb_dat_i[07:00];
1058 6 julius
                    end
1059
        default  :                                                      // long
1060
                    begin
1061 360 julius
                      mem[0] <=  8'hxx;
1062
                      mem[1] <=  8'hxx;
1063
                      mem[2] <=  8'hxx;
1064
                      mem[3] <=  8'hxx;
1065 6 julius
                    end
1066
      endcase
1067
    end
1068
end
1069
 
1070
 
1071
 
1072
assign input_data = {mem[0], mem[1], mem[2], mem[3]};
1073
 
1074
 
1075
// Fifo counter and empty/full detection
1076
always @ (posedge tck_i or posedge rst_i)
1077
begin
1078
  if (rst_i)
1079 360 julius
    fifo_cnt <=  3'h0;
1080 6 julius
  else if (update_dr_i)
1081 360 julius
    fifo_cnt <=  3'h0;
1082 6 julius
  else if (wb_end_tck && (!wb_end_tck_q) && (!latch_data) && (!fifo_full))  // incrementing
1083
    begin
1084
      case (acc_type)  // synthesis parallel_case
1085 360 julius
        `DBG_WB_READ8 : fifo_cnt <=  fifo_cnt + 1'd1;
1086
        `DBG_WB_READ16: fifo_cnt <=  fifo_cnt + 2'd2;
1087
        `DBG_WB_READ32: fifo_cnt <=  fifo_cnt + 3'd4;
1088
        default:        fifo_cnt <=  3'bxxx;
1089 6 julius
      endcase
1090
    end
1091
  else if (!(wb_end_tck && (!wb_end_tck_q)) && latch_data && (!fifo_empty))  // decrementing
1092
    begin
1093
      case (acc_type)  // synthesis parallel_case
1094 360 julius
        `DBG_WB_READ8 : fifo_cnt <=  fifo_cnt - 1'd1;
1095
        `DBG_WB_READ16: fifo_cnt <=  fifo_cnt - 2'd2;
1096
        `DBG_WB_READ32: fifo_cnt <=  fifo_cnt - 3'd4;
1097
        default:        fifo_cnt <=  3'bxxx;
1098 6 julius
      endcase
1099
    end
1100
end
1101
 
1102
 
1103
assign fifo_full  = fifo_cnt == 3'h4;
1104
assign fifo_empty = fifo_cnt == 3'h0;
1105
 
1106
 
1107
// TDO multiplexer
1108
always @ (pause_dr_i or busy_tck or crc_cnt_end or crc_cnt_end_q or curr_cmd_wr_comm or
1109
          curr_cmd_rd_comm or curr_cmd_go or acc_type_write or acc_type_read or crc_match_i
1110
          or data_cnt_end or dr or data_cnt_end_q or crc_match_reg or status_cnt_en or status
1111
          or addr_len_cnt_end or addr_len_cnt_end_q)
1112
begin
1113
  if (pause_dr_i)
1114
    begin
1115
    tdo_o = busy_tck;
1116
    end
1117
  else if (crc_cnt_end && (!crc_cnt_end_q) && (curr_cmd_wr_comm || curr_cmd_go && acc_type_write ))
1118
    begin
1119
      tdo_o = ~crc_match_i;
1120
    end
1121
  else if (curr_cmd_go && acc_type_read && crc_cnt_end && (!data_cnt_end))
1122
    begin
1123
      tdo_o = dr[31];
1124
    end
1125
  else if (curr_cmd_go && acc_type_read && data_cnt_end && (!data_cnt_end_q))
1126
    begin
1127
      tdo_o = ~crc_match_reg;
1128
    end
1129
  else if (curr_cmd_rd_comm && addr_len_cnt_end && (!addr_len_cnt_end_q))
1130
    begin
1131
      tdo_o = ~crc_match_reg;
1132
    end
1133
  else if (curr_cmd_rd_comm && crc_cnt_end && (!addr_len_cnt_end))
1134
    begin
1135
      tdo_o = dr[`DBG_WB_ACC_TYPE_LEN + `DBG_WB_ADR_LEN + `DBG_WB_LEN_LEN -1];
1136
    end
1137
  else if (status_cnt_en)
1138
    begin
1139
      tdo_o = status[3];
1140
    end
1141
  else
1142
    begin
1143
      tdo_o = 1'b0;
1144
    end
1145
end
1146
 
1147
// Status register
1148
always @ (posedge tck_i or posedge rst_i)
1149
begin
1150
  if (rst_i)
1151
    begin
1152 360 julius
    status <=  {`DBG_WB_STATUS_LEN{1'b0}};
1153 6 julius
    end
1154
  else if(crc_cnt_end && (!crc_cnt_end_q) && (!(curr_cmd_go && acc_type_read)))
1155
    begin
1156 360 julius
    status <=  {1'b0, wb_error_tck, wb_overrun_tck, crc_match_i};
1157 6 julius
    end
1158
  else if (data_cnt_end && (!data_cnt_end_q) && curr_cmd_go && acc_type_read)
1159
    begin
1160 360 julius
    status <=  {1'b0, wb_error_tck, underrun_tck, crc_match_reg};
1161 6 julius
    end
1162
  else if (addr_len_cnt_end && (!addr_len_cnt_end) && curr_cmd_rd_comm)
1163
    begin
1164 360 julius
    status <=  {1'b0, 1'b0, 1'b0, crc_match_reg};
1165 6 julius
    end
1166
  else if (shift_dr_i && (!status_cnt_end))
1167
    begin
1168 360 julius
    status <=  {status[`DBG_WB_STATUS_LEN -2:0], status[`DBG_WB_STATUS_LEN -1]};
1169 6 julius
    end
1170
end
1171
// Following status is shifted out (MSB first):
1172
// 3. bit:          1 if crc is OK, else 0
1173
// 2. bit:          1'b0
1174
// 1. bit:          1 if WB error occured, else 0
1175
// 0. bit:          1 if overrun occured during write (data couldn't be written fast enough)
1176
//                    or underrun occured during read (data couldn't be read fast enough)
1177
 
1178
 
1179
endmodule
1180
 

powered by: WebSVN 2.1.0

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