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

Subversion Repositories openriscdevboard

[/] [openriscdevboard/] [trunk/] [cyc2-openrisc/] [rtl/] [top/] [tc_top.v] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Traffic Cop                                                 ////
4
////                                                              ////
5
////  Description                                                 ////
6
////  This block connectes the RISC and peripheral controller     ////
7
////  cores together.                                             ////
8
////                                                              ////
9
////  To Do:                                                      ////
10
////   - nothing really                                           ////
11
////                                                              ////
12
////  Author(s):                                                  ////
13
////      - Damjan Lampret, lampret@opencores.org                 ////
14
////      - Steve Fielding, sfielding@base2designs.com            ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2002 OpenCores                                 ////
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
//Modified by Steve Fielding, sfielding@base2designs.com April 2008
44
//Fixed bug that was preventing traffic cop to work with Opencores SDRAM
45
//controller.
46
//Multiple concurrent accesses to SDRAM where not being seperated by
47
//de-assertion of cyc and stb, and the SDRAM controller was getting confused
48
 
49
// synopsys translate_off
50
`include "timescale.v"
51
// synopsys translate_on
52
 
53
//
54
// Width of address bus
55
//
56
`define TC_AW           32
57
 
58
//
59
// Width of data bus
60
//
61
`define TC_DW           32
62
 
63
//
64
// Width of byte select bus
65
//
66
`define TC_BSW          4
67
 
68
//
69
// Width of WB target inputs (coming from WB slave)
70
//
71
// data bus width + ack + err
72
//
73
`define TC_TIN_W        `TC_DW+1+1
74
 
75
//
76
// Width of WB initiator inputs (coming from WB masters)
77
//
78
// cyc + stb + cab + address bus width +
79
// byte select bus width + we + data bus width
80
//
81
`define TC_IIN_W        1+1+1+`TC_AW+`TC_BSW+1+`TC_DW
82
 
83
//
84
// Traffic Cop Top
85
//
86
module tc_top (
87
        wb_clk_i,
88
        wb_rst_i,
89
 
90
        i0_wb_cyc_i,
91
        i0_wb_stb_i,
92
        i0_wb_cab_i,
93
        i0_wb_adr_i,
94
        i0_wb_sel_i,
95
        i0_wb_we_i,
96
        i0_wb_dat_i,
97
        i0_wb_dat_o,
98
        i0_wb_ack_o,
99
        i0_wb_err_o,
100
 
101
        i1_wb_cyc_i,
102
        i1_wb_stb_i,
103
        i1_wb_cab_i,
104
        i1_wb_adr_i,
105
        i1_wb_sel_i,
106
        i1_wb_we_i,
107
        i1_wb_dat_i,
108
        i1_wb_dat_o,
109
        i1_wb_ack_o,
110
        i1_wb_err_o,
111
 
112
        i2_wb_cyc_i,
113
        i2_wb_stb_i,
114
        i2_wb_cab_i,
115
        i2_wb_adr_i,
116
        i2_wb_sel_i,
117
        i2_wb_we_i,
118
        i2_wb_dat_i,
119
        i2_wb_dat_o,
120
        i2_wb_ack_o,
121
        i2_wb_err_o,
122
 
123
        i3_wb_cyc_i,
124
        i3_wb_stb_i,
125
        i3_wb_cab_i,
126
        i3_wb_adr_i,
127
        i3_wb_sel_i,
128
        i3_wb_we_i,
129
        i3_wb_dat_i,
130
        i3_wb_dat_o,
131
        i3_wb_ack_o,
132
        i3_wb_err_o,
133
 
134
        i4_wb_cyc_i,
135
        i4_wb_stb_i,
136
        i4_wb_cab_i,
137
        i4_wb_adr_i,
138
        i4_wb_sel_i,
139
        i4_wb_we_i,
140
        i4_wb_dat_i,
141
        i4_wb_dat_o,
142
        i4_wb_ack_o,
143
        i4_wb_err_o,
144
 
145
        i5_wb_cyc_i,
146
        i5_wb_stb_i,
147
        i5_wb_cab_i,
148
        i5_wb_adr_i,
149
        i5_wb_sel_i,
150
        i5_wb_we_i,
151
        i5_wb_dat_i,
152
        i5_wb_dat_o,
153
        i5_wb_ack_o,
154
        i5_wb_err_o,
155
 
156
        i6_wb_cyc_i,
157
        i6_wb_stb_i,
158
        i6_wb_cab_i,
159
        i6_wb_adr_i,
160
        i6_wb_sel_i,
161
        i6_wb_we_i,
162
        i6_wb_dat_i,
163
        i6_wb_dat_o,
164
        i6_wb_ack_o,
165
        i6_wb_err_o,
166
 
167
        i7_wb_cyc_i,
168
        i7_wb_stb_i,
169
        i7_wb_cab_i,
170
        i7_wb_adr_i,
171
        i7_wb_sel_i,
172
        i7_wb_we_i,
173
        i7_wb_dat_i,
174
        i7_wb_dat_o,
175
        i7_wb_ack_o,
176
        i7_wb_err_o,
177
 
178
        t0_wb_cyc_o,
179
        t0_wb_stb_o,
180
        t0_wb_cab_o,
181
        t0_wb_adr_o,
182
        t0_wb_sel_o,
183
        t0_wb_we_o,
184
        t0_wb_dat_o,
185
        t0_wb_dat_i,
186
        t0_wb_ack_i,
187
        t0_wb_err_i,
188
 
189
        t1_wb_cyc_o,
190
        t1_wb_stb_o,
191
        t1_wb_cab_o,
192
        t1_wb_adr_o,
193
        t1_wb_sel_o,
194
        t1_wb_we_o,
195
        t1_wb_dat_o,
196
        t1_wb_dat_i,
197
        t1_wb_ack_i,
198
        t1_wb_err_i,
199
 
200
        t2_wb_cyc_o,
201
        t2_wb_stb_o,
202
        t2_wb_cab_o,
203
        t2_wb_adr_o,
204
        t2_wb_sel_o,
205
        t2_wb_we_o,
206
        t2_wb_dat_o,
207
        t2_wb_dat_i,
208
        t2_wb_ack_i,
209
        t2_wb_err_i,
210
 
211
        t3_wb_cyc_o,
212
        t3_wb_stb_o,
213
        t3_wb_cab_o,
214
        t3_wb_adr_o,
215
        t3_wb_sel_o,
216
        t3_wb_we_o,
217
        t3_wb_dat_o,
218
        t3_wb_dat_i,
219
        t3_wb_ack_i,
220
        t3_wb_err_i,
221
 
222
        t4_wb_cyc_o,
223
        t4_wb_stb_o,
224
        t4_wb_cab_o,
225
        t4_wb_adr_o,
226
        t4_wb_sel_o,
227
        t4_wb_we_o,
228
        t4_wb_dat_o,
229
        t4_wb_dat_i,
230
        t4_wb_ack_i,
231
        t4_wb_err_i,
232
 
233
        t5_wb_cyc_o,
234
        t5_wb_stb_o,
235
        t5_wb_cab_o,
236
        t5_wb_adr_o,
237
        t5_wb_sel_o,
238
        t5_wb_we_o,
239
        t5_wb_dat_o,
240
        t5_wb_dat_i,
241
        t5_wb_ack_i,
242
        t5_wb_err_i,
243
 
244
        t6_wb_cyc_o,
245
        t6_wb_stb_o,
246
        t6_wb_cab_o,
247
        t6_wb_adr_o,
248
        t6_wb_sel_o,
249
        t6_wb_we_o,
250
        t6_wb_dat_o,
251
        t6_wb_dat_i,
252
        t6_wb_ack_i,
253
        t6_wb_err_i,
254
 
255
        t7_wb_cyc_o,
256
        t7_wb_stb_o,
257
        t7_wb_cab_o,
258
        t7_wb_adr_o,
259
        t7_wb_sel_o,
260
        t7_wb_we_o,
261
        t7_wb_dat_o,
262
        t7_wb_dat_i,
263
        t7_wb_ack_i,
264
        t7_wb_err_i,
265
 
266
        t8_wb_cyc_o,
267
        t8_wb_stb_o,
268
        t8_wb_cab_o,
269
        t8_wb_adr_o,
270
        t8_wb_sel_o,
271
        t8_wb_we_o,
272
        t8_wb_dat_o,
273
        t8_wb_dat_i,
274
        t8_wb_ack_i,
275
        t8_wb_err_i
276
 
277
);
278
 
279
//
280
// Parameters
281
//
282
parameter               t0_addr_w = 4;
283
parameter               t0_addr = 4'd8;
284
parameter               t1_addr_w = 4;
285
parameter               t1_addr = 4'd0;
286
parameter               t28c_addr_w = 4;
287
parameter               t28_addr = 4'd0;
288
parameter               t28i_addr_w = 4;
289
parameter               t2_addr = 4'd1;
290
parameter               t3_addr = 4'd2;
291
parameter               t4_addr = 4'd3;
292
parameter               t5_addr = 4'd4;
293
parameter               t6_addr = 4'd5;
294
parameter               t7_addr = 4'd6;
295
parameter               t8_addr = 4'd7;
296
 
297
//
298
// I/O Ports
299
//
300
input                   wb_clk_i;
301
input                   wb_rst_i;
302
 
303
//
304
// WB slave i/f connecting initiator 0
305
//
306
input                   i0_wb_cyc_i;
307
input                   i0_wb_stb_i;
308
input                   i0_wb_cab_i;
309
input   [`TC_AW-1:0]     i0_wb_adr_i;
310
input   [`TC_BSW-1:0]    i0_wb_sel_i;
311
input                   i0_wb_we_i;
312
input   [`TC_DW-1:0]     i0_wb_dat_i;
313
output  [`TC_DW-1:0]     i0_wb_dat_o;
314
output                  i0_wb_ack_o;
315
output                  i0_wb_err_o;
316
 
317
//
318
// WB slave i/f connecting initiator 1
319
//
320
input                   i1_wb_cyc_i;
321
input                   i1_wb_stb_i;
322
input                   i1_wb_cab_i;
323
input   [`TC_AW-1:0]     i1_wb_adr_i;
324
input   [`TC_BSW-1:0]    i1_wb_sel_i;
325
input                   i1_wb_we_i;
326
input   [`TC_DW-1:0]     i1_wb_dat_i;
327
output  [`TC_DW-1:0]     i1_wb_dat_o;
328
output                  i1_wb_ack_o;
329
output                  i1_wb_err_o;
330
 
