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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [WB/] [wb_conbus_top.v] - Blame information for rev 3

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

Line No. Rev Author Line
1 2 dmitryr
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE Connection Bus Top Level                          ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Johny Chi                                          ////
7
////          chisuhua@yahoo.com.cn                              ////
8
////                                                             ////
9
////                                                             ////
10
////                                                             ////
11
/////////////////////////////////////////////////////////////////////
12
////                                                              ////
13
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
14
////                                                              ////
15
//// This source file may be used and distributed without         ////
16
//// restriction provided that this copyright statement is not    ////
17
//// removed from the file and that any derivative work contains  ////
18
//// the original copyright notice and the associated disclaimer. ////
19
////                                                              ////
20
//// This source file is free software; you can redistribute it   ////
21
//// and/or modify it under the terms of the GNU Lesser General   ////
22
//// Public License as published by the Free Software Foundation; ////
23
//// either version 2.1 of the License, or (at your option) any   ////
24
//// later version.                                               ////
25
////                                                              ////
26
//// This source is distributed in the hope that it will be       ////
27
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
28
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
29
//// PURPOSE.  See the GNU Lesser General Public License for more ////
30
//// details.                                                     ////
31
////                                                              ////
32
//// You should have received a copy of the GNU Lesser General    ////
33
//// Public License along with this source; if not, download it   ////
34
//// from http://www.opencores.org/lgpl.shtml                     ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
//
38
//  Description
39
//      1. Up to 8 masters and 8 slaves share bus Wishbone connection
40
//      2. no priorty arbitor , 8 masters are processed in a round
41
//         robin way,
42
//      3. if WB_USE_TRISTATE was defined, the share bus is a tristate
43
//         bus, and use less logic resource.
44
//      4. wb_conbus was synthesis to XC2S100-5-PQ208 using synplify,
45
//     Max speed >60M , and 374 SLICE if using Multiplexor bus
46
//              or 150 SLICE if using tri-state bus.
47
//
48
`include "wb_conbus_defines.v"
49
`define                 dw       64             // Data bus Width
50
`define                 aw       64             // Address bus Width
51
`define                 sw   `dw / 8    // Number of Select Lines
52
`define                 mbusw  `aw + `sw + `dw +4       //address width + byte select width + dat width + cyc + we + stb +cab , input from master interface
53
`define                 sbusw    3      //  ack + err + rty, input from slave interface
54
`define                 mselectw  8     // number of masters
55
`define                 sselectw  8     // number of slavers
56
 
57
//`define               WB_USE_TRISTATE
58
 
59
 
