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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [rel_21/] [rtl/] [verilog/] [dbg_wb.v] - Blame information for rev 158

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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