331
//
332
// WB slave i/f connecting initiator 2
333
//
334
input                   i2_wb_cyc_i;
335
input                   i2_wb_stb_i;
336
input                   i2_wb_cab_i;
337
input   [`TC_AW-1:0]     i2_wb_adr_i;
338
input   [`TC_BSW-1:0]    i2_wb_sel_i;
339
input                   i2_wb_we_i;
340
input   [`TC_DW-1:0]     i2_wb_dat_i;
341
output  [`TC_DW-1:0]     i2_wb_dat_o;
342
output                  i2_wb_ack_o;
343
output                  i2_wb_err_o;
344
 
345
//
346
// WB slave i/f connecting initiator 3
347
//
348
input                   i3_wb_cyc_i;
349
input                   i3_wb_stb_i;
350
input                   i3_wb_cab_i;
351
input   [`TC_AW-1:0]     i3_wb_adr_i;
352
input   [`TC_BSW-1:0]    i3_wb_sel_i;
353
input                   i3_wb_we_i;
354
input   [`TC_DW-1:0]     i3_wb_dat_i;
355
output  [`TC_DW-1:0]     i3_wb_dat_o;
356
output                  i3_wb_ack_o;
357
output                  i3_wb_err_o;
358
 
359
//
360
// WB slave i/f connecting initiator 4
361
//
362
input                   i4_wb_cyc_i;
363
input                   i4_wb_stb_i;
364
input                   i4_wb_cab_i;
365
input   [`TC_AW-1:0]     i4_wb_adr_i;
366
input   [`TC_BSW-1:0]    i4_wb_sel_i;
367
input                   i4_wb_we_i;
368
input   [`TC_DW-1:0]     i4_wb_dat_i;
369
output  [`TC_DW-1:0]     i4_wb_dat_o;
370
output                  i4_wb_ack_o;
371
output                  i4_wb_err_o;
372
 
373
//
374
// WB slave i/f connecting initiator 5
375
//
376
input                   i5_wb_cyc_i;
377
input                   i5_wb_stb_i;
378
input                   i5_wb_cab_i;
379
input   [`TC_AW-1:0]     i5_wb_adr_i;
380
input   [`TC_BSW-1:0]    i5_wb_sel_i;
381
input                   i5_wb_we_i;
382
input   [`TC_DW-1:0]     i5_wb_dat_i;
383
output  [`TC_DW-1:0]     i5_wb_dat_o;
384
output                  i5_wb_ack_o;
385
output                  i5_wb_err_o;
386
 
387
//
388
// WB slave i/f connecting initiator 6
389
//
390
input                   i6_wb_cyc_i;
391
input                   i6_wb_stb_i;
392
input                   i6_wb_cab_i;
393
input   [`TC_AW-1:0]     i6_wb_adr_i;
394
input   [`TC_BSW-1:0]    i6_wb_sel_i;
395
input                   i6_wb_we_i;
396
input   [`TC_DW-1:0]     i6_wb_dat_i;
397
output  [`TC_DW-1:0]     i6_wb_dat_o;
398
output                  i6_wb_ack_o;
399
output                  i6_wb_err_o;
400
 
401
//
402
// WB slave i/f connecting initiator 7
403
//
404
input                   i7_wb_cyc_i;
405
input                   i7_wb_stb_i;
406
input                   i7_wb_cab_i;
407
input   [`TC_AW-1:0]     i7_wb_adr_i;
408
input   [`TC_BSW-1:0]    i7_wb_sel_i;
409
input                   i7_wb_we_i;
410
input   [`TC_DW-1:0]     i7_wb_dat_i;
411
output  [`TC_DW-1:0]     i7_wb_dat_o;
412
output                  i7_wb_ack_o;
413
output                  i7_wb_err_o;
414
 
415
//
416
// WB master i/f connecting target 0
417
//
418
output                  t0_wb_cyc_o;
419
output                  t0_wb_stb_o;
420
output                  t0_wb_cab_o;
421
output  [`TC_AW-1:0]     t0_wb_adr_o;
422
output  [`TC_BSW-1:0]    t0_wb_sel_o;
423
output                  t0_wb_we_o;
424
output  [`TC_DW-1:0]     t0_wb_dat_o;
425
input   [`TC_DW-1:0]     t0_wb_dat_i;
426
input                   t0_wb_ack_i;
427
input                   t0_wb_err_i;
428
 
429
//
430
// WB master i/f connecting target 1
431
//
432
output                  t1_wb_cyc_o;
433
output                  t1_wb_stb_o;
434
output                  t1_wb_cab_o;
435
output  [`TC_AW-1:0]     t1_wb_adr_o;
436
output  [`TC_BSW-1:0]    t1_wb_sel_o;
437
output                  t1_wb_we_o;
438
output  [`TC_DW-1:0]     t1_wb_dat_o;
439
input   [`TC_DW-1:0]     t1_wb_dat_i;
440
input                   t1_wb_ack_i;
441
input                   t1_wb_err_i;
442
 
443
//
444
// WB master i/f connecting target 2
445
//
446
output                  t2_wb_cyc_o;
447
output                  t2_wb_stb_o;
448
output                  t2_wb_cab_o;
449
output  [`TC_AW-1:0]     t2_wb_adr_o;
450
output  [`TC_BSW-1:0]    t2_wb_sel_o;
451
output                  t2_wb_we_o;
452
output  [`TC_DW-1:0]     t2_wb_dat_o;
453
input   [`TC_DW-1:0]     t2_wb_dat_i;
454
input                   t2_wb_ack_i;
455
input                   t2_wb_err_i;
456
 
457
//
458
// WB master i/f connecting target 3
459
//
460
output                  t3_wb_cyc_o;
461
output                  t3_wb_stb_o;
462
output                  t3_wb_cab_o;
463
output  [`TC_AW-1:0]     t3_wb_adr_o;
464
output  [`TC_BSW-1:0]    t3_wb_sel_o;
465
output                  t3_wb_we_o;
466
output  [`TC_DW-1:0]     t3_wb_dat_o;
467
input   [`TC_DW-1:0]     t3_wb_dat_i;
468
input                   t3_wb_ack_i;
469
input                   t3_wb_err_i;
470
 
471
//
472
// WB master i/f connecting target 4
473
//
474
output                  t4_wb_cyc_o;
475
output                  t4_wb_stb_o;
476
output                  t4_wb_cab_o;
477
output  [`TC_AW-1:0]     t4_wb_adr_o;
478
output  [`TC_BSW-1:0]    t4_wb_sel_o;
479
output                  t4_wb_we_o;
480
output  [`TC_DW-1:0]     t4_wb_dat_o;
481
input   [`TC_DW-1:0]     t4_wb_dat_i;
482
input                   t4_wb_ack_i;
483
input                   t4_wb_err_i;
484
 
485
//
486
// WB master i/f connecting target 5
487
//
488
output                  t5_wb_cyc_o;
489
output                  t5_wb_stb_o;
490
output                  t5_wb_cab_o;
491
output  [`TC_AW-1:0]     t5_wb_adr_o;
492
output  [`TC_BSW-1:0]    t5_wb_sel_o;
493
output                  t5_wb_we_o;
494
output  [`TC_DW-1:0]     t5_wb_dat_o;
495
input   [`TC_DW-1:0]     t5_wb_dat_i;
496
input                   t5_wb_ack_i;
497
input                   t5_wb_err_i;
498
 
499
//
500
// WB master i/f connecting target 6
501
//
502
output                  t6_wb_cyc_o;
503
output                  t6_wb_stb_o;
504
output                  t6_wb_cab_o;
505
output  [`TC_AW-1:0]     t6_wb_adr_o;
506
output  [`TC_BSW-1:0]    t6_wb_sel_o;
507
output                  t6_wb_we_o;
508
output  [`TC_DW-1:0]     t6_wb_dat_o;
509
input   [`TC_DW-1:0]     t6_wb_dat_i;
510
input                   t6_wb_ack_i;
511
input                   t6_wb_err_i;
512
 
513
//
514
// WB master i/f connecting target 7
515
//
516
output                  t7_wb_cyc_o;
517
output                  t7_wb_stb_o;
518
output                  t7_wb_cab_o;
519
output  [`TC_AW-1:0]     t7_wb_adr_o;
520
output  [`TC_BSW-1:0]    t7_wb_sel_o;
521
output                  t7_wb_we_o;
522
output  [`TC_DW-1:0]     t7_wb_dat_o;
523
input   [`TC_DW-1:0]     t7_wb_dat_i;
524
input                   t7_wb_ack_i;
525
input                   t7_wb_err_i;
526
 
527
//
528
// WB master i/f connecting target 8
529
//
530
output                  t8_wb_cyc_o;
531
output                  t8_wb_stb_o;
532
output                  t8_wb_cab_o;
533
output  [`TC_AW-1:0]     t8_wb_adr_o;
534
output  [`TC_BSW-1:0]    t8_wb_sel_o;
535
output                  t8_wb_we_o;
536
output  [`TC_DW-1:0]     t8_wb_dat_o;
537
input   [`TC_DW-1:0]     t8_wb_dat_i;
538
input                   t8_wb_ack_i;
539
input                   t8_wb_err_i;
540
 
541
//
542
// Internal wires & registers
543
//
544
 