60
module wb_conbus_top(
61
        clk_i, rst_i,
62
 
63
        // Master 0 Interface
64
        m0_dat_i, m0_dat_o, m0_adr_i, m0_sel_i, m0_we_i, m0_cyc_i,
65
        m0_stb_i, m0_ack_o, m0_err_o, m0_rty_o, m0_cab_i,
66
 
67
        // Master 1 Interface
68
        m1_dat_i, m1_dat_o, m1_adr_i, m1_sel_i, m1_we_i, m1_cyc_i,
69
        m1_stb_i, m1_ack_o, m1_err_o, m1_rty_o, m1_cab_i,
70
 
71
        // Master 2 Interface
72
        m2_dat_i, m2_dat_o, m2_adr_i, m2_sel_i, m2_we_i, m2_cyc_i,
73
        m2_stb_i, m2_ack_o, m2_err_o, m2_rty_o, m2_cab_i,
74
 
75
        // Master 3 Interface
76
        m3_dat_i, m3_dat_o, m3_adr_i, m3_sel_i, m3_we_i, m3_cyc_i,
77
        m3_stb_i, m3_ack_o, m3_err_o, m3_rty_o, m3_cab_i,
78
 
79
        // Master 4 Interface
80
        m4_dat_i, m4_dat_o, m4_adr_i, m4_sel_i, m4_we_i, m4_cyc_i,
81
        m4_stb_i, m4_ack_o, m4_err_o, m4_rty_o, m4_cab_i,
82
 
83
        // Master 5 Interface
84
        m5_dat_i, m5_dat_o, m5_adr_i, m5_sel_i, m5_we_i, m5_cyc_i,
85
        m5_stb_i, m5_ack_o, m5_err_o, m5_rty_o, m5_cab_i,
86
 
87
        // Master 6 Interface
88
        m6_dat_i, m6_dat_o, m6_adr_i, m6_sel_i, m6_we_i, m6_cyc_i,
89
        m6_stb_i, m6_ack_o, m6_err_o, m6_rty_o, m6_cab_i,
90
 
91
        // Master 7 Interface
92
        m7_dat_i, m7_dat_o, m7_adr_i, m7_sel_i, m7_we_i, m7_cyc_i,
93
        m7_stb_i, m7_ack_o, m7_err_o, m7_rty_o, m7_cab_i,
94
 
95
        // Slave 0 Interface
96
        s0_dat_i, s0_dat_o, s0_adr_o, s0_sel_o, s0_we_o, s0_cyc_o,
97
        s0_stb_o, s0_ack_i, s0_err_i, s0_rty_i, s0_cab_o,
98
 
99
        // Slave 1 Interface
100
        s1_dat_i, s1_dat_o, s1_adr_o, s1_sel_o, s1_we_o, s1_cyc_o,
101
        s1_stb_o, s1_ack_i, s1_err_i, s1_rty_i, s1_cab_o,
102
 
103
        // Slave 2 Interface
104
        s2_dat_i, s2_dat_o, s2_adr_o, s2_sel_o, s2_we_o, s2_cyc_o,
105
        s2_stb_o, s2_ack_i, s2_err_i, s2_rty_i, s2_cab_o,
106
 
107
        // Slave 3 Interface
108
        s3_dat_i, s3_dat_o, s3_adr_o, s3_sel_o, s3_we_o, s3_cyc_o,
109
        s3_stb_o, s3_ack_i, s3_err_i, s3_rty_i, s3_cab_o,
110
 
111
        // Slave 4 Interface
112
        s4_dat_i, s4_dat_o, s4_adr_o, s4_sel_o, s4_we_o, s4_cyc_o,
113
        s4_stb_o, s4_ack_i, s4_err_i, s4_rty_i, s4_cab_o,
114
 
115
        // Slave 5 Interface
116
        s5_dat_i, s5_dat_o, s5_adr_o, s5_sel_o, s5_we_o, s5_cyc_o,
117
        s5_stb_o, s5_ack_i, s5_err_i, s5_rty_i, s5_cab_o,
118
 
119
        // Slave 6 Interface
120
        s6_dat_i, s6_dat_o, s6_adr_o, s6_sel_o, s6_we_o, s6_cyc_o,
121
        s6_stb_o, s6_ack_i, s6_err_i, s6_rty_i, s6_cab_o,
122
 
123
        // Slave 7 Interface
124
        s7_dat_i, s7_dat_o, s7_adr_o, s7_sel_o, s7_we_o, s7_cyc_o,
125
        s7_stb_o, s7_ack_i, s7_err_i, s7_rty_i, s7_cab_o
126
 
127
        );
128
 
129
////////////////////////////////////////////////////////////////////
130
//
131
// Module Parameters
132
//
133
 
134
 
