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

Subversion Repositories or1200_hp

[/] [or1200_hp/] [trunk/] [rtl/] [rtl_cm2/] [verilog/] [or1200_iwb_biu.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tobil
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's WISHBONE BIU                                       ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Implements WISHBONE interface                               ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - if biu_cyc/stb are deasserted and wb_ack_i is asserted   ////
13
////   and this happens even before aborted_r is asssrted,        ////
14
////   wb_ack_i will be delivered even though transfer is         ////
15
////   internally considered already aborted. However most        ////
16
////   wb_ack_i are externally registered and delayed. Normally   ////
17
////   this shouldn't cause any problems.                         ////
18
////                                                              ////
19
////  Author(s):                                                  ////
20
////      - Damjan Lampret, lampret@opencores.org                 ////
21
////                                                              ////
22
//////////////////////////////////////////////////////////////////////
23
////                                                              ////
24
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
25
////                                                              ////
26
//// This source file may be used and distributed without         ////
27
//// restriction provided that this copyright statement is not    ////
28
//// removed from the file and that any derivative work contains  ////
29
//// the original copyright notice and the associated disclaimer. ////
30
////                                                              ////
31
//// This source file is free software; you can redistribute it   ////
32
//// and/or modify it under the terms of the GNU Lesser General   ////
33
//// Public License as published by the Free Software Foundation; ////
34
//// either version 2.1 of the License, or (at your option) any   ////
35
//// later version.                                               ////
36
////                                                              ////
37
//// This source is distributed in the hope that it will be       ////
38
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
39
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
40
//// PURPOSE.  See the GNU Lesser General Public License for more ////
41
//// details.                                                     ////
42
////                                                              ////
43
//// You should have received a copy of the GNU Lesser General    ////
44
//// Public License along with this source; if not, download it   ////
45
//// from http://www.opencores.org/lgpl.shtml                     ////
46
////                                                              ////
47
//////////////////////////////////////////////////////////////////////
48
//
49
// CVS Revision History
50
//
51
// $Log: not supported by cvs2svn $
52
// Revision 1.1  2003/12/05 00:12:08  lampret
53
// New wb_biu for iwb interface.
54
//
55
// Revision 1.6.4.1  2003/07/08 15:36:37  lampret
56
// Added embedded memory QMEM.
57
//
58
// Revision 1.6  2003/04/07 20:57:46  lampret
59
// Fixed OR1200_CLKDIV_x_SUPPORTED defines. Fixed order of ifdefs.
60
//
61
// Revision 1.5  2002/12/08 08:57:56  lampret
62
// Added optional support for WB B3 specification (xwb_cti_o, xwb_bte_o). Made xwb_cab_o optional.
63
//
64
// Revision 1.4  2002/09/16 03:09:16  lampret
65
// Fixed a combinational loop.
66
//
67
// Revision 1.3  2002/08/12 05:31:37  lampret
68
// Added optional retry counter for wb_rty_i. Added graceful termination for aborted transfers.
69
//
70
// Revision 1.2  2002/07/14 22:17:17  lampret
71
// Added simple trace buffer [only for Xilinx Virtex target]. Fixed instruction fetch abort when new exception is recognized.
72
//
73
// Revision 1.1  2002/01/03 08:16:15  lampret
74
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
75
//
76
// Revision 1.12  2001/11/22 13:42:51  lampret
77
// Added wb_cyc_o assignment after it was removed by accident.
78
//
79
// Revision 1.11  2001/11/20 21:28:10  lampret
80
// Added optional sampling of inputs.
81
//
82
// Revision 1.10  2001/11/18 11:32:00  lampret
83
// OR1200_REGISTERED_OUTPUTS can now be enabled.
84
//
85
// Revision 1.9  2001/10/21 17:57:16  lampret
86
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
87
//
88
// Revision 1.8  2001/10/14 13:12:10  lampret
89
// MP3 version.
90
//
91
// Revision 1.1.1.1  2001/10/06 10:18:35  igorm
92
// no message
93
//
94
// Revision 1.3  2001/08/09 13:39:33  lampret
95
// Major clean-up.
96
//
97
// Revision 1.2  2001/07/22 03:31:54  lampret
98
// Fixed RAM's oen bug. Cache bypass under development.
99
//
100
// Revision 1.1  2001/07/20 00:46:23  lampret
101
// Development version of RTL. Libraries are missing.
102
//
103
//
104
 
105
// synopsys translate_off
106
`include "timescale.v"
107
// synopsys translate_on
108
`include "or1200_defines.v"
109
 
110
module or1200_iwb_biu_cm2(
111
                clk_i_cml_1,
112
 
113
        // RISC clock, reset and clock control
114
        clk, rst, clmode,
115
 
116
        // WISHBONE interface
117
        wb_clk_i, wb_rst_i, wb_ack_i, wb_err_i, wb_rty_i, wb_dat_i,
118
        wb_cyc_o, wb_adr_o, wb_stb_o, wb_we_o, wb_sel_o, wb_dat_o,
119
`ifdef OR1200_WB_CAB
120
        wb_cab_o,
121
`endif
122
`ifdef OR1200_WB_B3
123
        wb_cti_o, wb_bte_o,
124
`endif
125
 
126
        // Internal RISC bus
127
        biu_dat_i, biu_adr_i, biu_cyc_i, biu_stb_i, biu_we_i, biu_sel_i, biu_cab_i,
128
        biu_dat_o, biu_ack_o, biu_err_o
129
);
130
 
131
 
132
input clk_i_cml_1;
133
reg  wb_ack_i_cml_1;
134
reg  wb_err_i_cml_1;
135
reg [ 32 - 1 : 0 ] wb_dat_i_cml_1;
136
reg  wb_cyc_o_cml_1;
137
reg [ 32 - 1 : 0 ] wb_adr_o_cml_1;
138
reg  wb_stb_o_cml_1;
139
reg  wb_we_o_cml_1;
140
reg [ 3 : 0 ] wb_sel_o_cml_1;
141
reg [ 32 - 1 : 0 ] wb_dat_o_cml_1;
142
reg  wb_cab_o_cml_1;
143
reg  biu_ack_o_cml_1;
144
reg [ 1 : 0 ] valid_div_cml_1;
145
reg  aborted_r_cml_1;
146
reg  previous_complete_cml_1;
147
reg  repeated_access_ack_cml_1;
148
reg [ 32 - 1 : 0 ] wb_dat_r_cml_1;
149
 
150
 
151
 
152
parameter dw = `OR1200_OPERAND_WIDTH;
153
parameter aw = `OR1200_OPERAND_WIDTH;
154
 
155
//
156
// RISC clock, reset and clock control
157
//
158
input                   clk;            // RISC clock
159
input                   rst;            // RISC reset
160
input   [1:0]            clmode;         // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
161
 
162
//
163
// WISHBONE interface
164
//
165
input                   wb_clk_i;       // clock input
166
input                   wb_rst_i;       // reset input
167
input                   wb_ack_i;       // normal termination
168
input                   wb_err_i;       // termination w/ error
169
input                   wb_rty_i;       // termination w/ retry
170
input   [dw-1:0] wb_dat_i;       // input data bus
171
output                  wb_cyc_o;       // cycle valid output
172
output  [aw-1:0] wb_adr_o;       // address bus outputs
173
output                  wb_stb_o;       // strobe output
174
output                  wb_we_o;        // indicates write transfer
175
output  [3:0]            wb_sel_o;       // byte select outputs
176
output  [dw-1:0] wb_dat_o;       // output data bus
177
`ifdef OR1200_WB_CAB
178
output                  wb_cab_o;       // consecutive address burst
179
`endif
180
`ifdef OR1200_WB_B3
181
output  [2:0]            wb_cti_o;       // cycle type identifier
182
output  [1:0]            wb_bte_o;       // burst type extension
183
`endif
184
 
185
//
186
// Internal RISC interface
187
//
188
input   [dw-1:0] biu_dat_i;      // input data bus
189
input   [aw-1:0] biu_adr_i;      // address bus
190
input                   biu_cyc_i;      // WB cycle
191
input                   biu_stb_i;      // WB strobe
192
input                   biu_we_i;       // WB write enable
193
input                   biu_cab_i;      // CAB input
194
input   [3:0]            biu_sel_i;      // byte selects
195
output  [31:0]           biu_dat_o;      // output data bus
196
output                  biu_ack_o;      // ack output
197
output                  biu_err_o;      // err output
198
 
199
//
200
// Registers
201
//
202
reg     [1:0]            valid_div;      // Used for synchronization
203
`ifdef OR1200_REGISTERED_OUTPUTS
204
reg     [aw-1:0] wb_adr_o;       // address bus outputs
205
reg                     wb_cyc_o;       // cycle output
206
reg                     wb_stb_o;       // strobe output
207
reg                     wb_we_o;        // indicates write transfer
208
reg     [3:0]            wb_sel_o;       // byte select outputs
209
`ifdef OR1200_WB_CAB
210
reg                     wb_cab_o;       // CAB output
211
`endif
212
`ifdef OR1200_WB_B3
213
reg     [1:0]            burst_len;      // burst counter
214
reg     [2:0]            wb_cti_o;       // cycle type identifier
215
`endif
216
reg     [dw-1:0] wb_dat_o;       // output data bus
217
`endif
218
`ifdef OR1200_REGISTERED_INPUTS
219
reg                     long_ack_o;     // normal termination
220
reg                     long_err_o;     // error termination
221
reg     [dw-1:0] biu_dat_o;      // output data bus
222
`else
223
wire                    long_ack_o;     // normal termination
224
wire                    long_err_o;     // error termination
225
`endif
226
wire                    aborted;        // Graceful abort
227
reg                     aborted_r;      // Graceful abort
228
wire                    retry;          // Retry
229
`ifdef OR1200_WB_RETRY
230
reg     [`OR1200_WB_RETRY-1:0] retry_cntr;       // Retry counter
231
`endif
232
reg                     previous_complete;
233
wire                    same_addr;
234
wire                    repeated_access;
235
reg                     repeated_access_ack;
236
reg     [dw-1:0] wb_dat_r;       // saved previous data read
237
 
238
//
239
// WISHBONE I/F <-> Internal RISC I/F conversion
240
//
241
 
242
//
243
// Address bus
244
//
245
`ifdef OR1200_REGISTERED_OUTPUTS
246
 
247
// SynEDA CoreMultiplier
248
// assignment(s): wb_adr_o
249
// replace(s): wb_ack_i, wb_adr_o, wb_stb_o, biu_ack_o, previous_complete
250
always @(posedge wb_clk_i or posedge wb_rst_i)
251
        if (wb_rst_i)
252
                wb_adr_o <= #1 {aw{1'b0}};
253
        else begin  wb_adr_o <= wb_adr_o_cml_1; if ((biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_1 & ~aborted & ~(wb_stb_o_cml_1 & ~wb_ack_i_cml_1) | biu_cab_i & (previous_complete_cml_1 | biu_ack_o_cml_1))
254
                wb_adr_o <= #1 biu_adr_i; end
255
`else
256
assign wb_adr_o = biu_adr_i;
257
`endif
258
 
259
//
260
// Same access as previous one, store previous read data
261
//
262
 
263
// SynEDA CoreMultiplier
264
// assignment(s): same_addr
265
// replace(s): wb_adr_o
266
assign same_addr = wb_adr_o_cml_1 == biu_adr_i;
267
 
268
// SynEDA CoreMultiplier
269
// assignment(s): repeated_access
270
// replace(s): previous_complete
271
assign repeated_access = same_addr & previous_complete_cml_1;
272
 
273
// SynEDA CoreMultiplier
274
// assignment(s): wb_dat_r
275
// replace(s): wb_ack_i, wb_dat_i, wb_dat_r
276
always @(posedge wb_clk_i or posedge wb_rst_i)
277
        if (wb_rst_i)
278
                wb_dat_r <= #1 32'h0000_0000;
279
        else begin  wb_dat_r <= wb_dat_r_cml_1; if (wb_ack_i_cml_1)
280
                wb_dat_r <= #1 wb_dat_i_cml_1; end
281
 
282
 
283
// SynEDA CoreMultiplier
284
// assignment(s): repeated_access_ack
285
// replace(s): repeated_access_ack
286
always @(posedge clk or posedge rst)
287
        if (rst)
288
                repeated_access_ack <= #1 1'b0;
289
        else begin  repeated_access_ack <= repeated_access_ack_cml_1; if (repeated_access & biu_cyc_i & biu_stb_i)
290
                repeated_access_ack <= #1 1'b1;
291
        else
292
                repeated_access_ack <= #1 1'b0; end
293
 
294
//
295
// Previous access completed
296
//
297
 
298
// SynEDA CoreMultiplier
299
// assignment(s): previous_complete
300
// replace(s): wb_ack_i, wb_stb_o, previous_complete
301
always @(posedge wb_clk_i or posedge wb_rst_i)
302
        if (wb_rst_i)
303
                previous_complete <= #1 1'b1;
304
        else begin  previous_complete <= previous_complete_cml_1; if (wb_ack_i_cml_1 & biu_cyc_i & biu_stb_i)
305
                previous_complete <= #1 1'b1;
306
        else if ((biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_1 & ~aborted & ~(wb_stb_o_cml_1 & ~wb_ack_i_cml_1))
307
                previous_complete <= #1 1'b0; end
308
 
309
//
310
// Input data bus
311
//
312
`ifdef OR1200_REGISTERED_INPUTS
313
always @(posedge wb_clk_i or posedge wb_rst_i)
314
        if (wb_rst_i)
315
                biu_dat_o <= #1 32'h0000_0000;
316
        else if (wb_ack_i)
317
                biu_dat_o <= #1 wb_dat_i_cml_1;
318
`else
319
 
320
// SynEDA CoreMultiplier
321
// assignment(s): biu_dat_o
322
// replace(s): wb_dat_i, repeated_access_ack, wb_dat_r
323
assign biu_dat_o = repeated_access_ack_cml_1 ? wb_dat_r_cml_1 : wb_dat_i_cml_1;
324
`endif
325
 
326
//
327
// Output data bus
328
//
329
`ifdef OR1200_REGISTERED_OUTPUTS
330
 
331
// SynEDA CoreMultiplier
332
// assignment(s): wb_dat_o
333
// replace(s): wb_ack_i, wb_dat_o
334
always @(posedge wb_clk_i or posedge wb_rst_i)
335
        if (wb_rst_i)
336
                wb_dat_o <= #1 {dw{1'b0}};
337
        else begin  wb_dat_o <= wb_dat_o_cml_1; if ((biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_1 & ~aborted)
338
                wb_dat_o <= #1 biu_dat_i; end
339
`else
340
assign wb_dat_o = biu_dat_i;
341
`endif
342
 
343
//
344
// Valid_div counts RISC clock cycles by modulo 4
345
// and is used to synchronize external WB i/f to
346
// RISC clock
347
//
348
 
349
// SynEDA CoreMultiplier
350
// assignment(s): valid_div
351
// replace(s): valid_div
352
always @(posedge clk or posedge rst)
353
        if (rst)
354
                valid_div <= #1 2'b0;
355
        else begin  valid_div <= valid_div_cml_1;
356
                valid_div <= #1 valid_div_cml_1 + 1'd1; end
357
 
358
//
359
// biu_ack_o is one RISC clock cycle long long_ack_o.
360
// long_ack_o is one, two or four RISC clock cycles long because
361
// WISHBONE can work at 1, 1/2 or 1/4 RISC clock.
362
//
363
assign biu_ack_o = (repeated_access_ack | long_ack_o) & ~aborted_r
364
`ifdef OR1200_CLKDIV_2_SUPPORTED
365
                & (valid_div[0] | ~clmode[0])
366
`ifdef OR1200_CLKDIV_4_SUPPORTED
367
                & (valid_div[1] | ~clmode[1])
368
`endif
369
`endif
370
                ;
371
 
372
//
373
// Acknowledgment of the data to the RISC
374
//
375
// long_ack_o
376
//
377
`ifdef OR1200_REGISTERED_INPUTS
378
always @(posedge wb_clk_i or posedge wb_rst_i)
379
        if (wb_rst_i)
380
                long_ack_o <= #1 1'b0;
381
        else
382
                long_ack_o <= #1 wb_ack_i & ~aborted;
383
`else
384
assign long_ack_o = wb_ack_i;
385
`endif
386
 
387
//
388
// biu_err_o is one RISC clock cycle long long_err_o.
389
// long_err_o is one, two or four RISC clock cycles long because
390
// WISHBONE can work at 1, 1/2 or 1/4 RISC clock.
391
//
392
assign biu_err_o = long_err_o
393
`ifdef OR1200_CLKDIV_2_SUPPORTED
394
                & (valid_div[0] | ~clmode[0])
395
`ifdef OR1200_CLKDIV_4_SUPPORTED
396
                & (valid_div[1] | ~clmode[1])
397
`endif
398
`endif
399
                ;
400
 
401
//
402
// Error termination
403
//
404
// long_err_o
405
//
406
`ifdef OR1200_REGISTERED_INPUTS
407
always @(posedge wb_clk_i or posedge wb_rst_i)
408
        if (wb_rst_i)
409
                long_err_o <= #1 1'b0;
410
        else
411
                long_err_o <= #1 wb_err_i & ~aborted;
412
`else
413
assign long_err_o = wb_err_i & ~aborted_r;
414
`endif
415
 
416
//
417
// Retry counter
418
//
419
// Assert 'retry' when 'wb_rty_i' is sampled high and keep it high
420
// until retry counter doesn't expire
421
// 
422
`ifdef OR1200_WB_RETRY
423
assign retry = wb_rty_i | (|retry_cntr);
424
`else
425
assign retry = 1'b0;
426
`endif
427
`ifdef OR1200_WB_RETRY
428
always @(posedge wb_clk_i or posedge wb_rst_i)
429
        if (wb_rst_i)
430
                retry_cntr <= #1 1'b0;
431
        else if (wb_rty_i)
432
                retry_cntr <= #1 {`OR1200_WB_RETRY{1'b1}};
433
        else if (retry_cntr)
434
                retry_cntr <= #1 retry_cntr - 7'd1;
435
`endif
436
 
437
//
438
// Graceful completion of aborted transfers
439
//
440
// Assert 'aborted' when 1) current transfer is in progress (wb_stb_o; which
441
// we know is only asserted together with wb_cyc_o) 2) and in next WB clock cycle
442
// wb_stb_o would be deasserted (biu_cyc_i and biu_stb_i are low) 3) and
443
// there is no termination of current transfer in this WB clock cycle (wb_ack_i
444
// and wb_err_i are low).
445
// 'aborted_r' is registered 'aborted' and extended until this "aborted" transfer
446
// is properly terminated with wb_ack_i/wb_err_i.
447
// 
448
 
449
// SynEDA CoreMultiplier
450
// assignment(s): aborted
451
// replace(s): wb_ack_i, wb_err_i, wb_stb_o
452
assign aborted = wb_stb_o_cml_1 & ~(biu_cyc_i & biu_stb_i) & ~(wb_ack_i_cml_1 | wb_err_i_cml_1);
453
 
454
// SynEDA CoreMultiplier
455
// assignment(s): aborted_r
456
// replace(s): wb_ack_i, wb_err_i, aborted_r
457
always @(posedge wb_clk_i or posedge wb_rst_i)
458
        if (wb_rst_i)
459
                aborted_r <= #1 1'b0;
460
        else begin  aborted_r <= aborted_r_cml_1; if (wb_ack_i_cml_1 | wb_err_i_cml_1)
461
                aborted_r <= #1 1'b0;
462
        else if (aborted)
463
                aborted_r <= #1 1'b1; end
464
 
465
//
466
// WB cyc_o
467
//
468
// Either 1) normal transfer initiated by biu_cyc_i (and biu_cab_i if
469
// bursts are enabled) and possibly suspended by 'retry'
470
// or 2) extended "aborted" transfer
471
//
472
`ifdef OR1200_REGISTERED_OUTPUTS
473
 
474
// SynEDA CoreMultiplier
475
// assignment(s): wb_cyc_o
476
// replace(s): wb_ack_i, wb_cyc_o
477
always @(posedge wb_clk_i or posedge wb_rst_i)
478
        if (wb_rst_i)
479
                wb_cyc_o <= #1 1'b0;
480
        else begin  wb_cyc_o <= wb_cyc_o_cml_1;
481
`ifdef OR1200_NO_BURSTS
482
                wb_cyc_o <= #1 biu_cyc_i & ~wb_ack_i_cml_1 & ~retry & ~repeated_access | aborted & ~wb_ack_i_cml_1;
483
`else
484
                wb_cyc_o <= #1 biu_cyc_i & ~wb_ack_i_cml_1 & ~retry & ~repeated_access | biu_cab_i | aborted & ~wb_ack_i_cml_1; end
485
`endif
486
`else
487
`ifdef OR1200_NO_BURSTS
488
assign wb_cyc_o = biu_cyc_i & ~retry;
489
`else
490
assign wb_cyc_o = biu_cyc_i | biu_cab_i & ~retry;
491
`endif
492
`endif
493
 
494
//
495
// WB stb_o
496
//
497
`ifdef OR1200_REGISTERED_OUTPUTS
498
 
499
// SynEDA CoreMultiplier
500
// assignment(s): wb_stb_o
501
// replace(s): wb_ack_i, wb_stb_o
502
always @(posedge wb_clk_i or posedge wb_rst_i)
503
        if (wb_rst_i)
504
                wb_stb_o <= #1 1'b0;
505
        else begin  wb_stb_o <= wb_stb_o_cml_1;
506
                wb_stb_o <= #1 (biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_1 & ~retry & ~repeated_access | aborted & ~wb_ack_i_cml_1; end
507
`else
508
assign wb_stb_o = biu_cyc_i & biu_stb_i;
509
`endif
510
 
511
//
512
// WB we_o
513
//
514
`ifdef OR1200_REGISTERED_OUTPUTS
515
 
516
// SynEDA CoreMultiplier
517
// assignment(s): wb_we_o
518
// replace(s): wb_we_o
519
always @(posedge wb_clk_i or posedge wb_rst_i)
520
        if (wb_rst_i)
521
                wb_we_o <= #1 1'b0;
522
        else begin  wb_we_o <= wb_we_o_cml_1;
523
                wb_we_o <= #1 biu_cyc_i & biu_stb_i & biu_we_i | aborted & wb_we_o_cml_1; end
524
`else
525
assign wb_we_o = biu_cyc_i & biu_stb_i & biu_we_i;
526
`endif
527
 
528
//
529
// WB sel_o
530
//
531
`ifdef OR1200_REGISTERED_OUTPUTS
532
 
533
// SynEDA CoreMultiplier
534
// assignment(s): wb_sel_o
535
// replace(s): wb_sel_o
536
always @(posedge wb_clk_i or posedge wb_rst_i)
537
        if (wb_rst_i)
538
                wb_sel_o <= #1 4'b0000;
539
        else begin  wb_sel_o <= wb_sel_o_cml_1;
540
                wb_sel_o <= #1 biu_sel_i; end
541
`else
542
assign wb_sel_o = biu_sel_i;
543
`endif
544
 
545
`ifdef OR1200_WB_CAB
546
//
547
// WB cab_o
548
//
549
`ifdef OR1200_REGISTERED_OUTPUTS
550
 
551
// SynEDA CoreMultiplier
552
// assignment(s): wb_cab_o
553
// replace(s): wb_cab_o
554
always @(posedge wb_clk_i or posedge wb_rst_i)
555
        if (wb_rst_i)
556
                wb_cab_o <= #1 1'b0;
557
        else begin  wb_cab_o <= wb_cab_o_cml_1;
558
                wb_cab_o <= #1 biu_cab_i; end
559
`else
560
assign wb_cab_o = biu_cab_i;
561
`endif
562
`endif
563
 
564
`ifdef OR1200_WB_B3
565
//
566
// Count burst beats
567
//
568
always @(posedge wb_clk_i or posedge wb_rst_i)
569
        if (wb_rst_i)
570
                burst_len <= #1 2'b00;
571
        else if (biu_cab_i && burst_len && wb_ack_i)
572
                burst_len <= #1 burst_len - 1'b1;
573
        else if (~biu_cab_i)
574
                burst_len <= #1 2'b11;
575
 
576
//
577
// WB cti_o
578
//
579
`ifdef OR1200_REGISTERED_OUTPUTS
580
always @(posedge wb_clk_i or posedge wb_rst_i)
581
        if (wb_rst_i)
582
                wb_cti_o <= #1 3'b000;  // classic cycle
583
`ifdef OR1200_NO_BURSTS
584
        else
585
                wb_cti_o <= #1 3'b111;  // end-of-burst
586
`else
587
        else if (biu_cab_i && burst_len[1])
588
                wb_cti_o <= #1 3'b010;  // incrementing burst cycle
589
        else if (biu_cab_i && wb_ack_i)
590
                wb_cti_o <= #1 3'b111;  // end-of-burst
591
`endif  // OR1200_NO_BURSTS
592
`else
593
Unsupported !!!;
594
`endif
595
 
596
//
597
// WB bte_o
598
//
599
assign wb_bte_o = 2'b01;        // 4-beat wrap burst
600
 
601
`endif  // OR1200_WB_B3
602
 
603
 
604
always @ (posedge clk_i_cml_1) begin
605
wb_ack_i_cml_1 <= wb_ack_i;
606
wb_err_i_cml_1 <= wb_err_i;
607
wb_dat_i_cml_1 <= wb_dat_i;
608
wb_cyc_o_cml_1 <= wb_cyc_o;
609
wb_adr_o_cml_1 <= wb_adr_o;
610
wb_stb_o_cml_1 <= wb_stb_o;
611
wb_we_o_cml_1 <= wb_we_o;
612
wb_sel_o_cml_1 <= wb_sel_o;
613
wb_dat_o_cml_1 <= wb_dat_o;
614
wb_cab_o_cml_1 <= wb_cab_o;
615
biu_ack_o_cml_1 <= biu_ack_o;
616
valid_div_cml_1 <= valid_div;
617
aborted_r_cml_1 <= aborted_r;
618
previous_complete_cml_1 <= previous_complete;
619
repeated_access_ack_cml_1 <= repeated_access_ack;
620
wb_dat_r_cml_1 <= wb_dat_r;
621
end
622
endmodule
623
 

powered by: WebSVN 2.1.0

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