545
//
546
// Outputs for initiators from both mi_to_st blocks
547
//
548
wire    [`TC_DW-1:0]     xi0_wb_dat_o;
549
wire                    xi0_wb_ack_o;
550
wire                    xi0_wb_err_o;
551
wire    [`TC_DW-1:0]     xi1_wb_dat_o;
552
wire                    xi1_wb_ack_o;
553
wire                    xi1_wb_err_o;
554
wire    [`TC_DW-1:0]     xi2_wb_dat_o;
555
wire                    xi2_wb_ack_o;
556
wire                    xi2_wb_err_o;
557
wire    [`TC_DW-1:0]     xi3_wb_dat_o;
558
wire                    xi3_wb_ack_o;
559
wire                    xi3_wb_err_o;
560
wire    [`TC_DW-1:0]     xi4_wb_dat_o;
561
wire                    xi4_wb_ack_o;
562
wire                    xi4_wb_err_o;
563
wire    [`TC_DW-1:0]     xi5_wb_dat_o;
564
wire                    xi5_wb_ack_o;
565
wire                    xi5_wb_err_o;
566
wire    [`TC_DW-1:0]     xi6_wb_dat_o;
567
wire                    xi6_wb_ack_o;
568
wire                    xi6_wb_err_o;
569
wire    [`TC_DW-1:0]     xi7_wb_dat_o;
570
wire                    xi7_wb_ack_o;
571
wire                    xi7_wb_err_o;
572
wire    [`TC_DW-1:0]     yi0_wb_dat_o;
573
wire                    yi0_wb_ack_o;
574
wire                    yi0_wb_err_o;
575
wire    [`TC_DW-1:0]     yi1_wb_dat_o;
576
wire                    yi1_wb_ack_o;
577
wire                    yi1_wb_err_o;
578
wire    [`TC_DW-1:0]     yi2_wb_dat_o;
579
wire                    yi2_wb_ack_o;
580
wire                    yi2_wb_err_o;
581
wire    [`TC_DW-1:0]     yi3_wb_dat_o;
582
wire                    yi3_wb_ack_o;
583
wire                    yi3_wb_err_o;
584
wire    [`TC_DW-1:0]     yi4_wb_dat_o;
585
wire                    yi4_wb_ack_o;
586
wire                    yi4_wb_err_o;
587
wire    [`TC_DW-1:0]     yi5_wb_dat_o;
588
wire                    yi5_wb_ack_o;
589
wire                    yi5_wb_err_o;
590
wire    [`TC_DW-1:0]     yi6_wb_dat_o;
591
wire                    yi6_wb_ack_o;
592
wire                    yi6_wb_err_o;
593
wire    [`TC_DW-1:0]     yi7_wb_dat_o;
594
wire                    yi7_wb_ack_o;
595
wire                    yi7_wb_err_o;
596
 
597
//
598
// Intermediate signals connecting peripheral channel's
599
// mi_to_st and si_to_mt blocks.
600
//
601
wire                    z_wb_cyc_i;
602
wire                    z_wb_stb_i;
603
wire                    z_wb_cab_i;
604
wire    [`TC_AW-1:0]     z_wb_adr_i;
605
wire    [`TC_BSW-1:0]    z_wb_sel_i;
606
wire                    z_wb_we_i;
607
wire    [`TC_DW-1:0]     z_wb_dat_i;
608
wire    [`TC_DW-1:0]     z_wb_dat_t;
609
wire                    z_wb_ack_t;
610
wire                    z_wb_err_t;
611
 
612
 
613
//
614
// Outputs for initiators are ORed from both mi_to_st blocks
615
//
616
assign i0_wb_dat_o = xi0_wb_dat_o | yi0_wb_dat_o;
617
assign i0_wb_ack_o = xi0_wb_ack_o | yi0_wb_ack_o;
618
assign i0_wb_err_o = xi0_wb_err_o | yi0_wb_err_o;
619
assign i1_wb_dat_o = xi1_wb_dat_o | yi1_wb_dat_o;
620
assign i1_wb_ack_o = xi1_wb_ack_o | yi1_wb_ack_o;
621
assign i1_wb_err_o = xi1_wb_err_o | yi1_wb_err_o;
622
assign i2_wb_dat_o = xi2_wb_dat_o | yi2_wb_dat_o;
623
assign i2_wb_ack_o = xi2_wb_ack_o | yi2_wb_ack_o;
624
assign i2_wb_err_o = xi2_wb_err_o | yi2_wb_err_o;
625
assign i3_wb_dat_o = xi3_wb_dat_o | yi3_wb_dat_o;
626
assign i3_wb_ack_o = xi3_wb_ack_o | yi3_wb_ack_o;
627
assign i3_wb_err_o = xi3_wb_err_o | yi3_wb_err_o;
628
assign i4_wb_dat_o = xi4_wb_dat_o | yi4_wb_dat_o;
629
assign i4_wb_ack_o = xi4_wb_ack_o | yi4_wb_ack_o;
630
assign i4_wb_err_o = xi4_wb_err_o | yi4_wb_err_o;
631
assign i5_wb_dat_o = xi5_wb_dat_o | yi5_wb_dat_o;
632
assign i5_wb_ack_o = xi5_wb_ack_o | yi5_wb_ack_o;
633
assign i5_wb_err_o = xi5_wb_err_o | yi5_wb_err_o;
634
assign i6_wb_dat_o = xi6_wb_dat_o | yi6_wb_dat_o;
635
assign i6_wb_ack_o = xi6_wb_ack_o | yi6_wb_ack_o;
636
assign i6_wb_err_o = xi6_wb_err_o | yi6_wb_err_o;
637
assign i7_wb_dat_o = xi7_wb_dat_o | yi7_wb_dat_o;
638
assign i7_wb_ack_o = xi7_wb_ack_o | yi7_wb_ack_o;
639
assign i7_wb_err_o = xi7_wb_err_o | yi7_wb_err_o;
640
 
641
//
642
// From initiators to target 0
643
//
644
tc_mi_to_st #(t0_addr_w, t0_addr,
645
        0, t0_addr_w, t0_addr) t0_ch(
646
        .wb_clk_i(wb_clk_i),
647
        .wb_rst_i(wb_rst_i),
648
 
649
        .i0_wb_cyc_i(i0_wb_cyc_i),
650
        .i0_wb_stb_i(i0_wb_stb_i),
651
        .i0_wb_cab_i(i0_wb_cab_i),
652
        .i0_wb_adr_i(i0_wb_adr_i),
653
        .i0_wb_sel_i(i0_wb_sel_i),
654
        .i0_wb_we_i(i0_wb_we_i),
655
        .i0_wb_dat_i(i0_wb_dat_i),
656
        .i0_wb_dat_o(xi0_wb_dat_o),
657
        .i0_wb_ack_o(xi0_wb_ack_o),
658
        .i0_wb_err_o(xi0_wb_err_o),
659
 
660
        .i1_wb_cyc_i(i1_wb_cyc_i),
661
        .i1_wb_stb_i(i1_wb_stb_i),
662
        .i1_wb_cab_i(i1_wb_cab_i),
663
        .i1_wb_adr_i(i1_wb_adr_i),
664
        .i1_wb_sel_i(i1_wb_sel_i),
665
        .i1_wb_we_i(i1_wb_we_i),
666
        .i1_wb_dat_i(i1_wb_dat_i),
667
        .i1_wb_dat_o(xi1_wb_dat_o),
668
        .i1_wb_ack_o(xi1_wb_ack_o),
669
        .i1_wb_err_o(xi1_wb_err_o),
670
 
671
        .i2_wb_cyc_i(i2_wb_cyc_i),
672
        .i2_wb_stb_i(i2_wb_stb_i),
673
        .i2_wb_cab_i(i2_wb_cab_i),
674
        .i2_wb_adr_i(i2_wb_adr_i),
675
        .i2_wb_sel_i(i2_wb_sel_i),
676
        .i2_wb_we_i(i2_wb_we_i),
677
        .i2_wb_dat_i(i2_wb_dat_i),
678
        .i2_wb_dat_o(xi2_wb_dat_o),
679
        .i2_wb_ack_o(xi2_wb_ack_o),
680
        .i2_wb_err_o(xi2_wb_err_o),
681
 
682
        .i3_wb_cyc_i(i3_wb_cyc_i),
683
        .i3_wb_stb_i(i3_wb_stb_i),
684
        .i3_wb_cab_i(i3_wb_cab_i),
685
        .i3_wb_adr_i(i3_wb_adr_i),
686
        .i3_wb_sel_i(i3_wb_sel_i),
687
        .i3_wb_we_i(i3_wb_we_i),
688
        .i3_wb_dat_i(i3_wb_dat_i),
689
        .i3_wb_dat_o(xi3_wb_dat_o),
690
        .i3_wb_ack_o(xi3_wb_ack_o),
691
        .i3_wb_err_o(xi3_wb_err_o),
692
 
693
        .i4_wb_cyc_i(i4_wb_cyc_i),
694
        .i4_wb_stb_i(i4_wb_stb_i),
695
        .i4_wb_cab_i(i4_wb_cab_i),
696
        .i4_wb_adr_i(i4_wb_adr_i),
697
        .i4_wb_sel_i(i4_wb_sel_i),
698
        .i4_wb_we_i(i4_wb_we_i),
699
        .i4_wb_dat_i(i4_wb_dat_i),
700
        .i4_wb_dat_o(xi4_wb_dat_o),
701
        .i4_wb_ack_o(xi4_wb_ack_o),
702
        .i4_wb_err_o(xi4_wb_err_o),
703
 
704
        .i5_wb_cyc_i(i5_wb_cyc_i),
705
        .i5_wb_stb_i(i5_wb_stb_i),
706
        .i5_wb_cab_i(i5_wb_cab_i),
707
        .i5_wb_adr_i(i5_wb_adr_i),
708
        .i5_wb_sel_i(i5_wb_sel_i),
709
        .i5_wb_we_i(i5_wb_we_i),
710
        .i5_wb_dat_i(i5_wb_dat_i),
711
        .i5_wb_dat_o(xi5_wb_dat_o),
712
        .i5_wb_ack_o(xi5_wb_ack_o),
713
        .i5_wb_err_o(xi5_wb_err_o),
714
 
715
        .i6_wb_cyc_i(i6_wb_cyc_i),
716
        .i6_wb_stb_i(i6_wb_stb_i),
717
        .i6_wb_cab_i(i6_wb_cab_i),
718
        .i6_wb_adr_i(i6_wb_adr_i),
719
        .i6_wb_sel_i(i6_wb_sel_i),
720
        .i6_wb_we_i(i6_wb_we_i),
721
        .i6_wb_dat_i(i6_wb_dat_i),
722
        .i6_wb_dat_o(xi6_wb_dat_o),
723
        .i6_wb_ack_o(xi6_wb_ack_o),
724
        .i6_wb_err_o(xi6_wb_err_o),
725
 
726
        .i7_wb_cyc_i(i7_wb_cyc_i),
727
        .i7_wb_stb_i(i7_wb_stb_i),
728
        .i7_wb_cab_i(i7_wb_cab_i),
729
        .i7_wb_adr_i(i7_wb_adr_i),
730
        .i7_wb_sel_i(i7_wb_sel_i),
731
        .i7_wb_we_i(i7_wb_we_i),
732
        .i7_wb_dat_i(i7_wb_dat_i),
733
        .i7_wb_dat_o(xi7_wb_dat_o),
734
        .i7_wb_ack_o(xi7_wb_ack_o),
735
        .i7_wb_err_o(xi7_wb_err_o),
736
 
737
        .t0_wb_cyc_o(t0_wb_cyc_o),
738
        .t0_wb_stb_o(t0_wb_stb_o),
739
        .t0_wb_cab_o(t0_wb_cab_o),
740
        .t0_wb_adr_o(t0_wb_adr_o),
741
        .t0_wb_sel_o(t0_wb_sel_o),
742
        .t0_wb_we_o(t0_wb_we_o),
743
        .t0_wb_dat_o(t0_wb_dat_o),
744
        .t0_wb_dat_i(t0_wb_dat_i),
745
        .t0_wb_ack_i(t0_wb_ack_i),
746
        .t0_wb_err_i(t0_wb_err_i)
747
 
748
);
749
 
