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

Subversion Repositories or1200_hp

[/] [or1200_hp/] [trunk/] [rtl/] [rtl_cm4/] [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_cm4(
111
                clk_i_cml_1,
112
                clk_i_cml_2,
113
                clk_i_cml_3,
114
 
115
        // RISC clock, reset and clock control
116
        clk, rst, clmode,
117
 
118
        // WISHBONE interface
119
        wb_clk_i, wb_rst_i, wb_ack_i, wb_err_i, wb_rty_i, wb_dat_i,
120
        wb_cyc_o, wb_adr_o, wb_stb_o, wb_we_o, wb_sel_o, wb_dat_o,
121
`ifdef OR1200_WB_CAB
122
        wb_cab_o,
123
`endif
124
`ifdef OR1200_WB_B3
125
        wb_cti_o, wb_bte_o,
126
`endif
127
 
128
        // Internal RISC bus
129
        biu_dat_i, biu_adr_i, biu_cyc_i, biu_stb_i, biu_we_i, biu_sel_i, biu_cab_i,
130
        biu_dat_o, biu_ack_o, biu_err_o
131
);
132
 
133
 
134
input clk_i_cml_1;
135
input clk_i_cml_2;
136
input clk_i_cml_3;
137
reg  wb_ack_i_cml_3;
138
reg  wb_ack_i_cml_2;
139
reg  wb_ack_i_cml_1;
140
reg  wb_err_i_cml_3;
141
reg  wb_err_i_cml_2;
142
reg  wb_err_i_cml_1;
143
reg [ 32 - 1 : 0 ] wb_dat_i_cml_3;
144
reg [ 32 - 1 : 0 ] wb_dat_i_cml_2;
145
reg [ 32 - 1 : 0 ] wb_dat_i_cml_1;
146
reg  wb_cyc_o_cml_3;
147
reg  wb_cyc_o_cml_2;
148
reg  wb_cyc_o_cml_1;
149
reg [ 32 - 1 : 0 ] wb_adr_o_cml_3;
150
reg [ 32 - 1 : 0 ] wb_adr_o_cml_2;
151
reg [ 32 - 1 : 0 ] wb_adr_o_cml_1;
152
reg  wb_stb_o_cml_3;
153
reg  wb_stb_o_cml_2;
154
reg  wb_stb_o_cml_1;
155
reg  wb_we_o_cml_3;
156
reg  wb_we_o_cml_2;
157
reg  wb_we_o_cml_1;
158
reg [ 3 : 0 ] wb_sel_o_cml_3;
159
reg [ 3 : 0 ] wb_sel_o_cml_2;
160
reg [ 3 : 0 ] wb_sel_o_cml_1;
161
reg [ 32 - 1 : 0 ] wb_dat_o_cml_3;
162
reg [ 32 - 1 : 0 ] wb_dat_o_cml_2;
163
reg [ 32 - 1 : 0 ] wb_dat_o_cml_1;
164
reg  wb_cab_o_cml_3;
165
reg  wb_cab_o_cml_2;
166
reg  wb_cab_o_cml_1;
167
reg  biu_ack_o_cml_3;
168
reg  biu_ack_o_cml_2;
169
reg  biu_ack_o_cml_1;
170
reg [ 1 : 0 ] valid_div_cml_3;
171
reg [ 1 : 0 ] valid_div_cml_2;
172
reg [ 1 : 0 ] valid_div_cml_1;
173
reg  aborted_r_cml_3;
174
reg  aborted_r_cml_2;
175
reg  aborted_r_cml_1;
176
reg  previous_complete_cml_3;
177
reg  previous_complete_cml_2;
178
reg  previous_complete_cml_1;
179
reg  repeated_access_ack_cml_3;
180
reg  repeated_access_ack_cml_2;
181
reg  repeated_access_ack_cml_1;
182
reg [ 32 - 1 : 0 ] wb_dat_r_cml_3;
183
reg [ 32 - 1 : 0 ] wb_dat_r_cml_2;
184
reg [ 32 - 1 : 0 ] wb_dat_r_cml_1;
185
 
186
 
187
 
188
parameter dw = `OR1200_OPERAND_WIDTH;
189
parameter aw = `OR1200_OPERAND_WIDTH;
190
 
191
//
192
// RISC clock, reset and clock control
193
//
194
input                   clk;            // RISC clock
195
input                   rst;            // RISC reset
196
input   [1:0]            clmode;         // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
197
 
198
//
199
// WISHBONE interface
200
//
201
input                   wb_clk_i;       // clock input
202
input                   wb_rst_i;       // reset input
203
input                   wb_ack_i;       // normal termination
204
input                   wb_err_i;       // termination w/ error
205
input                   wb_rty_i;       // termination w/ retry
206
input   [dw-1:0] wb_dat_i;       // input data bus
207
output                  wb_cyc_o;       // cycle valid output
208
output  [aw-1:0] wb_adr_o;       // address bus outputs
209
output                  wb_stb_o;       // strobe output
210
output                  wb_we_o;        // indicates write transfer
211
output  [3:0]            wb_sel_o;       // byte select outputs
212
output  [dw-1:0] wb_dat_o;       // output data bus
213
`ifdef OR1200_WB_CAB
214
output                  wb_cab_o;       // consecutive address burst
215
`endif
216
`ifdef OR1200_WB_B3
217
output  [2:0]            wb_cti_o;       // cycle type identifier
218
output  [1:0]            wb_bte_o;       // burst type extension
219
`endif
220
 
221
//
222
// Internal RISC interface
223
//
224
input   [dw-1:0] biu_dat_i;      // input data bus
225
input   [aw-1:0] biu_adr_i;      // address bus
226
input                   biu_cyc_i;      // WB cycle
227
input                   biu_stb_i;      // WB strobe
228
input                   biu_we_i;       // WB write enable
229
input                   biu_cab_i;      // CAB input
230
input   [3:0]            biu_sel_i;      // byte selects
231
output  [31:0]           biu_dat_o;      // output data bus
232
output                  biu_ack_o;      // ack output
233
output                  biu_err_o;      // err output
234
 
235
//
236
// Registers
237
//
238
reg     [1:0]            valid_div;      // Used for synchronization
239
`ifdef OR1200_REGISTERED_OUTPUTS
240
reg     [aw-1:0] wb_adr_o;       // address bus outputs
241
reg                     wb_cyc_o;       // cycle output
242
reg                     wb_stb_o;       // strobe output
243
reg                     wb_we_o;        // indicates write transfer
244
reg     [3:0]            wb_sel_o;       // byte select outputs
245
`ifdef OR1200_WB_CAB
246
reg                     wb_cab_o;       // CAB output
247
`endif
248
`ifdef OR1200_WB_B3
249
reg     [1:0]            burst_len;      // burst counter
250
reg     [2:0]            wb_cti_o;       // cycle type identifier
251
`endif
252
reg     [dw-1:0] wb_dat_o;       // output data bus
253
`endif
254
`ifdef OR1200_REGISTERED_INPUTS
255
reg                     long_ack_o;     // normal termination
256
reg                     long_err_o;     // error termination
257
reg     [dw-1:0] biu_dat_o;      // output data bus
258
`else
259
wire                    long_ack_o;     // normal termination
260
wire                    long_err_o;     // error termination
261
`endif
262
wire                    aborted;        // Graceful abort
263
reg                     aborted_r;      // Graceful abort
264
wire                    retry;          // Retry
265
`ifdef OR1200_WB_RETRY
266
reg     [`OR1200_WB_RETRY-1:0] retry_cntr;       // Retry counter
267
`endif
268
reg                     previous_complete;
269
wire                    same_addr;
270
wire                    repeated_access;
271
reg                     repeated_access_ack;
272
reg     [dw-1:0] wb_dat_r;       // saved previous data read
273
 
274
//
275
// WISHBONE I/F <-> Internal RISC I/F conversion
276
//
277
 
278
//
279
// Address bus
280
//
281
`ifdef OR1200_REGISTERED_OUTPUTS
282
 
283
// SynEDA CoreMultiplier
284
// assignment(s): wb_adr_o
285
// replace(s): wb_ack_i, wb_adr_o, wb_stb_o, biu_ack_o, previous_complete
286
always @(posedge wb_clk_i or posedge wb_rst_i)
287
        if (wb_rst_i)
288
                wb_adr_o <= #1 {aw{1'b0}};
289
        else begin  wb_adr_o <= wb_adr_o_cml_3; if ((biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_3 & ~aborted & ~(wb_stb_o_cml_3 & ~wb_ack_i_cml_3) | biu_cab_i & (previous_complete_cml_3 | biu_ack_o_cml_3))
290
                wb_adr_o <= #1 biu_adr_i; end
291
`else
292
assign wb_adr_o = biu_adr_i;
293
`endif
294
 
295
//
296
// Same access as previous one, store previous read data
297
//
298
 
299
// SynEDA CoreMultiplier
300
// assignment(s): same_addr
301
// replace(s): wb_adr_o
302
assign same_addr = wb_adr_o_cml_3 == biu_adr_i;
303
 
304
// SynEDA CoreMultiplier
305
// assignment(s): repeated_access
306
// replace(s): previous_complete
307
assign repeated_access = same_addr & previous_complete_cml_3;
308
 
309
// SynEDA CoreMultiplier
310
// assignment(s): wb_dat_r
311
// replace(s): wb_ack_i, wb_dat_i, wb_dat_r
312
always @(posedge wb_clk_i or posedge wb_rst_i)
313
        if (wb_rst_i)
314
                wb_dat_r <= #1 32'h0000_0000;
315
        else begin  wb_dat_r <= wb_dat_r_cml_3; if (wb_ack_i_cml_3)
316
                wb_dat_r <= #1 wb_dat_i_cml_3; end
317
 
318
 
319
// SynEDA CoreMultiplier
320
// assignment(s): repeated_access_ack
321
// replace(s): repeated_access_ack
322
always @(posedge clk or posedge rst)
323
        if (rst)
324
                repeated_access_ack <= #1 1'b0;
325
        else begin  repeated_access_ack <= repeated_access_ack_cml_3; if (repeated_access & biu_cyc_i & biu_stb_i)
326
                repeated_access_ack <= #1 1'b1;
327
        else
328
                repeated_access_ack <= #1 1'b0; end
329
 
330
//
331
// Previous access completed
332
//
333
 
334
// SynEDA CoreMultiplier
335
// assignment(s): previous_complete
336
// replace(s): wb_ack_i, wb_stb_o, previous_complete
337
always @(posedge wb_clk_i or posedge wb_rst_i)
338
        if (wb_rst_i)
339
                previous_complete <= #1 1'b1;
340
        else begin  previous_complete <= previous_complete_cml_3; if (wb_ack_i_cml_3 & biu_cyc_i & biu_stb_i)
341
                previous_complete <= #1 1'b1;
342
        else if ((biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_3 & ~aborted & ~(wb_stb_o_cml_3 & ~wb_ack_i_cml_3))
343
                previous_complete <= #1 1'b0; end
344
 
345
//
346
// Input data bus
347
//
348
`ifdef OR1200_REGISTERED_INPUTS
349
always @(posedge wb_clk_i or posedge wb_rst_i)
350
        if (wb_rst_i)
351
                biu_dat_o <= #1 32'h0000_0000;
352
        else if (wb_ack_i)
353
                biu_dat_o <= #1 wb_dat_i_cml_3;
354
`else
355
 
356
// SynEDA CoreMultiplier
357
// assignment(s): biu_dat_o
358
// replace(s): wb_dat_i, repeated_access_ack, wb_dat_r
359
assign biu_dat_o = repeated_access_ack_cml_3 ? wb_dat_r_cml_3 : wb_dat_i_cml_3;
360
`endif
361
 
362
//
363
// Output data bus
364
//
365
`ifdef OR1200_REGISTERED_OUTPUTS
366
 
367
// SynEDA CoreMultiplier
368
// assignment(s): wb_dat_o
369
// replace(s): wb_ack_i, wb_dat_o
370
always @(posedge wb_clk_i or posedge wb_rst_i)
371
        if (wb_rst_i)
372
                wb_dat_o <= #1 {dw{1'b0}};
373
        else begin  wb_dat_o <= wb_dat_o_cml_3; if ((biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_3 & ~aborted)
374
                wb_dat_o <= #1 biu_dat_i; end
375
`else
376
assign wb_dat_o = biu_dat_i;
377
`endif
378
 
379
//
380
// Valid_div counts RISC clock cycles by modulo 4
381
// and is used to synchronize external WB i/f to
382
// RISC clock
383
//
384
 
385
// SynEDA CoreMultiplier
386
// assignment(s): valid_div
387
// replace(s): valid_div
388
always @(posedge clk or posedge rst)
389
        if (rst)
390
                valid_div <= #1 2'b0;
391
        else begin  valid_div <= valid_div_cml_3;
392
                valid_div <= #1 valid_div_cml_3 + 1'd1; end
393
 
394
//
395
// biu_ack_o is one RISC clock cycle long long_ack_o.
396
// long_ack_o is one, two or four RISC clock cycles long because
397
// WISHBONE can work at 1, 1/2 or 1/4 RISC clock.
398
//
399
assign biu_ack_o = (repeated_access_ack | long_ack_o) & ~aborted_r
400
`ifdef OR1200_CLKDIV_2_SUPPORTED
401
                & (valid_div[0] | ~clmode[0])
402
`ifdef OR1200_CLKDIV_4_SUPPORTED
403
                & (valid_div[1] | ~clmode[1])
404
`endif
405
`endif
406
                ;
407
 
408
//
409
// Acknowledgment of the data to the RISC
410
//
411
// long_ack_o
412
//
413
`ifdef OR1200_REGISTERED_INPUTS
414
always @(posedge wb_clk_i or posedge wb_rst_i)
415
        if (wb_rst_i)
416
                long_ack_o <= #1 1'b0;
417
        else
418
                long_ack_o <= #1 wb_ack_i & ~aborted;
419
`else
420
assign long_ack_o = wb_ack_i;
421
`endif
422
 
423
//
424
// biu_err_o is one RISC clock cycle long long_err_o.
425
// long_err_o is one, two or four RISC clock cycles long because
426
// WISHBONE can work at 1, 1/2 or 1/4 RISC clock.
427
//
428
assign biu_err_o = long_err_o
429
`ifdef OR1200_CLKDIV_2_SUPPORTED
430
                & (valid_div[0] | ~clmode[0])
431
`ifdef OR1200_CLKDIV_4_SUPPORTED
432
                & (valid_div[1] | ~clmode[1])
433
`endif
434
`endif
435
                ;
436
 
437
//
438
// Error termination
439
//
440
// long_err_o
441
//
442
`ifdef OR1200_REGISTERED_INPUTS
443
always @(posedge wb_clk_i or posedge wb_rst_i)
444
        if (wb_rst_i)
445
                long_err_o <= #1 1'b0;
446
        else
447
                long_err_o <= #1 wb_err_i & ~aborted;
448
`else
449
assign long_err_o = wb_err_i & ~aborted_r;
450
`endif
451
 
452
//
453
// Retry counter
454
//
455
// Assert 'retry' when 'wb_rty_i' is sampled high and keep it high
456
// until retry counter doesn't expire
457
// 
458
`ifdef OR1200_WB_RETRY
459
assign retry = wb_rty_i | (|retry_cntr);
460
`else
461
assign retry = 1'b0;
462
`endif
463
`ifdef OR1200_WB_RETRY
464
always @(posedge wb_clk_i or posedge wb_rst_i)
465
        if (wb_rst_i)
466
                retry_cntr <= #1 1'b0;
467
        else if (wb_rty_i)
468
                retry_cntr <= #1 {`OR1200_WB_RETRY{1'b1}};
469
        else if (retry_cntr)
470
                retry_cntr <= #1 retry_cntr - 7'd1;
471
`endif
472
 
473
//
474
// Graceful completion of aborted transfers
475
//
476
// Assert 'aborted' when 1) current transfer is in progress (wb_stb_o; which
477
// we know is only asserted together with wb_cyc_o) 2) and in next WB clock cycle
478
// wb_stb_o would be deasserted (biu_cyc_i and biu_stb_i are low) 3) and
479
// there is no termination of current transfer in this WB clock cycle (wb_ack_i
480
// and wb_err_i are low).
481
// 'aborted_r' is registered 'aborted' and extended until this "aborted" transfer
482
// is properly terminated with wb_ack_i/wb_err_i.
483
// 
484
 
485
// SynEDA CoreMultiplier
486
// assignment(s): aborted
487
// replace(s): wb_ack_i, wb_err_i, wb_stb_o
488
assign aborted = wb_stb_o_cml_3 & ~(biu_cyc_i & biu_stb_i) & ~(wb_ack_i_cml_3 | wb_err_i_cml_3);
489
 
490
// SynEDA CoreMultiplier
491
// assignment(s): aborted_r
492
// replace(s): wb_ack_i, wb_err_i, aborted_r
493
always @(posedge wb_clk_i or posedge wb_rst_i)
494
        if (wb_rst_i)
495
                aborted_r <= #1 1'b0;
496
        else begin  aborted_r <= aborted_r_cml_3; if (wb_ack_i_cml_3 | wb_err_i_cml_3)
497
                aborted_r <= #1 1'b0;
498
        else if (aborted)
499
                aborted_r <= #1 1'b1; end
500
 
501
//
502
// WB cyc_o
503
//
504
// Either 1) normal transfer initiated by biu_cyc_i (and biu_cab_i if
505
// bursts are enabled) and possibly suspended by 'retry'
506
// or 2) extended "aborted" transfer
507
//
508
`ifdef OR1200_REGISTERED_OUTPUTS
509
 
510
// SynEDA CoreMultiplier
511
// assignment(s): wb_cyc_o
512
// replace(s): wb_ack_i, wb_cyc_o
513
always @(posedge wb_clk_i or posedge wb_rst_i)
514
        if (wb_rst_i)
515
                wb_cyc_o <= #1 1'b0;
516
        else begin  wb_cyc_o <= wb_cyc_o_cml_3;
517
`ifdef OR1200_NO_BURSTS
518
                wb_cyc_o <= #1 biu_cyc_i & ~wb_ack_i_cml_3 & ~retry & ~repeated_access | aborted & ~wb_ack_i_cml_3;
519
`else
520
                wb_cyc_o <= #1 biu_cyc_i & ~wb_ack_i_cml_3 & ~retry & ~repeated_access | biu_cab_i | aborted & ~wb_ack_i_cml_3; end
521
`endif
522
`else
523
`ifdef OR1200_NO_BURSTS
524
assign wb_cyc_o = biu_cyc_i & ~retry;
525
`else
526
assign wb_cyc_o = biu_cyc_i | biu_cab_i & ~retry;
527
`endif
528
`endif
529
 
530
//
531
// WB stb_o
532
//
533
`ifdef OR1200_REGISTERED_OUTPUTS
534
 
535
// SynEDA CoreMultiplier
536
// assignment(s): wb_stb_o
537
// replace(s): wb_ack_i, wb_stb_o
538
always @(posedge wb_clk_i or posedge wb_rst_i)
539
        if (wb_rst_i)
540
                wb_stb_o <= #1 1'b0;
541
        else begin  wb_stb_o <= wb_stb_o_cml_3;
542
                wb_stb_o <= #1 (biu_cyc_i & biu_stb_i) & ~wb_ack_i_cml_3 & ~retry & ~repeated_access | aborted & ~wb_ack_i_cml_3; end
543
`else
544
assign wb_stb_o = biu_cyc_i & biu_stb_i;
545
`endif
546
 
547
//
548
// WB we_o
549
//
550
`ifdef OR1200_REGISTERED_OUTPUTS
551
 
552
// SynEDA CoreMultiplier
553
// assignment(s): wb_we_o
554
// replace(s): wb_we_o
555
always @(posedge wb_clk_i or posedge wb_rst_i)
556
        if (wb_rst_i)
557
                wb_we_o <= #1 1'b0;
558
        else begin  wb_we_o <= wb_we_o_cml_3;
559
                wb_we_o <= #1 biu_cyc_i & biu_stb_i & biu_we_i | aborted & wb_we_o_cml_3; end
560
`else
561
assign wb_we_o = biu_cyc_i & biu_stb_i & biu_we_i;
562
`endif
563
 
564
//
565
// WB sel_o
566
//
567
`ifdef OR1200_REGISTERED_OUTPUTS
568
 
569
// SynEDA CoreMultiplier
570
// assignment(s): wb_sel_o
571
// replace(s): wb_sel_o
572
always @(posedge wb_clk_i or posedge wb_rst_i)
573
        if (wb_rst_i)
574
                wb_sel_o <= #1 4'b0000;
575
        else begin  wb_sel_o <= wb_sel_o_cml_3;
576
                wb_sel_o <= #1 biu_sel_i; end
577
`else
578
assign wb_sel_o = biu_sel_i;
579
`endif
580
 
581
`ifdef OR1200_WB_CAB
582
//
583
// WB cab_o
584
//
585
`ifdef OR1200_REGISTERED_OUTPUTS
586
 
587
// SynEDA CoreMultiplier
588
// assignment(s): wb_cab_o
589
// replace(s): wb_cab_o
590
always @(posedge wb_clk_i or posedge wb_rst_i)
591
        if (wb_rst_i)
592
                wb_cab_o <= #1 1'b0;
593
        else begin  wb_cab_o <= wb_cab_o_cml_3;
594
                wb_cab_o <= #1 biu_cab_i; end
595
`else
596
assign wb_cab_o = biu_cab_i;
597
`endif
598
`endif
599
 
600
`ifdef OR1200_WB_B3
601
//
602
// Count burst beats
603
//
604
always @(posedge wb_clk_i or posedge wb_rst_i)
605
        if (wb_rst_i)
606
                burst_len <= #1 2'b00;
607
        else if (biu_cab_i && burst_len && wb_ack_i)
608
                burst_len <= #1 burst_len - 1'b1;
609
        else if (~biu_cab_i)
610
                burst_len <= #1 2'b11;
611
 
612
//
613
// WB cti_o
614
//
615
`ifdef OR1200_REGISTERED_OUTPUTS
616
always @(posedge wb_clk_i or posedge wb_rst_i)
617
        if (wb_rst_i)
618
                wb_cti_o <= #1 3'b000;  // classic cycle
619
`ifdef OR1200_NO_BURSTS
620
        else
621
                wb_cti_o <= #1 3'b111;  // end-of-burst
622
`else
623
        else if (biu_cab_i && burst_len[1])
624
                wb_cti_o <= #1 3'b010;  // incrementing burst cycle
625
        else if (biu_cab_i && wb_ack_i)
626
                wb_cti_o <= #1 3'b111;  // end-of-burst
627
`endif  // OR1200_NO_BURSTS
628
`else
629
Unsupported !!!;
630
`endif
631
 
632
//
633
// WB bte_o
634
//
635
assign wb_bte_o = 2'b01;        // 4-beat wrap burst
636
 
637
`endif  // OR1200_WB_B3
638
 
639
 
640
always @ (posedge clk_i_cml_1) begin
641
wb_ack_i_cml_1 <= wb_ack_i;
642
wb_err_i_cml_1 <= wb_err_i;
643
wb_dat_i_cml_1 <= wb_dat_i;
644
wb_cyc_o_cml_1 <= wb_cyc_o;
645
wb_adr_o_cml_1 <= wb_adr_o;
646
wb_stb_o_cml_1 <= wb_stb_o;
647
wb_we_o_cml_1 <= wb_we_o;
648
wb_sel_o_cml_1 <= wb_sel_o;
649
wb_dat_o_cml_1 <= wb_dat_o;
650
wb_cab_o_cml_1 <= wb_cab_o;
651
biu_ack_o_cml_1 <= biu_ack_o;
652
valid_div_cml_1 <= valid_div;
653
aborted_r_cml_1 <= aborted_r;
654
previous_complete_cml_1 <= previous_complete;
655
repeated_access_ack_cml_1 <= repeated_access_ack;
656
wb_dat_r_cml_1 <= wb_dat_r;
657
end
658
always @ (posedge clk_i_cml_2) begin
659
wb_ack_i_cml_2 <= wb_ack_i_cml_1;
660
wb_err_i_cml_2 <= wb_err_i_cml_1;
661
wb_dat_i_cml_2 <= wb_dat_i_cml_1;
662
wb_cyc_o_cml_2 <= wb_cyc_o_cml_1;
663
wb_adr_o_cml_2 <= wb_adr_o_cml_1;
664
wb_stb_o_cml_2 <= wb_stb_o_cml_1;
665
wb_we_o_cml_2 <= wb_we_o_cml_1;
666
wb_sel_o_cml_2 <= wb_sel_o_cml_1;
667
wb_dat_o_cml_2 <= wb_dat_o_cml_1;
668
wb_cab_o_cml_2 <= wb_cab_o_cml_1;
669
biu_ack_o_cml_2 <= biu_ack_o_cml_1;
670
valid_div_cml_2 <= valid_div_cml_1;
671
aborted_r_cml_2 <= aborted_r_cml_1;
672
previous_complete_cml_2 <= previous_complete_cml_1;
673
repeated_access_ack_cml_2 <= repeated_access_ack_cml_1;
674
wb_dat_r_cml_2 <= wb_dat_r_cml_1;
675
end
676
always @ (posedge clk_i_cml_3) begin
677
wb_ack_i_cml_3 <= wb_ack_i_cml_2;
678
wb_err_i_cml_3 <= wb_err_i_cml_2;
679
wb_dat_i_cml_3 <= wb_dat_i_cml_2;
680
wb_cyc_o_cml_3 <= wb_cyc_o_cml_2;
681
wb_adr_o_cml_3 <= wb_adr_o_cml_2;
682
wb_stb_o_cml_3 <= wb_stb_o_cml_2;
683
wb_we_o_cml_3 <= wb_we_o_cml_2;
684
wb_sel_o_cml_3 <= wb_sel_o_cml_2;
685
wb_dat_o_cml_3 <= wb_dat_o_cml_2;
686
wb_cab_o_cml_3 <= wb_cab_o_cml_2;
687
biu_ack_o_cml_3 <= biu_ack_o_cml_2;
688
valid_div_cml_3 <= valid_div_cml_2;
689
aborted_r_cml_3 <= aborted_r_cml_2;
690
previous_complete_cml_3 <= previous_complete_cml_2;
691
repeated_access_ack_cml_3 <= repeated_access_ack_cml_2;
692
wb_dat_r_cml_3 <= wb_dat_r_cml_2;
693
end
694
endmodule
695
 

powered by: WebSVN 2.1.0

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