135
parameter               s0_addr_w = 1 ;                 // slave 0 address decode width
136
parameter               s0_addr = 1'b0; // slave 0 address
137
parameter               s1_addr_w = 41 ;                        // slave 1 address decode width
138
parameter               s1_addr = {40'h800000FFF0,1'b0}; // slave 1 address 
139
parameter               s2_addr_w = 56 ;
140
parameter               s2_addr = {56'h800000FFF0C2C1}; // slave 2 address
141
parameter               s3_addr_w = 60 ;
142
parameter               s3_addr = {60'h800000FFF0C2C00}; // slave 3 address
143
parameter               s4_addr_w = 37 ;
144
parameter               s4_addr = {36'h800000FFF,1'b1}; // slave 4 address
145
parameter               s5_addr_w = 60 ;
146
parameter               s5_addr = {60'h400000F00000000}; // slave 5 address
147
parameter               s6_addr_w = 60 ;
148
parameter               s6_addr = {60'h500000F00000000}; // slave 6 address
149
parameter               s7_addr_w = 60 ;
150
parameter               s7_addr = {60'h600000F00000000}; // slave 7 address
151
 
152
 
153
////////////////////////////////////////////////////////////////////
154
//
155
// Module IOs
156
//
157
 
158
input           clk_i, rst_i;
159
 
160
// Master 0 Interface
161
input   [`dw-1:0]        m0_dat_i;
162
output  [`dw-1:0]        m0_dat_o;
163
input   [`aw-1:0]        m0_adr_i;
164
input   [`sw-1:0]        m0_sel_i;
165
input                   m0_we_i;
166
input                   m0_cyc_i;
167
input                   m0_stb_i;
168
input                   m0_cab_i;
169
output                  m0_ack_o;
170
output                  m0_err_o;
171
output                  m0_rty_o;
172
 
173
// Master 1 Interface
174
input   [`dw-1:0]        m1_dat_i;
175
output  [`dw-1:0]        m1_dat_o;
176
input   [`aw-1:0]        m1_adr_i;
177
input   [`sw-1:0]        m1_sel_i;
178
input                   m1_we_i;
179
input                   m1_cyc_i;
180
input                   m1_stb_i;
181
input                   m1_cab_i;
182
output                  m1_ack_o;
183
output                  m1_err_o;
184
output                  m1_rty_o;
185
 
186
// Master 2 Interface
187
input   [`dw-1:0]        m2_dat_i;
188
output  [`dw-1:0]        m2_dat_o;
189
input   [`aw-1:0]        m2_adr_i;
190
input   [`sw-1:0]        m2_sel_i;
191
input                   m2_we_i;
192
input                   m2_cyc_i;
193
input                   m2_stb_i;
194
input                   m2_cab_i;
195
output                  m2_ack_o;
196
output                  m2_err_o;
197
output                  m2_rty_o;
198
 
199
// Master 3 Interface
200
input   [`dw-1:0]        m3_dat_i;
201
output  [`dw-1:0]        m3_dat_o;
202
input   [`aw-1:0]        m3_adr_i;
203
input   [`sw-1:0]        m3_sel_i;
204
input                   m3_we_i;
205
input                   m3_cyc_i;
206
input                   m3_stb_i;
207
input                   m3_cab_i;
208
output                  m3_ack_o;
209
output                  m3_err_o;
210
output                  m3_rty_o;
211
 
212
// Master 4 Interface
213
input   [`dw-1:0]        m4_dat_i;
214
output  [`dw-1:0]        m4_dat_o;
215
input   [`aw-1:0]        m4_adr_i;
216
input   [`sw-1:0]        m4_sel_i;
217
input                   m4_we_i;
218
input                   m4_cyc_i;
219
input                   m4_stb_i;
220
input                   m4_cab_i;
221
output                  m4_ack_o;
222
output                  m4_err_o;
223
output                  m4_rty_o;
224
 
225
// Master 5 Interface
226
input   [`dw-1:0]        m5_dat_i;
227
output  [`dw-1:0]        m5_dat_o;
228
input   [`aw-1:0]        m5_adr_i;
229
input   [`sw-1:0]        m5_sel_i;
230
input                   m5_we_i;
231
input                   m5_cyc_i;
232
input                   m5_stb_i;
233
input                   m5_cab_i;
234
output                  m5_ack_o;
235
output                  m5_err_o;
236
output                  m5_rty_o;
237
 
238
// Master 6 Interface
239
input   [`dw-1:0]        m6_dat_i;
240
output  [`dw-1:0]        m6_dat_o;
241
input   [`aw-1:0]        m6_adr_i;
242
input   [`sw-1:0]        m6_sel_i;
243
input                   m6_we_i;
244
input                   m6_cyc_i;
245
input                   m6_stb_i;
246
input                   m6_cab_i;
247
output                  m6_ack_o;
248
output                  m6_err_o;
249
output                  m6_rty_o;
250
 
251
// Master 7 Interface
252
input   [`dw-1:0]        m7_dat_i;
253
output  [`dw-1:0]        m7_dat_o;
254
input   [`aw-1:0]        m7_adr_i;
255
input   [`sw-1:0]        m7_sel_i;
256
input                   m7_we_i;
257
input                   m7_cyc_i;
258
input                   m7_stb_i;
259
input                   m7_cab_i;
260
output                  m7_ack_o;
261
output                  m7_err_o;
262
output                  m7_rty_o;
263
 
264
// Slave 0 Interface
265
input   [`dw-1:0]        s0_dat_i;
266
output  [`dw-1:0]        s0_dat_o;
267
output  [`aw-1:0]        s0_adr_o;
268
output  [`sw-1:0]        s0_sel_o;
269
output                  s0_we_o;
270
output                  s0_cyc_o;
271
output                  s0_stb_o;
272
output                  s0_cab_o;
273
input                   s0_ack_i;
274
input                   s0_err_i;
275
input                   s0_rty_i;
276
 
277
// Slave 1 Interface
278
input   [`dw-1:0]        s1_dat_i;
279
output  [`dw-1:0]        s1_dat_o;
280
output  [`aw-1:0]        s1_adr_o;
281
output  [`sw-1:0]        s1_sel_o;
282
output                  s1_we_o;
283
output                  s1_cyc_o;
284
output                  s1_stb_o;
285
output                  s1_cab_o;
286
input                   s1_ack_i;
287
input                   s1_err_i;
288
input                   s1_rty_i;
289
 
290
// Slave 2 Interface
291
input   [`dw-1:0]        s2_dat_i;
292
output  [`dw-1:0]        s2_dat_o;
293
output  [`aw-1:0]        s2_adr_o;
294
output  [`sw-1:0]        s2_sel_o;
295
output                  s2_we_o;
296
output                  s2_cyc_o;
297
output                  s2_stb_o;
298
output                  s2_cab_o;
299
input                   s2_ack_i;
300
input                   s2_err_i;
301
input                   s2_rty_i;
302
 
303
// Slave 3 Interface
304
input   [`dw-1:0]        s3_dat_i;
305
output  [`dw-1:0]        s3_dat_o;
306
output  [`aw-1:0]        s3_adr_o;
307
output  [`sw-1:0]        s3_sel_o;
308
output                  s3_we_o;
309
output                  s3_cyc_o;
310
output                  s3_stb_o;
311
output                  s3_cab_o;
312
input                   s3_ack_i;
313
input                   s3_err_i;
314
input                   s3_rty_i;
315
 
316
// Slave 4 Interface
317
input   [`dw-1:0]        s4_dat_i;
318
output  [`dw-1:0]        s4_dat_o;
319
output  [`aw-1:0]        s4_adr_o;
320
output  [`sw-1:0]        s4_sel_o;
321
output                  s4_we_o;
322
output                  s4_cyc_o;
323
output                  s4_stb_o;
324
output                  s4_cab_o;
325
input                   s4_ack_i;
326
input                   s4_err_i;
327
input                   s4_rty_i;
328
 
329
// Slave 5 Interface
330
input   [`dw-1:0]        s5_dat_i;
331
output  [`dw-1:0]        s5_dat_o;
332
output  [`aw-1:0]        s5_adr_o;
333
output  [`sw-1:0]        s5_sel_o;
334
output                  s5_we_o;
335
output                  s5_cyc_o;
336
output                  s5_stb_o;
337
output                  s5_cab_o;
338
input                   s5_ack_i;
339
input                   s5_err_i;
340
input                   s5_rty_i;
341
 
342
// Slave 6 Interface
343
input   [`dw-1:0]        s6_dat_i;
344
output  [`dw-1:0]        s6_dat_o;
345
output  [`aw-1:0]        s6_adr_o;
346
output  [`sw-1:0]        s6_sel_o;
347
output                  s6_we_o;
348
output                  s6_cyc_o;
349
output                  s6_stb_o;
350
output                  s6_cab_o;
351
input                   s6_ack_i;
352
input                   s6_err_i;
353
input                   s6_rty_i;
354
 
355
// Slave 7 Interface
356
input   [`dw-1:0]        s7_dat_i;
357
output  [`dw-1:0]        s7_dat_o;
358
output  [`aw-1:0]        s7_adr_o;
359
output  [`sw-1:0]        s7_sel_o;
360
output                  s7_we_o;
361
output                  s7_cyc_o;
362
output                  s7_stb_o;
363
output                  s7_cab_o;
364
input                   s7_ack_i;
365
input                   s7_err_i;
366
input                   s7_rty_i;
367
 
368
 
369
////////////////////////////////////////////////////////////////////
370
//
371
// Local wires
372
//
373
 
374
wire    [`mselectw -1:0] i_gnt_arb;
375
wire    [2:0]    gnt;
376
reg     [`sselectw -1:0] i_ssel_dec;
377
`ifdef  WB_USE_TRISTATE
378
wire    [`mbusw -1:0]    i_bus_m;
379
`else
380
reg             [`mbusw -1:0]    i_bus_m;                // internal share bus, master data and control to slave
381
`endif
382
wire            [`dw -1:0]               i_dat_s;        // internal share bus , slave data to master
383
wire    [`sbusw -1:0]    i_bus_s;                        // internal share bus , slave control to master
384
 
385
 
386
 
387
////////////////////////////////////////////////////////////////////
388
//
389
// Master output Interfaces
390
//
391
 
392
// master0
393
assign  m0_dat_o = i_dat_s;
394
assign  {m0_ack_o, m0_err_o, m0_rty_o} = i_bus_s & {3{i_gnt_arb[0]}};
395
 
396
// master1
397
assign  m1_dat_o = i_dat_s;
398
assign  {m1_ack_o, m1_err_o, m1_rty_o} = i_bus_s & {3{i_gnt_arb[1]}};
399
 
400
// master2
401
 
402
assign  m2_dat_o = i_dat_s;
403
assign  {m2_ack_o, m2_err_o, m2_rty_o} = i_bus_s & {3{i_gnt_arb[2]}};
404
 
405
// master3
406
 
407
assign  m3_dat_o = i_dat_s;
408
assign  {m3_ack_o, m3_err_o, m3_rty_o} = i_bus_s & {3{i_gnt_arb[3]}};
409
 
410
// master4
411
 
412
assign  m4_dat_o = i_dat_s;
413
assign  {m4_ack_o, m4_err_o, m4_rty_o} = i_bus_s & {3{i_gnt_arb[4]}};
414
 
415
// master5
416
 
417
assign  m5_dat_o = i_dat_s;
418
assign  {m5_ack_o, m5_err_o, m5_rty_o} = i_bus_s & {3{i_gnt_arb[5]}};
419
 
420
// master6
421
 
422
assign  m6_dat_o = i_dat_s;
423
assign  {m6_ack_o, m6_err_o, m6_rty_o} = i_bus_s & {3{i_gnt_arb[6]}};
424
 
425
// master7
426
 
427
assign  m7_dat_o = i_dat_s;
428
assign  {m7_ack_o, m7_err_o, m7_rty_o} = i_bus_s & {3{i_gnt_arb[7]}};
429
 
430
 
431
assign  i_bus_s = {s0_ack_i | s1_ack_i | s2_ack_i | s3_ack_i | s4_ack_i | s5_ack_i | s6_ack_i | s7_ack_i ,
432
                                   s0_err_i | s1_err_i | s2_err_i | s3_err_i | s4_err_i | s5_err_i | s6_err_i | s7_err_i ,
433
                                   s0_rty_i | s1_rty_i | s2_rty_i | s3_rty_i | s4_rty_i | s5_rty_i | s6_rty_i | s7_rty_i };
434
 
435
////////////////////////////////
436
//      Slave output interface
437
//
438
// slave0
439
assign  {s0_adr_o, s0_sel_o, s0_dat_o, s0_we_o, s0_cab_o,s0_cyc_o} = i_bus_m[`mbusw -1:1];
440
assign  s0_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[0];  // stb_o = cyc_i & stb_i & i_ssel_dec
441
 
442
// slave1
443
 
444
assign  {s1_adr_o, s1_sel_o, s1_dat_o, s1_we_o, s1_cab_o, s1_cyc_o} = i_bus_m[`mbusw -1:1];
445
assign  s1_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[1];
446
 
447
// slave2
448
 
449
assign  {s2_adr_o, s2_sel_o, s2_dat_o, s2_we_o, s2_cab_o, s2_cyc_o} = i_bus_m[`mbusw -1:1];
450
assign  s2_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[2];
451
 
452
// slave3
453
 
454
assign  {s3_adr_o, s3_sel_o, s3_dat_o, s3_we_o, s3_cab_o, s3_cyc_o} = i_bus_m[`mbusw -1:1];
455
assign  s3_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[3];
456
 
457
// slave4
458
 
459
assign  {s4_adr_o, s4_sel_o, s4_dat_o, s4_we_o, s4_cab_o, s4_cyc_o} = i_bus_m[`mbusw -1:1];
460
assign  s4_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[4];
461
 
462
// slave5
463
 
464
assign  {s5_adr_o, s5_sel_o, s5_dat_o, s5_we_o, s5_cab_o, s5_cyc_o} = i_bus_m[`mbusw -1:1];
465
assign  s5_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[5];
466
 
467
// slave6
468
 
469
assign  {s6_adr_o, s6_sel_o, s6_dat_o, s6_we_o, s6_cab_o, s6_cyc_o} = i_bus_m[`mbusw -1:1];
470
assign  s6_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[6];
471
 
472
// slave7
473
 
474
assign  {s7_adr_o, s7_sel_o, s7_dat_o, s7_we_o, s7_cab_o, s7_cyc_o} = i_bus_m[`mbusw -1:1];
475
assign  s7_stb_o = i_bus_m[1] & i_bus_m[0] & i_ssel_dec[7];
476
 
477
///////////////////////////////////////
478
//      Master and Slave input interface
479
//
480
 
481
`ifdef  WB_USE_TRISTATE
482
// input from master interface
483
assign  i_bus_m = i_gnt_arb[0] ? {m0_adr_i, m0_sel_i, m0_dat_i, m0_we_i, m0_cab_i, m0_cyc_i, m0_stb_i} : 72'bz ;
484
assign  i_bus_m = i_gnt_arb[1] ? {m1_adr_i, m1_sel_i, m1_dat_i, m1_we_i, m1_cab_i,m1_cyc_i, m1_stb_i} : 72'bz ;
485
assign  i_bus_m = i_gnt_arb[2] ? {m2_adr_i, m2_sel_i, m2_dat_i,  m2_we_i, m2_cab_i, m2_cyc_i, m2_stb_i} : 72'bz ;
486
assign  i_bus_m = i_gnt_arb[3] ? {m3_adr_i, m3_sel_i, m3_dat_i,  m3_we_i, m3_cab_i, m3_cyc_i, m3_stb_i} : 72'bz ;
487
assign  i_bus_m = i_gnt_arb[4] ? {m4_adr_i, m4_sel_i, m4_dat_i,  m4_we_i, m4_cab_i, m4_cyc_i, m4_stb_i} : 72'bz ;
488
assign  i_bus_m = i_gnt_arb[5] ? {m5_adr_i, m5_sel_i, m5_dat_i, m5_we_i, m5_cab_i, m5_cyc_i,  m5_stb_i} : 72'bz ;
489
assign  i_bus_m = i_gnt_arb[6] ? {m6_adr_i, m6_sel_i, m6_dat_i, m6_we_i, m6_cab_i, m6_cyc_i, m6_stb_i} : 72'bz ;
490
assign  i_bus_m = i_gnt_arb[7] ? {m7_adr_i, m7_sel_i, m7_dat_i, m7_we_i, m7_cab_i, m7_cyc_i,m7_stb_i} : 72'bz ;
491
// input from slave interface
492
assign  i_dat_s = i_ssel_dec[0] ? s0_dat_i: 32'bz;
493
assign  i_dat_s = i_ssel_dec[1] ? s1_dat_i: 32'bz;
494
assign  i_dat_s = i_ssel_dec[2] ? s2_dat_i: 32'bz;
495
assign  i_dat_s = i_ssel_dec[3] ? s3_dat_i: 32'bz;
496
assign  i_dat_s = i_ssel_dec[4] ? s4_dat_i: 32'bz;
497
assign  i_dat_s = i_ssel_dec[5] ? s5_dat_i: 32'bz;
498
assign  i_dat_s = i_ssel_dec[6] ? s6_dat_i: 32'bz;
499
assign  i_dat_s = i_ssel_dec[7] ? s7_dat_i: 32'bz;
500
 
501
`else
502
 
503
always @(gnt , m0_adr_i, m0_sel_i, m0_dat_i, m0_we_i, m0_cab_i, m0_cyc_i,m0_stb_i,
504
                m1_adr_i, m1_sel_i, m1_dat_i, m1_we_i, m1_cab_i, m1_cyc_i,m1_stb_i,
505
                m2_adr_i, m2_sel_i, m2_dat_i, m2_we_i, m2_cab_i, m2_cyc_i,m2_stb_i,
506
                m3_adr_i, m3_sel_i, m3_dat_i, m3_we_i, m3_cab_i, m3_cyc_i,m3_stb_i,
507
                m4_adr_i, m4_sel_i, m4_dat_i, m4_we_i, m4_cab_i, m4_cyc_i,m4_stb_i,
508
                m5_adr_i, m5_sel_i, m5_dat_i, m5_we_i, m5_cab_i, m5_cyc_i,m5_stb_i,
509
                m6_adr_i, m6_sel_i, m6_dat_i, m6_we_i, m6_cab_i, m6_cyc_i,m6_stb_i,
510
                m7_adr_i, m7_sel_i, m7_dat_i, m7_we_i, m7_cab_i, m7_cyc_i,m7_stb_i)
511
                case(gnt)
512
                        3'h0:   i_bus_m = {m0_adr_i, m0_sel_i, m0_dat_i, m0_we_i, m0_cab_i, m0_cyc_i,m0_stb_i};
513
                        3'h1:   i_bus_m = {m1_adr_i, m1_sel_i, m1_dat_i, m1_we_i, m1_cab_i, m1_cyc_i,m1_stb_i};
514
                        3'h2:   i_bus_m = {m2_adr_i, m2_sel_i, m2_dat_i, m2_we_i, m2_cab_i, m2_cyc_i,m2_stb_i};
515
                        3'h3:   i_bus_m = {m3_adr_i, m3_sel_i, m3_dat_i, m3_we_i, m3_cab_i, m3_cyc_i,m3_stb_i};
516
                        3'h4:   i_bus_m = {m4_adr_i, m4_sel_i, m4_dat_i, m4_we_i, m4_cab_i, m4_cyc_i,m4_stb_i};
517
                        3'h5:   i_bus_m = {m5_adr_i, m5_sel_i, m5_dat_i, m5_we_i, m5_cab_i, m5_cyc_i,m5_stb_i};
518
                        3'h6:   i_bus_m = {m6_adr_i, m6_sel_i, m6_dat_i, m6_we_i, m6_cab_i, m6_cyc_i,m6_stb_i};
519
                        3'h7:   i_bus_m = {m7_adr_i, m7_sel_i, m7_dat_i, m7_we_i, m7_cab_i, m7_cyc_i,m7_stb_i};
520
                        default:i_bus_m =  72'b0;//{m0_adr_i, m0_sel_i, m0_dat_i, m0_we_i, m0_cab_i, m0_cyc_i,m0_stb_i};
521
endcase
522
 
523
assign  i_dat_s = i_ssel_dec[0] ? s0_dat_i :
524
                                  i_ssel_dec[1] ? s1_dat_i :
525
                                  i_ssel_dec[2] ? s2_dat_i :
526
                                  i_ssel_dec[3] ? s3_dat_i :
527
                                  i_ssel_dec[4] ? s4_dat_i :
528
                                  i_ssel_dec[5] ? s5_dat_i :
529
                                  i_ssel_dec[6] ? s6_dat_i :
530
                                  i_ssel_dec[7] ? s7_dat_i : {`dw{1'b0}};
531
`endif
532
//
533
// arbitor 
534
//
535
assign i_gnt_arb[0] = (gnt == 3'd0);
536
assign i_gnt_arb[1] = (gnt == 3'd1);
537
assign i_gnt_arb[2] = (gnt == 3'd2);
538
assign i_gnt_arb[3] = (gnt == 3'd3);
539
assign i_gnt_arb[4] = (gnt == 3'd4);
540
assign i_gnt_arb[5] = (gnt == 3'd5);
541
assign i_gnt_arb[6] = (gnt == 3'd6);
542
assign i_gnt_arb[7] = (gnt == 3'd7);
543
 
544
wb_conbus_arb   wb_conbus_arb(
545
        .clk(clk_i),
546
        .rst(rst_i),
547
        .req({  m7_cyc_i,
548
                m6_cyc_i,
549
                m5_cyc_i,
550
                m4_cyc_i,
551
                m3_cyc_i,
552
                m2_cyc_i,
553
                m1_cyc_i,
554
                m0_cyc_i}),
555
        .gnt(gnt)
556
);
557
 
558
//////////////////////////////////
559
//              address decode logic
560
//
561
wire [7:0]       m0_ssel_dec, m1_ssel_dec, m2_ssel_dec, m3_ssel_dec, m4_ssel_dec, m5_ssel_dec, m6_ssel_dec, m7_ssel_dec;
562
always @(gnt, m0_ssel_dec, m1_ssel_dec, m2_ssel_dec, m3_ssel_dec, m4_ssel_dec, m5_ssel_dec, m6_ssel_dec, m7_ssel_dec)
563
        case(gnt)
564
                3'h0: i_ssel_dec = m0_ssel_dec;
565
                3'h1: i_ssel_dec = m1_ssel_dec;
566
                3'h2: i_ssel_dec = m2_ssel_dec;
567
                3'h3: i_ssel_dec = m3_ssel_dec;
568
                3'h4: i_ssel_dec = m4_ssel_dec;
569
                3'h5: i_ssel_dec = m5_ssel_dec;
570
                3'h6: i_ssel_dec = m6_ssel_dec;
571
                3'h7: i_ssel_dec = m7_ssel_dec;
572
                default: i_ssel_dec = 7'b0;
573
endcase
574
//
575
//      decode all master address before arbitor for running faster
576
//      
577
assign m0_ssel_dec[0] = (m0_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
578
assign m0_ssel_dec[1] = (m0_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
579
assign m0_ssel_dec[2] = (m0_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
580
assign m0_ssel_dec[3] = (m0_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
581
assign m0_ssel_dec[4] = (m0_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
582
assign m0_ssel_dec[5] = (m0_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
583
assign m0_ssel_dec[6] = (m0_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
584
assign m0_ssel_dec[7] = (m0_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
585
 
586
assign m1_ssel_dec[0] = (m1_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
587
assign m1_ssel_dec[1] = (m1_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
588
assign m1_ssel_dec[2] = (m1_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
589
assign m1_ssel_dec[3] = (m1_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
590
assign m1_ssel_dec[4] = (m1_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
591
assign m1_ssel_dec[5] = (m1_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
592
assign m1_ssel_dec[6] = (m1_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
593
assign m1_ssel_dec[7] = (m1_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
594
 
595
assign m2_ssel_dec[0] = (m2_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
596
assign m2_ssel_dec[1] = (m2_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
597
assign m2_ssel_dec[2] = (m2_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
598
assign m2_ssel_dec[3] = (m2_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
599
assign m2_ssel_dec[4] = (m2_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
600
assign m2_ssel_dec[5] = (m2_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
601
assign m2_ssel_dec[6] = (m2_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
602
assign m2_ssel_dec[7] = (m2_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
603
 
604
assign m3_ssel_dec[0] = (m3_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
605
assign m3_ssel_dec[1] = (m3_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
606
assign m3_ssel_dec[2] = (m3_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
607
assign m3_ssel_dec[3] = (m3_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
608
assign m3_ssel_dec[4] = (m3_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
609
assign m3_ssel_dec[5] = (m3_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
610
assign m3_ssel_dec[6] = (m3_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
611
assign m3_ssel_dec[7] = (m3_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
612
 
613
assign m4_ssel_dec[0] = (m4_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
614
assign m4_ssel_dec[1] = (m4_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
615
assign m4_ssel_dec[2] = (m4_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
616
assign m4_ssel_dec[3] = (m4_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
617
assign m4_ssel_dec[4] = (m4_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
618
assign m4_ssel_dec[5] = (m4_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
619
assign m4_ssel_dec[6] = (m4_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
620
assign m4_ssel_dec[7] = (m4_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
621
 
622
assign m5_ssel_dec[0] = (m5_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
623
assign m5_ssel_dec[1] = (m5_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
624
assign m5_ssel_dec[2] = (m5_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
625
assign m5_ssel_dec[3] = (m5_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
626
assign m5_ssel_dec[4] = (m5_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
627
assign m5_ssel_dec[5] = (m5_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
628
assign m5_ssel_dec[6] = (m5_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
629
assign m5_ssel_dec[7] = (m5_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
630
 
631
assign m6_ssel_dec[0] = (m6_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
632
assign m6_ssel_dec[1] = (m6_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
633
assign m6_ssel_dec[2] = (m6_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
634
assign m6_ssel_dec[3] = (m6_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
635
assign m6_ssel_dec[4] = (m6_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
636
assign m6_ssel_dec[5] = (m6_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
637
assign m6_ssel_dec[6] = (m6_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
638
assign m6_ssel_dec[7] = (m6_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
639
 
640
assign m7_ssel_dec[0] = (m7_adr_i[`aw -1 : `aw - s0_addr_w ] == s0_addr);
641
assign m7_ssel_dec[1] = (m7_adr_i[`aw -1 : `aw - s1_addr_w ] == s1_addr);
642
assign m7_ssel_dec[2] = (m7_adr_i[`aw -1 : `aw - s2_addr_w ] == s2_addr);
643
assign m7_ssel_dec[3] = (m7_adr_i[`aw -1 : `aw - s3_addr_w ] == s3_addr);
644
assign m7_ssel_dec[4] = (m7_adr_i[`aw -1 : `aw - s4_addr_w ] == s4_addr);
645
assign m7_ssel_dec[5] = (m7_adr_i[`aw -1 : `aw - s5_addr_w ] == s5_addr);
646
assign m7_ssel_dec[6] = (m7_adr_i[`aw -1 : `aw - s6_addr_w ] == s6_addr);
647
assign m7_ssel_dec[7] = (m7_adr_i[`aw -1 : `aw - s7_addr_w ] == s7_addr);
648
 
649
//assign i_ssel_dec[0] = (i_bus_m[`mbusw -1 : `mbusw - s0_addr_w ] == s0_addr);
650
//assign i_ssel_dec[1] = (i_bus_m[`mbusw -1 : `mbusw - s1_addr_w ] == s1_addr);
651
//assign i_ssel_dec[2] = (i_bus_m[`mbusw -1 : `mbusw - s27_addr_w ] == s2_addr);
652
//assign i_ssel_dec[3] = (i_bus_m[`mbusw -1 : `mbusw - s27_addr_w ] == s3_addr);
653
//assign i_ssel_dec[4] = (i_bus_m[`mbusw -1 : `mbusw - s27_addr_w ] == s4_addr);
654
//assign i_ssel_dec[5] = (i_bus_m[`mbusw -1 : `mbusw - s27_addr_w ] == s5_addr);
655
//assign i_ssel_dec[6] = (i_bus_m[`mbusw -1 : `mbusw - s27_addr_w ] == s6_addr);
656
//assign i_ssel_dec[7] = (i_bus_m[`mbusw -1 : `mbusw - s27_addr_w ] == s7_addr);
657
 
658
 
659
endmodule
660
 

powered by: WebSVN 2.1.0

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