750
//
751
// From initiators to targets 1-8 (upper part)
752
//
753
tc_mi_to_st #(t1_addr_w, t1_addr,
754
        1, t28c_addr_w, t28_addr) t18_ch_upper(
755
        .wb_clk_i(wb_clk_i),
756
        .wb_rst_i(wb_rst_i),
757
 
758
        .i0_wb_cyc_i(i0_wb_cyc_i),
759
        .i0_wb_stb_i(i0_wb_stb_i),
760
        .i0_wb_cab_i(i0_wb_cab_i),
761
        .i0_wb_adr_i(i0_wb_adr_i),
762
        .i0_wb_sel_i(i0_wb_sel_i),
763
        .i0_wb_we_i(i0_wb_we_i),
764
        .i0_wb_dat_i(i0_wb_dat_i),
765
        .i0_wb_dat_o(yi0_wb_dat_o),
766
        .i0_wb_ack_o(yi0_wb_ack_o),
767
        .i0_wb_err_o(yi0_wb_err_o),
768
 
769
        .i1_wb_cyc_i(i1_wb_cyc_i),
770
        .i1_wb_stb_i(i1_wb_stb_i),
771
        .i1_wb_cab_i(i1_wb_cab_i),
772
        .i1_wb_adr_i(i1_wb_adr_i),
773
        .i1_wb_sel_i(i1_wb_sel_i),
774
        .i1_wb_we_i(i1_wb_we_i),
775
        .i1_wb_dat_i(i1_wb_dat_i),
776
        .i1_wb_dat_o(yi1_wb_dat_o),
777
        .i1_wb_ack_o(yi1_wb_ack_o),
778
        .i1_wb_err_o(yi1_wb_err_o),
779
 
780
        .i2_wb_cyc_i(i2_wb_cyc_i),
781
        .i2_wb_stb_i(i2_wb_stb_i),
782
        .i2_wb_cab_i(i2_wb_cab_i),
783
        .i2_wb_adr_i(i2_wb_adr_i),
784
        .i2_wb_sel_i(i2_wb_sel_i),
785
        .i2_wb_we_i(i2_wb_we_i),
786
        .i2_wb_dat_i(i2_wb_dat_i),
787
        .i2_wb_dat_o(yi2_wb_dat_o),
788
        .i2_wb_ack_o(yi2_wb_ack_o),
789
        .i2_wb_err_o(yi2_wb_err_o),
790
 
791
        .i3_wb_cyc_i(i3_wb_cyc_i),
792
        .i3_wb_stb_i(i3_wb_stb_i),
793
        .i3_wb_cab_i(i3_wb_cab_i),
794
        .i3_wb_adr_i(i3_wb_adr_i),
795
        .i3_wb_sel_i(i3_wb_sel_i),
796
        .i3_wb_we_i(i3_wb_we_i),
797
        .i3_wb_dat_i(i3_wb_dat_i),
798
        .i3_wb_dat_o(yi3_wb_dat_o),
799
        .i3_wb_ack_o(yi3_wb_ack_o),
800
        .i3_wb_err_o(yi3_wb_err_o),
801
 
802
        .i4_wb_cyc_i(i4_wb_cyc_i),
803
        .i4_wb_stb_i(i4_wb_stb_i),
804
        .i4_wb_cab_i(i4_wb_cab_i),
805
        .i4_wb_adr_i(i4_wb_adr_i),
806
        .i4_wb_sel_i(i4_wb_sel_i),
807
        .i4_wb_we_i(i4_wb_we_i),
808
        .i4_wb_dat_i(i4_wb_dat_i),
809
        .i4_wb_dat_o(yi4_wb_dat_o),
810
        .i4_wb_ack_o(yi4_wb_ack_o),
811
        .i4_wb_err_o(yi4_wb_err_o),
812
 
813
        .i5_wb_cyc_i(i5_wb_cyc_i),
814
        .i5_wb_stb_i(i5_wb_stb_i),
815
        .i5_wb_cab_i(i5_wb_cab_i),
816
        .i5_wb_adr_i(i5_wb_adr_i),
817
        .i5_wb_sel_i(i5_wb_sel_i),
818
        .i5_wb_we_i(i5_wb_we_i),
819
        .i5_wb_dat_i(i5_wb_dat_i),
820
        .i5_wb_dat_o(yi5_wb_dat_o),
821
        .i5_wb_ack_o(yi5_wb_ack_o),
822
        .i5_wb_err_o(yi5_wb_err_o),
823
 
824
        .i6_wb_cyc_i(i6_wb_cyc_i),
825
        .i6_wb_stb_i(i6_wb_stb_i),
826
        .i6_wb_cab_i(i6_wb_cab_i),
827
        .i6_wb_adr_i(i6_wb_adr_i),
828
        .i6_wb_sel_i(i6_wb_sel_i),
829
        .i6_wb_we_i(i6_wb_we_i),
830
        .i6_wb_dat_i(i6_wb_dat_i),
831
        .i6_wb_dat_o(yi6_wb_dat_o),
832
        .i6_wb_ack_o(yi6_wb_ack_o),
833
        .i6_wb_err_o(yi6_wb_err_o),
834
 
835
        .i7_wb_cyc_i(i7_wb_cyc_i),
836
        .i7_wb_stb_i(i7_wb_stb_i),
837
        .i7_wb_cab_i(i7_wb_cab_i),
838
        .i7_wb_adr_i(i7_wb_adr_i),
839
        .i7_wb_sel_i(i7_wb_sel_i),
840
        .i7_wb_we_i(i7_wb_we_i),
841
        .i7_wb_dat_i(i7_wb_dat_i),
842
        .i7_wb_dat_o(yi7_wb_dat_o),
843
        .i7_wb_ack_o(yi7_wb_ack_o),
844
        .i7_wb_err_o(yi7_wb_err_o),
845
 
846
        .t0_wb_cyc_o(z_wb_cyc_i),
847
        .t0_wb_stb_o(z_wb_stb_i),
848
        .t0_wb_cab_o(z_wb_cab_i),
849
        .t0_wb_adr_o(z_wb_adr_i),
850
        .t0_wb_sel_o(z_wb_sel_i),
851
        .t0_wb_we_o(z_wb_we_i),
852
        .t0_wb_dat_o(z_wb_dat_i),
853
        .t0_wb_dat_i(z_wb_dat_t),
854
        .t0_wb_ack_i(z_wb_ack_t),
855
        .t0_wb_err_i(z_wb_err_t)
856
 
857
);
858
 
859
//
860
// From initiators to targets 1-8 (lower part)
861
//
862
tc_si_to_mt #(t1_addr_w, t1_addr, t28i_addr_w, t2_addr, t3_addr,
863
        t4_addr, t5_addr, t6_addr, t7_addr, t8_addr) t18_ch_lower(
864
 
865
        .i0_wb_cyc_i(z_wb_cyc_i),
866
        .i0_wb_stb_i(z_wb_stb_i),
867
        .i0_wb_cab_i(z_wb_cab_i),
868
        .i0_wb_adr_i(z_wb_adr_i),
869
        .i0_wb_sel_i(z_wb_sel_i),
870
        .i0_wb_we_i(z_wb_we_i),
871
        .i0_wb_dat_i(z_wb_dat_i),
872
        .i0_wb_dat_o(z_wb_dat_t),
873
        .i0_wb_ack_o(z_wb_ack_t),
874
        .i0_wb_err_o(z_wb_err_t),
875
 
876
        .t0_wb_cyc_o(t1_wb_cyc_o),
877
        .t0_wb_stb_o(t1_wb_stb_o),
878
        .t0_wb_cab_o(t1_wb_cab_o),
879
        .t0_wb_adr_o(t1_wb_adr_o),
880
        .t0_wb_sel_o(t1_wb_sel_o),
881
        .t0_wb_we_o(t1_wb_we_o),
882
        .t0_wb_dat_o(t1_wb_dat_o),
883
        .t0_wb_dat_i(t1_wb_dat_i),
884
        .t0_wb_ack_i(t1_wb_ack_i),
885
        .t0_wb_err_i(t1_wb_err_i),
886
 
887
        .t1_wb_cyc_o(t2_wb_cyc_o),
888
        .t1_wb_stb_o(t2_wb_stb_o),
889
        .t1_wb_cab_o(t2_wb_cab_o),
890
        .t1_wb_adr_o(t2_wb_adr_o),
891
        .t1_wb_sel_o(t2_wb_sel_o),
892
        .t1_wb_we_o(t2_wb_we_o),
893
        .t1_wb_dat_o(t2_wb_dat_o),
894
        .t1_wb_dat_i(t2_wb_dat_i),
895
        .t1_wb_ack_i(t2_wb_ack_i),
896
        .t1_wb_err_i(t2_wb_err_i),
897
 
898
        .t2_wb_cyc_o(t3_wb_cyc_o),
899
        .t2_wb_stb_o(t3_wb_stb_o),
900
        .t2_wb_cab_o(t3_wb_cab_o),
901
        .t2_wb_adr_o(t3_wb_adr_o),
902
        .t2_wb_sel_o(t3_wb_sel_o),
903
        .t2_wb_we_o(t3_wb_we_o),
904
        .t2_wb_dat_o(t3_wb_dat_o),
905
        .t2_wb_dat_i(t3_wb_dat_i),
906
        .t2_wb_ack_i(t3_wb_ack_i),
907
        .t2_wb_err_i(t3_wb_err_i),
908
 
909
        .t3_wb_cyc_o(t4_wb_cyc_o),
910
        .t3_wb_stb_o(t4_wb_stb_o),
911
        .t3_wb_cab_o(t4_wb_cab_o),
912
        .t3_wb_adr_o(t4_wb_adr_o),
913
        .t3_wb_sel_o(t4_wb_sel_o),
914
        .t3_wb_we_o(t4_wb_we_o),
915
        .t3_wb_dat_o(t4_wb_dat_o),
916
        .t3_wb_dat_i(t4_wb_dat_i),
917
        .t3_wb_ack_i(t4_wb_ack_i),
918
        .t3_wb_err_i(t4_wb_err_i),
919
 
920
        .t4_wb_cyc_o(t5_wb_cyc_o),
921
        .t4_wb_stb_o(t5_wb_stb_o),
922
        .t4_wb_cab_o(t5_wb_cab_o),
923
        .t4_wb_adr_o(t5_wb_adr_o),
924
        .t4_wb_sel_o(t5_wb_sel_o),
925
        .t4_wb_we_o(t5_wb_we_o),
926
        .t4_wb_dat_o(t5_wb_dat_o),
927
        .t4_wb_dat_i(t5_wb_dat_i),
928
        .t4_wb_ack_i(t5_wb_ack_i),
929
        .t4_wb_err_i(t5_wb_err_i),
930
 
931
        .t5_wb_cyc_o(t6_wb_cyc_o),
932
        .t5_wb_stb_o(t6_wb_stb_o),
933
        .t5_wb_cab_o(t6_wb_cab_o),
934
        .t5_wb_adr_o(t6_wb_adr_o),
935
        .t5_wb_sel_o(t6_wb_sel_o),
936
        .t5_wb_we_o(t6_wb_we_o),
937
        .t5_wb_dat_o(t6_wb_dat_o),
938
        .t5_wb_dat_i(t6_wb_dat_i),
939
        .t5_wb_ack_i(t6_wb_ack_i),
940
        .t5_wb_err_i(t6_wb_err_i),
941
 
942
        .t6_wb_cyc_o(t7_wb_cyc_o),
943
        .t6_wb_stb_o(t7_wb_stb_o),
944
        .t6_wb_cab_o(t7_wb_cab_o),
945
        .t6_wb_adr_o(t7_wb_adr_o),
946
        .t6_wb_sel_o(t7_wb_sel_o),
947
        .t6_wb_we_o(t7_wb_we_o),
948
        .t6_wb_dat_o(t7_wb_dat_o),
949
        .t6_wb_dat_i(t7_wb_dat_i),
950
        .t6_wb_ack_i(t7_wb_ack_i),
951
        .t6_wb_err_i(t7_wb_err_i),
952
 
953
        .t7_wb_cyc_o(t8_wb_cyc_o),
954
        .t7_wb_stb_o(t8_wb_stb_o),
955
        .t7_wb_cab_o(t8_wb_cab_o),
956
        .t7_wb_adr_o(t8_wb_adr_o),
957
        .t7_wb_sel_o(t8_wb_sel_o),
958
        .t7_wb_we_o(t8_wb_we_o),
959
        .t7_wb_dat_o(t8_wb_dat_o),
960
        .t7_wb_dat_i(t8_wb_dat_i),
961
        .t7_wb_ack_i(t8_wb_ack_i),
962
        .t7_wb_err_i(t8_wb_err_i)
963
 
964
);
965
 
966
endmodule
967
 
968
//
969
// Multiple initiator to single target
970
//
971
module tc_mi_to_st (
972
        wb_clk_i,
973
        wb_rst_i,
974
 
975
        i0_wb_cyc_i,
976
        i0_wb_stb_i,
977
        i0_wb_cab_i,
978
        i0_wb_adr_i,
979
        i0_wb_sel_i,
980
        i0_wb_we_i,
981
        i0_wb_dat_i,
982
        i0_wb_dat_o,
983
        i0_wb_ack_o,
984
        i0_wb_err_o,
985
 
986
        i1_wb_cyc_i,
987
        i1_wb_stb_i,
988
        i1_wb_cab_i,
989
        i1_wb_adr_i,
990
        i1_wb_sel_i,
991
        i1_wb_we_i,
992
        i1_wb_dat_i,
993
        i1_wb_dat_o,
994
        i1_wb_ack_o,
995
        i1_wb_err_o,
996
 
997
        i2_wb_cyc_i,
998
        i2_wb_stb_i,
999
        i2_wb_cab_i,
1000
        i2_wb_adr_i,
1001
        i2_wb_sel_i,
1002
        i2_wb_we_i,
1003
        i2_wb_dat_i,
1004
        i2_wb_dat_o,
1005
        i2_wb_ack_o,
1006
        i2_wb_err_o,
1007
 
1008
        i3_wb_cyc_i,
1009
        i3_wb_stb_i,
1010
        i3_wb_cab_i,
1011
        i3_wb_adr_i,
1012
        i3_wb_sel_i,
1013
        i3_wb_we_i,
1014
        i3_wb_dat_i,
1015
        i3_wb_dat_o,
1016
        i3_wb_ack_o,
1017
        i3_wb_err_o,
1018
 
1019
        i4_wb_cyc_i,
1020
        i4_wb_stb_i,
1021
        i4_wb_cab_i,
1022
        i4_wb_adr_i,
1023
        i4_wb_sel_i,
1024
        i4_wb_we_i,
1025
        i4_wb_dat_i,
1026
        i4_wb_dat_o,
1027
        i4_wb_ack_o,
1028
        i4_wb_err_o,
1029
 
1030
        i5_wb_cyc_i,
1031
        i5_wb_stb_i,
1032
        i5_wb_cab_i,
1033
        i5_wb_adr_i,
1034
        i5_wb_sel_i,
1035
        i5_wb_we_i,
1036
        i5_wb_dat_i,
1037
        i5_wb_dat_o,
1038
        i5_wb_ack_o,
1039
        i5_wb_err_o,
1040
 
1041
        i6_wb_cyc_i,
1042
        i6_wb_stb_i,
1043
        i6_wb_cab_i,
1044
        i6_wb_adr_i,
1045
        i6_wb_sel_i,
1046
        i6_wb_we_i,
1047
        i6_wb_dat_i,
1048
        i6_wb_dat_o,
1049
        i6_wb_ack_o,
1050
        i6_wb_err_o,
1051
 
1052
        i7_wb_cyc_i,
1053
        i7_wb_stb_i,
1054
        i7_wb_cab_i,
1055
        i7_wb_adr_i,
1056
        i7_wb_sel_i,
1057
        i7_wb_we_i,
1058
        i7_wb_dat_i,
1059
        i7_wb_dat_o,
1060
        i7_wb_ack_o,
1061
        i7_wb_err_o,
1062
 
1063
        t0_wb_cyc_o,
1064
        t0_wb_stb_o,
1065
        t0_wb_cab_o,
1066
        t0_wb_adr_o,
1067
        t0_wb_sel_o,
1068
        t0_wb_we_o,
1069
        t0_wb_dat_o,
1070
        t0_wb_dat_i,
1071
        t0_wb_ack_i,
1072
        t0_wb_err_i
1073
 
1074
);
1075
 
1076
//
1077
// Parameters
1078
//
1079
parameter               t0_addr_w = 2;
1080
parameter               t0_addr = 2'b00;
1081
parameter               multitarg = 1'b0;
1082
parameter               t17_addr_w = 2;
1083
parameter               t17_addr = 2'b00;
1084
 
1085
//
1086
// I/O Ports
1087
//
1088
input                   wb_clk_i;
1089
input                   wb_rst_i;
1090
 
1091
//
1092
// WB slave i/f connecting initiator 0
1093
//
1094
input                   i0_wb_cyc_i;
1095
input                   i0_wb_stb_i;
1096
input                   i0_wb_cab_i;
1097
input   [`TC_AW-1:0]     i0_wb_adr_i;
1098
input   [`TC_BSW-1:0]    i0_wb_sel_i;
1099
input                   i0_wb_we_i;
1100
input   [`TC_DW-1:0]     i0_wb_dat_i;
1101
output  [`TC_DW-1:0]     i0_wb_dat_o;
1102
output                  i0_wb_ack_o;
1103
output                  i0_wb_err_o;
1104
 
1105
//
1106
// WB slave i/f connecting initiator 1
1107
//
1108
input                   i1_wb_cyc_i;
1109
input                   i1_wb_stb_i;
1110
input                   i1_wb_cab_i;
1111
input   [`TC_AW-1:0]     i1_wb_adr_i;
1112
input   [`TC_BSW-1:0]    i1_wb_sel_i;
1113
input                   i1_wb_we_i;
1114
input   [`TC_DW-1:0]     i1_wb_dat_i;
1115
output  [`TC_DW-1:0]     i1_wb_dat_o;
1116
output                  i1_wb_ack_o;
1117
output                  i1_wb_err_o;
1118
 
1119
//
1120
// WB slave i/f connecting initiator 2
1121
//
1122
input                   i2_wb_cyc_i;
1123
input                   i2_wb_stb_i;
1124
input                   i2_wb_cab_i;
1125
input   [`TC_AW-1:0]     i2_wb_adr_i;
1126
input   [`TC_BSW-1:0]    i2_wb_sel_i;
1127
input                   i2_wb_we_i;
1128
input   [`TC_DW-1:0]     i2_wb_dat_i;
1129
output  [`TC_DW-1:0]     i2_wb_dat_o;
1130
output                  i2_wb_ack_o;
1131
output                  i2_wb_err_o;
1132
 
1133
//
1134
// WB slave i/f connecting initiator 3
1135
//
1136
input                   i3_wb_cyc_i;
1137
input                   i3_wb_stb_i;
1138
input                   i3_wb_cab_i;
1139
input   [`TC_AW-1:0]     i3_wb_adr_i;
1140
input   [`TC_BSW-1:0]    i3_wb_sel_i;
1141
input                   i3_wb_we_i;
1142
input   [`TC_DW-1:0]     i3_wb_dat_i;
1143
output  [`TC_DW-1:0]     i3_wb_dat_o;
1144
output                  i3_wb_ack_o;
1145
output                  i3_wb_err_o;
1146
 
1147
//
1148
// WB slave i/f connecting initiator 4
1149
//
1150
input                   i4_wb_cyc_i;
1151
input                   i4_wb_stb_i;
1152
input                   i4_wb_cab_i;
1153
input   [`TC_AW-1:0]     i4_wb_adr_i;
1154
input   [`TC_BSW-1:0]    i4_wb_sel_i;
1155
input                   i4_wb_we_i;
1156
input   [`TC_DW-1:0]     i4_wb_dat_i;
1157
output  [`TC_DW-1:0]     i4_wb_dat_o;
1158
output                  i4_wb_ack_o;
1159
output                  i4_wb_err_o;
1160
 
1161
//
1162
// WB slave i/f connecting initiator 5
1163
//
1164
input                   i5_wb_cyc_i;
1165
input                   i5_wb_stb_i;
1166
input                   i5_wb_cab_i;
1167
input   [`TC_AW-1:0]     i5_wb_adr_i;
1168
input   [`TC_BSW-1:0]    i5_wb_sel_i;
1169
input                   i5_wb_we_i;
1170
input   [`TC_DW-1:0]     i5_wb_dat_i;
1171
output  [`TC_DW-1:0]     i5_wb_dat_o;
1172
output                  i5_wb_ack_o;
1173
output                  i5_wb_err_o;
1174
 
1175
//
1176
// WB slave i/f connecting initiator 6
1177
//
1178
input                   i6_wb_cyc_i;
1179
input                   i6_wb_stb_i;
1180
input                   i6_wb_cab_i;
1181
input   [`TC_AW-1:0]     i6_wb_adr_i;
1182
input   [`TC_BSW-1:0]    i6_wb_sel_i;
1183
input                   i6_wb_we_i;
1184
input   [`TC_DW-1:0]     i6_wb_dat_i;
1185
output  [`TC_DW-1:0]     i6_wb_dat_o;
1186
output                  i6_wb_ack_o;
1187
output                  i6_wb_err_o;
1188
 
1189
//
1190
// WB slave i/f connecting initiator 7
1191
//
1192
input                   i7_wb_cyc_i;
1193
input                   i7_wb_stb_i;
1194
input                   i7_wb_cab_i;
1195
input   [`TC_AW-1:0]     i7_wb_adr_i;
1196
input   [`TC_BSW-1:0]    i7_wb_sel_i;
1197
input                   i7_wb_we_i;
1198
input   [`TC_DW-1:0]     i7_wb_dat_i;
1199
output  [`TC_DW-1:0]     i7_wb_dat_o;
1200
output                  i7_wb_ack_o;
1201
output                  i7_wb_err_o;
1202
 
1203
//
1204
// WB master i/f connecting target
1205
//
1206
output                  t0_wb_cyc_o;
1207
output                  t0_wb_stb_o;
1208
output                  t0_wb_cab_o;
1209
output  [`TC_AW-1:0]     t0_wb_adr_o;
1210
output  [`TC_BSW-1:0]    t0_wb_sel_o;
1211
output                  t0_wb_we_o;
1212
output  [`TC_DW-1:0]     t0_wb_dat_o;
1213
input   [`TC_DW-1:0]     t0_wb_dat_i;
1214
input                   t0_wb_ack_i;
1215
input                   t0_wb_err_i;
1216
 
1217
//
1218
// Internal wires & registers
1219
//
1220
wire    [`TC_IIN_W-1:0]  i0_in, i1_in,
1221
                        i2_in, i3_in,
1222
                        i4_in, i5_in,
1223
                        i6_in, i7_in;
1224
wire    [`TC_TIN_W-1:0]  i0_out, i1_out,
1225
                        i2_out, i3_out,
1226
                        i4_out, i5_out,
1227
                        i6_out, i7_out;
1228
wire    [`TC_IIN_W-1:0]  t0_out;
1229
wire    [`TC_TIN_W-1:0]  t0_in;
1230
wire    [7:0]            req_i;
1231
wire    [2:0]            req_won;
1232
reg                     req_cont;
1233
reg     [2:0]            req_r;
1234
 
1235
reg req_cont_reg;
1236
wire req_cont_f_edge;
1237
wire t0_wb_stb_comb;
1238
wire t0_wb_cyc_comb;
1239
 
1240
//look for falling edge of req_cont, which implies new initiator
1241
always @(posedge wb_clk_i) begin
1242
  req_cont_reg <= req_cont;
1243
end
1244
assign req_cont_f_edge = ~req_cont & req_cont_reg;
1245
 
1246
//
1247
// Group WB initiator 0 i/f inputs and outputs
1248
//
1249
assign i0_in = {i0_wb_cyc_i, i0_wb_stb_i, i0_wb_cab_i, i0_wb_adr_i,
1250
                i0_wb_sel_i, i0_wb_we_i, i0_wb_dat_i};
1251
assign {i0_wb_dat_o, i0_wb_ack_o, i0_wb_err_o} = i0_out;
1252
 
1253
//
1254
// Group WB initiator 1 i/f inputs and outputs
1255
//
1256
assign i1_in = {i1_wb_cyc_i, i1_wb_stb_i, i1_wb_cab_i, i1_wb_adr_i,
1257
                i1_wb_sel_i, i1_wb_we_i, i1_wb_dat_i};
1258
assign {i1_wb_dat_o, i1_wb_ack_o, i1_wb_err_o} = i1_out;
1259
 
1260
//
1261
// Group WB initiator 2 i/f inputs and outputs
1262
//
1263
assign i2_in = {i2_wb_cyc_i, i2_wb_stb_i, i2_wb_cab_i, i2_wb_adr_i,
1264
                i2_wb_sel_i, i2_wb_we_i, i2_wb_dat_i};
1265
assign {i2_wb_dat_o, i2_wb_ack_o, i2_wb_err_o} = i2_out;
1266
 
1267
//
1268
// Group WB initiator 3 i/f inputs and outputs
1269
//
1270
assign i3_in = {i3_wb_cyc_i, i3_wb_stb_i, i3_wb_cab_i, i3_wb_adr_i,
1271
                i3_wb_sel_i, i3_wb_we_i, i3_wb_dat_i};
1272
assign {i3_wb_dat_o, i3_wb_ack_o, i3_wb_err_o} = i3_out;
1273
 
1274
//
1275
// Group WB initiator 4 i/f inputs and outputs
1276
//
1277
assign i4_in = {i4_wb_cyc_i, i4_wb_stb_i, i4_wb_cab_i, i4_wb_adr_i,
1278
                i4_wb_sel_i, i4_wb_we_i, i4_wb_dat_i};
1279
assign {i4_wb_dat_o, i4_wb_ack_o, i4_wb_err_o} = i4_out;
1280
 
1281
//
1282
// Group WB initiator 5 i/f inputs and outputs
1283
//
1284
assign i5_in = {i5_wb_cyc_i, i5_wb_stb_i, i5_wb_cab_i, i5_wb_adr_i,
1285
                i5_wb_sel_i, i5_wb_we_i, i5_wb_dat_i};
1286
assign {i5_wb_dat_o, i5_wb_ack_o, i5_wb_err_o} = i5_out;
1287
 
1288
//
1289
// Group WB initiator 6 i/f inputs and outputs
1290
//
1291
assign i6_in = {i6_wb_cyc_i, i6_wb_stb_i, i6_wb_cab_i, i6_wb_adr_i,
1292
                i6_wb_sel_i, i6_wb_we_i, i6_wb_dat_i};
1293
assign {i6_wb_dat_o, i6_wb_ack_o, i6_wb_err_o} = i6_out;
1294
 
1295
//
1296
// Group WB initiator 7 i/f inputs and outputs
1297
//
1298
assign i7_in = {i7_wb_cyc_i, i7_wb_stb_i, i7_wb_cab_i, i7_wb_adr_i,
1299
                i7_wb_sel_i, i7_wb_we_i, i7_wb_dat_i};
1300
assign {i7_wb_dat_o, i7_wb_ack_o, i7_wb_err_o} = i7_out;
1301
 
1302
//
1303
// Group WB target 0 i/f inputs and outputs
1304
//
1305
assign {t0_wb_cyc_comb, t0_wb_stb_comb, t0_wb_cab_o, t0_wb_adr_o,
1306
                t0_wb_sel_o, t0_wb_we_o, t0_wb_dat_o} = t0_out;
1307
assign t0_in = {t0_wb_dat_i, t0_wb_ack_i, t0_wb_err_i};
1308
//de-assert cyc and stb if new initiator is accessing the target
1309
//This needs to be done so that there is break in cyc and stb 
1310
//between back to back target accesses 
1311
assign t0_wb_cyc_o = t0_wb_cyc_comb & ~req_cont_f_edge;
1312
assign t0_wb_stb_o = t0_wb_stb_comb & ~req_cont_f_edge;
1313
 
1314
 
1315
//
1316
// Assign to WB initiator i/f outputs
1317
//
1318
// Either inputs from the target are assigned or zeros.
1319
//
1320
assign i0_out = (req_won == 3'd0) ? t0_in : {`TC_TIN_W{1'b0}};
1321
assign i1_out = (req_won == 3'd1) ? t0_in : {`TC_TIN_W{1'b0}};
1322
assign i2_out = (req_won == 3'd2) ? t0_in : {`TC_TIN_W{1'b0}};
1323
assign i3_out = (req_won == 3'd3) ? t0_in : {`TC_TIN_W{1'b0}};
1324
assign i4_out = (req_won == 3'd4) ? t0_in : {`TC_TIN_W{1'b0}};
1325
assign i5_out = (req_won == 3'd5) ? t0_in : {`TC_TIN_W{1'b0}};
1326
assign i6_out = (req_won == 3'd6) ? t0_in : {`TC_TIN_W{1'b0}};
1327
assign i7_out = (req_won == 3'd7) ? t0_in : {`TC_TIN_W{1'b0}};
1328
 
1329
//
1330
// Assign to WB target i/f outputs
1331
//
1332
// Assign inputs from initiator to target outputs according to
1333
// which initiator has won. If there is no request for the target,
1334
// assign zeros.
1335
//
1336
assign t0_out = (req_won == 3'd0) ? i0_in :
1337
                (req_won == 3'd1) ? i1_in :
1338
                (req_won == 3'd2) ? i2_in :
1339
                (req_won == 3'd3) ? i3_in :
1340
                (req_won == 3'd4) ? i4_in :
1341
                (req_won == 3'd5) ? i5_in :
1342
                (req_won == 3'd6) ? i6_in :
1343
                (req_won == 3'd7) ? i7_in : {`TC_IIN_W{1'b0}};
1344
 
1345
//
1346
// Determine if an initiator has address of the target.
1347
//
1348
assign req_i[0] = i0_wb_cyc_i &
1349
        ((i0_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1350
         multitarg & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1351
assign req_i[1] = i1_wb_cyc_i &
1352
        ((i1_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1353
         multitarg & (i1_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1354
assign req_i[2] = i2_wb_cyc_i &
1355
        ((i2_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1356
         multitarg & (i2_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1357
assign req_i[3] = i3_wb_cyc_i &
1358
        ((i3_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1359
         multitarg & (i3_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1360
assign req_i[4] = i4_wb_cyc_i &
1361
        ((i4_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1362
         multitarg & (i4_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1363
assign req_i[5] = i5_wb_cyc_i &
1364
        ((i5_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1365
         multitarg & (i5_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1366
assign req_i[6] = i6_wb_cyc_i &
1367
        ((i6_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1368
         multitarg & (i6_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1369
assign req_i[7] = i7_wb_cyc_i &
1370
        ((i7_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr) |
1371
         multitarg & (i7_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t17_addr));
1372
 
1373
//
1374
// Determine who gets current access to the target.
1375
//
1376
// If current initiator still asserts request, do nothing
1377
// (keep current initiator).
1378
// Otherwise check each initiator's request, starting from initiator 0
1379
// (highest priority).
1380
// If there is no requests from initiators, park initiator 0.
1381
//
1382
assign req_won = req_cont ? req_r :
1383
                 req_i[0] ? 3'd0 :
1384
                 req_i[1] ? 3'd1 :
1385
                 req_i[2] ? 3'd2 :
1386
                 req_i[3] ? 3'd3 :
1387
                 req_i[4] ? 3'd4 :
1388
                 req_i[5] ? 3'd5 :
1389
                 req_i[6] ? 3'd6 :
1390
                 req_i[7] ? 3'd7 : 3'd0;
1391
 
1392
//
1393
// Check if current initiator still wants access to the target and if
1394
// it does, assert req_cont.
1395
//
1396
always @(req_r or req_i)
1397
        case (req_r)    // synopsys parallel_case
1398
                3'd0: req_cont = req_i[0];
1399
                3'd1: req_cont = req_i[1];
1400
                3'd2: req_cont = req_i[2];
1401
                3'd3: req_cont = req_i[3];
1402
                3'd4: req_cont = req_i[4];
1403
                3'd5: req_cont = req_i[5];
1404
                3'd6: req_cont = req_i[6];
1405
                3'd7: req_cont = req_i[7];
1406
        endcase
1407
 
1408
//
1409
// Register who has current access to the target.
1410
//
1411
always @(posedge wb_clk_i or posedge wb_rst_i)
1412
        if (wb_rst_i)
1413
                req_r <= #1 3'd0;
1414
        else
1415
                req_r <= #1 req_won;
1416
 
1417
endmodule
1418
 
1419
//
1420
// Single initiator to multiple targets
1421
//
1422
module tc_si_to_mt (
1423
 
1424
        i0_wb_cyc_i,
1425
        i0_wb_stb_i,
1426
        i0_wb_cab_i,
1427
        i0_wb_adr_i,
1428
        i0_wb_sel_i,
1429
        i0_wb_we_i,
1430
        i0_wb_dat_i,
1431
        i0_wb_dat_o,
1432
        i0_wb_ack_o,
1433
        i0_wb_err_o,
1434
 
1435
        t0_wb_cyc_o,
1436
        t0_wb_stb_o,
1437
        t0_wb_cab_o,
1438
        t0_wb_adr_o,
1439
        t0_wb_sel_o,
1440
        t0_wb_we_o,
1441
        t0_wb_dat_o,
1442
        t0_wb_dat_i,
1443
        t0_wb_ack_i,
1444
        t0_wb_err_i,
1445
 
1446
        t1_wb_cyc_o,
1447
        t1_wb_stb_o,
1448
        t1_wb_cab_o,
1449
        t1_wb_adr_o,
1450
        t1_wb_sel_o,
1451
        t1_wb_we_o,
1452
        t1_wb_dat_o,
1453
        t1_wb_dat_i,
1454
        t1_wb_ack_i,
1455
        t1_wb_err_i,
1456
 
1457
        t2_wb_cyc_o,
1458
        t2_wb_stb_o,
1459
        t2_wb_cab_o,
1460
        t2_wb_adr_o,
1461
        t2_wb_sel_o,
1462
        t2_wb_we_o,
1463
        t2_wb_dat_o,
1464
        t2_wb_dat_i,
1465
        t2_wb_ack_i,
1466
        t2_wb_err_i,
1467
 
1468
        t3_wb_cyc_o,
1469
        t3_wb_stb_o,
1470
        t3_wb_cab_o,
1471
        t3_wb_adr_o,
1472
        t3_wb_sel_o,
1473
        t3_wb_we_o,
1474
        t3_wb_dat_o,
1475
        t3_wb_dat_i,
1476
        t3_wb_ack_i,
1477
        t3_wb_err_i,
1478
 
1479
        t4_wb_cyc_o,
1480
        t4_wb_stb_o,
1481
        t4_wb_cab_o,
1482
        t4_wb_adr_o,
1483
        t4_wb_sel_o,
1484
        t4_wb_we_o,
1485
        t4_wb_dat_o,
1486
        t4_wb_dat_i,
1487
        t4_wb_ack_i,
1488
        t4_wb_err_i,
1489
 
1490
        t5_wb_cyc_o,
1491
        t5_wb_stb_o,
1492
        t5_wb_cab_o,
1493
        t5_wb_adr_o,
1494
        t5_wb_sel_o,
1495
        t5_wb_we_o,
1496
        t5_wb_dat_o,
1497
        t5_wb_dat_i,
1498
        t5_wb_ack_i,
1499
        t5_wb_err_i,
1500
 
1501
        t6_wb_cyc_o,
1502
        t6_wb_stb_o,
1503
        t6_wb_cab_o,
1504
        t6_wb_adr_o,
1505
        t6_wb_sel_o,
1506
        t6_wb_we_o,
1507
        t6_wb_dat_o,
1508
        t6_wb_dat_i,
1509
        t6_wb_ack_i,
1510
        t6_wb_err_i,
1511
 
1512
        t7_wb_cyc_o,
1513
        t7_wb_stb_o,
1514
        t7_wb_cab_o,
1515
        t7_wb_adr_o,
1516
        t7_wb_sel_o,
1517
        t7_wb_we_o,
1518
        t7_wb_dat_o,
1519
        t7_wb_dat_i,
1520
        t7_wb_ack_i,
1521
        t7_wb_err_i
1522
 
1523
);
1524
 
1525
//
1526
// Parameters
1527
//
1528
parameter               t0_addr_w = 3;
1529
parameter               t0_addr = 3'd0;
1530
parameter               t17_addr_w = 3;
1531
parameter               t1_addr = 3'd1;
1532
parameter               t2_addr = 3'd2;
1533
parameter               t3_addr = 3'd3;
1534
parameter               t4_addr = 3'd4;
1535
parameter               t5_addr = 3'd5;
1536
parameter               t6_addr = 3'd6;
1537
parameter               t7_addr = 3'd7;
1538
 
1539
//
1540
// I/O Ports
1541
//
1542
 
1543
//
1544
// WB slave i/f connecting initiator 0
1545
//
1546
input                   i0_wb_cyc_i;
1547
input                   i0_wb_stb_i;
1548
input                   i0_wb_cab_i;
1549
input   [`TC_AW-1:0]     i0_wb_adr_i;
1550
input   [`TC_BSW-1:0]    i0_wb_sel_i;
1551
input                   i0_wb_we_i;
1552
input   [`TC_DW-1:0]     i0_wb_dat_i;
1553
output  [`TC_DW-1:0]     i0_wb_dat_o;
1554
output                  i0_wb_ack_o;
1555
output                  i0_wb_err_o;
1556
 
1557
//
1558
// WB master i/f connecting target 0
1559
//
1560
output                  t0_wb_cyc_o;
1561
output                  t0_wb_stb_o;
1562
output                  t0_wb_cab_o;
1563
output  [`TC_AW-1:0]     t0_wb_adr_o;
1564
output  [`TC_BSW-1:0]    t0_wb_sel_o;
1565
output                  t0_wb_we_o;
1566
output  [`TC_DW-1:0]     t0_wb_dat_o;
1567
input   [`TC_DW-1:0]     t0_wb_dat_i;
1568
input                   t0_wb_ack_i;
1569
input                   t0_wb_err_i;
1570
 
1571
//
1572
// WB master i/f connecting target 1
1573
//
1574
output                  t1_wb_cyc_o;
1575
output                  t1_wb_stb_o;
1576
output                  t1_wb_cab_o;
1577
output  [`TC_AW-1:0]     t1_wb_adr_o;
1578
output  [`TC_BSW-1:0]    t1_wb_sel_o;
1579
output                  t1_wb_we_o;
1580
output  [`TC_DW-1:0]     t1_wb_dat_o;
1581
input   [`TC_DW-1:0]     t1_wb_dat_i;
1582
input                   t1_wb_ack_i;
1583
input                   t1_wb_err_i;
1584
 
1585
//
1586
// WB master i/f connecting target 2
1587
//
1588
output                  t2_wb_cyc_o;
1589
output                  t2_wb_stb_o;
1590
output                  t2_wb_cab_o;
1591
output  [`TC_AW-1:0]     t2_wb_adr_o;
1592
output  [`TC_BSW-1:0]    t2_wb_sel_o;
1593
output                  t2_wb_we_o;
1594
output  [`TC_DW-1:0]     t2_wb_dat_o;
1595
input   [`TC_DW-1:0]     t2_wb_dat_i;
1596
input                   t2_wb_ack_i;
1597
input                   t2_wb_err_i;
1598
 
1599
//
1600
// WB master i/f connecting target 3
1601
//
1602
output                  t3_wb_cyc_o;
1603
output                  t3_wb_stb_o;
1604
output                  t3_wb_cab_o;
1605
output  [`TC_AW-1:0]     t3_wb_adr_o;
1606
output  [`TC_BSW-1:0]    t3_wb_sel_o;
1607
output                  t3_wb_we_o;
1608
output  [`TC_DW-1:0]     t3_wb_dat_o;
1609
input   [`TC_DW-1:0]     t3_wb_dat_i;
1610
input                   t3_wb_ack_i;
1611
input                   t3_wb_err_i;
1612
 
1613
//
1614
// WB master i/f connecting target 4
1615
//
1616
output                  t4_wb_cyc_o;
1617
output                  t4_wb_stb_o;
1618
output                  t4_wb_cab_o;
1619
output  [`TC_AW-1:0]     t4_wb_adr_o;
1620
output  [`TC_BSW-1:0]    t4_wb_sel_o;
1621
output                  t4_wb_we_o;
1622
output  [`TC_DW-1:0]     t4_wb_dat_o;
1623
input   [`TC_DW-1:0]     t4_wb_dat_i;
1624
input                   t4_wb_ack_i;
1625
input                   t4_wb_err_i;
1626
 
1627
//
1628
// WB master i/f connecting target 5
1629
//
1630
output                  t5_wb_cyc_o;
1631
output                  t5_wb_stb_o;
1632
output                  t5_wb_cab_o;
1633
output  [`TC_AW-1:0]     t5_wb_adr_o;
1634
output  [`TC_BSW-1:0]    t5_wb_sel_o;
1635
output                  t5_wb_we_o;
1636
output  [`TC_DW-1:0]     t5_wb_dat_o;
1637
input   [`TC_DW-1:0]     t5_wb_dat_i;
1638
input                   t5_wb_ack_i;
1639
input                   t5_wb_err_i;
1640
 
1641
//
1642
// WB master i/f connecting target 6
1643
//
1644
output                  t6_wb_cyc_o;
1645
output                  t6_wb_stb_o;
1646
output                  t6_wb_cab_o;
1647
output  [`TC_AW-1:0]     t6_wb_adr_o;
1648
output  [`TC_BSW-1:0]    t6_wb_sel_o;
1649
output                  t6_wb_we_o;
1650
output  [`TC_DW-1:0]     t6_wb_dat_o;
1651
input   [`TC_DW-1:0]     t6_wb_dat_i;
1652
input                   t6_wb_ack_i;
1653
input                   t6_wb_err_i;
1654
 
1655
//
1656
// WB master i/f connecting target 7
1657
//
1658
output                  t7_wb_cyc_o;
1659
output                  t7_wb_stb_o;
1660
output                  t7_wb_cab_o;
1661
output  [`TC_AW-1:0]     t7_wb_adr_o;
1662
output  [`TC_BSW-1:0]    t7_wb_sel_o;
1663
output                  t7_wb_we_o;
1664
output  [`TC_DW-1:0]     t7_wb_dat_o;
1665
input   [`TC_DW-1:0]     t7_wb_dat_i;
1666
input                   t7_wb_ack_i;
1667
input                   t7_wb_err_i;
1668
 
1669
//
1670
// Internal wires & registers
1671
//
1672
wire    [`TC_IIN_W-1:0]  i0_in;
1673
wire    [`TC_TIN_W-1:0]  i0_out;
1674
wire    [`TC_IIN_W-1:0]  t0_out, t1_out,
1675
                        t2_out, t3_out,
1676
                        t4_out, t5_out,
1677
                        t6_out, t7_out;
1678
wire    [`TC_TIN_W-1:0]  t0_in, t1_in,
1679
                        t2_in, t3_in,
1680
                        t4_in, t5_in,
1681
                        t6_in, t7_in;
1682
wire    [7:0]            req_t;
1683
 
1684
//
1685
// Group WB initiator 0 i/f inputs and outputs
1686
//
1687
assign i0_in = {i0_wb_cyc_i, i0_wb_stb_i, i0_wb_cab_i, i0_wb_adr_i,
1688
                i0_wb_sel_i, i0_wb_we_i, i0_wb_dat_i};
1689
assign {i0_wb_dat_o, i0_wb_ack_o, i0_wb_err_o} = i0_out;
1690
 
1691
//
1692
// Group WB target 0 i/f inputs and outputs
1693
//
1694
assign {t0_wb_cyc_o, t0_wb_stb_o, t0_wb_cab_o, t0_wb_adr_o,
1695
                t0_wb_sel_o, t0_wb_we_o, t0_wb_dat_o} = t0_out;
1696
assign t0_in = {t0_wb_dat_i, t0_wb_ack_i, t0_wb_err_i};
1697
 
1698
//
1699
// Group WB target 1 i/f inputs and outputs
1700
//
1701
assign {t1_wb_cyc_o, t1_wb_stb_o, t1_wb_cab_o, t1_wb_adr_o,
1702
                t1_wb_sel_o, t1_wb_we_o, t1_wb_dat_o} = t1_out;
1703
assign t1_in = {t1_wb_dat_i, t1_wb_ack_i, t1_wb_err_i};
1704
 
1705
//
1706
// Group WB target 2 i/f inputs and outputs
1707
//
1708
assign {t2_wb_cyc_o, t2_wb_stb_o, t2_wb_cab_o, t2_wb_adr_o,
1709
                t2_wb_sel_o, t2_wb_we_o, t2_wb_dat_o} = t2_out;
1710
assign t2_in = {t2_wb_dat_i, t2_wb_ack_i, t2_wb_err_i};
1711
 
1712
//
1713
// Group WB target 3 i/f inputs and outputs
1714
//
1715
assign {t3_wb_cyc_o, t3_wb_stb_o, t3_wb_cab_o, t3_wb_adr_o,
1716
                t3_wb_sel_o, t3_wb_we_o, t3_wb_dat_o} = t3_out;
1717
assign t3_in = {t3_wb_dat_i, t3_wb_ack_i, t3_wb_err_i};
1718
 
1719
//
1720
// Group WB target 4 i/f inputs and outputs
1721
//
1722
assign {t4_wb_cyc_o, t4_wb_stb_o, t4_wb_cab_o, t4_wb_adr_o,
1723
                t4_wb_sel_o, t4_wb_we_o, t4_wb_dat_o} = t4_out;
1724
assign t4_in = {t4_wb_dat_i, t4_wb_ack_i, t4_wb_err_i};
1725
 
1726
//
1727
// Group WB target 5 i/f inputs and outputs
1728
//
1729
assign {t5_wb_cyc_o, t5_wb_stb_o, t5_wb_cab_o, t5_wb_adr_o,
1730
                t5_wb_sel_o, t5_wb_we_o, t5_wb_dat_o} = t5_out;
1731
assign t5_in = {t5_wb_dat_i, t5_wb_ack_i, t5_wb_err_i};
1732
 
1733
//
1734
// Group WB target 6 i/f inputs and outputs
1735
//
1736
assign {t6_wb_cyc_o, t6_wb_stb_o, t6_wb_cab_o, t6_wb_adr_o,
1737
                t6_wb_sel_o, t6_wb_we_o, t6_wb_dat_o} = t6_out;
1738
assign t6_in = {t6_wb_dat_i, t6_wb_ack_i, t6_wb_err_i};
1739
 
1740
//
1741
// Group WB target 7 i/f inputs and outputs
1742
//
1743
assign {t7_wb_cyc_o, t7_wb_stb_o, t7_wb_cab_o, t7_wb_adr_o,
1744
                t7_wb_sel_o, t7_wb_we_o, t7_wb_dat_o} = t7_out;
1745
assign t7_in = {t7_wb_dat_i, t7_wb_ack_i, t7_wb_err_i};
1746
 
1747
//
1748
// Assign to WB target i/f outputs
1749
//
1750
// Either inputs from the initiator are assigned or zeros.
1751
//
1752
assign t0_out = req_t[0] ? i0_in : {`TC_IIN_W{1'b0}};
1753
assign t1_out = req_t[1] ? i0_in : {`TC_IIN_W{1'b0}};
1754
assign t2_out = req_t[2] ? i0_in : {`TC_IIN_W{1'b0}};
1755
assign t3_out = req_t[3] ? i0_in : {`TC_IIN_W{1'b0}};
1756
assign t4_out = req_t[4] ? i0_in : {`TC_IIN_W{1'b0}};
1757
assign t5_out = req_t[5] ? i0_in : {`TC_IIN_W{1'b0}};
1758
assign t6_out = req_t[6] ? i0_in : {`TC_IIN_W{1'b0}};
1759
assign t7_out = req_t[7] ? i0_in : {`TC_IIN_W{1'b0}};
1760
 
1761
//
1762
// Assign to WB initiator i/f outputs
1763
//
1764
// Assign inputs from target to initiator outputs according to
1765
// which target is accessed. If there is no request for a target,
1766
// assign zeros.
1767
//
1768
assign i0_out = req_t[0] ? t0_in :
1769
                req_t[1] ? t1_in :
1770
                req_t[2] ? t2_in :
1771
                req_t[3] ? t3_in :
1772
                req_t[4] ? t4_in :
1773
                req_t[5] ? t5_in :
1774
                req_t[6] ? t6_in :
1775
                req_t[7] ? t7_in : {`TC_TIN_W{1'b0}};
1776
 
1777
//
1778
// Determine which target is being accessed.
1779
//
1780
assign req_t[0] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t0_addr_w] == t0_addr);
1781
assign req_t[1] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t1_addr);
1782
assign req_t[2] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t2_addr);
1783
assign req_t[3] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t3_addr);
1784
assign req_t[4] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t4_addr);
1785
assign req_t[5] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t5_addr);
1786
assign req_t[6] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t6_addr);
1787
assign req_t[7] = i0_wb_cyc_i & (i0_wb_adr_i[`TC_AW-1:`TC_AW-t17_addr_w] == t7_addr);
1788
 
1789
endmodule

powered by: WebSVN 2.1.0

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