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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [arbiter/] [arbiter_dbus.v] - Blame information for rev 522

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

Line No. Rev Author Line
1 361 julius
//////////////////////////////////////////////////////////////////////
2
///                                                               //// 
3
/// Wishbone arbiter, burst-compatible                            ////
4
///                                                               ////
5
/// Simple arbiter, multi-master, multi-slave with default slave  ////
6
/// for chaining with peripheral arbiter                          ////
7
///                                                               ////
8
/// Julius Baxter, julius@opencores.org                           ////
9
///                                                               ////
10
//////////////////////////////////////////////////////////////////////
11
////                                                              ////
12
//// Copyright (C) 2009, 2010 Authors and OPENCORES.ORG           ////
13
////                                                              ////
14
//// This source file may be used and distributed without         ////
15
//// restriction provided that this copyright statement is not    ////
16
//// removed from the file and that any derivative work contains  ////
17
//// the original copyright notice and the associated disclaimer. ////
18
////                                                              ////
19
//// This source file is free software; you can redistribute it   ////
20
//// and/or modify it under the terms of the GNU Lesser General   ////
21
//// Public License as published by the Free Software Foundation; ////
22
//// either version 2.1 of the License, or (at your option) any   ////
23
//// later version.                                               ////
24
////                                                              ////
25
//// This source is distributed in the hope that it will be       ////
26
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
27
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
28
//// PURPOSE.  See the GNU Lesser General Public License for more ////
29
//// details.                                                     ////
30
////                                                              ////
31
//// You should have received a copy of the GNU Lesser General    ////
32
//// Public License along with this source; if not, download it   ////
33
//// from http://www.opencores.org/lgpl.shtml                     ////
34
////                                                              ////
35
//////////////////////////////////////////////////////////////////////
36
`include "orpsoc-defines.v"
37
// 2 Masters, a few slaves
38
module arbiter_dbus
39
  (
40
   // or1200 data master
41
   // Wishbone Master interface
42
   wbm0_adr_o,
43
   wbm0_dat_o,
44
   wbm0_sel_o,
45
   wbm0_we_o,
46
   wbm0_cyc_o,
47
   wbm0_stb_o,
48
   wbm0_cti_o,
49
   wbm0_bte_o,
50
 
51
   wbm0_dat_i,
52
   wbm0_ack_i,
53
   wbm0_err_i,
54
   wbm0_rty_i,
55
 
56
   // or1200 debug master
57
   // Wishbone Master interface
58
   wbm1_adr_o,
59
   wbm1_dat_o,
60
   wbm1_sel_o,
61
   wbm1_we_o,
62
   wbm1_cyc_o,
63
   wbm1_stb_o,
64
   wbm1_cti_o,
65
   wbm1_bte_o,
66
 
67
   wbm1_dat_i,
68
   wbm1_ack_i,
69
   wbm1_err_i,
70
   wbm1_rty_i,
71
 
72
   // Slave one
73
   // Wishbone Slave interface
74
   wbs0_adr_i,
75
   wbs0_dat_i,
76
   wbs0_sel_i,
77
   wbs0_we_i,
78
   wbs0_cyc_i,
79
   wbs0_stb_i,
80
   wbs0_cti_i,
81
   wbs0_bte_i,
82
 
83
   wbs0_dat_o,
84
   wbs0_ack_o,
85
   wbs0_err_o,
86
   wbs0_rty_o,
87
 
88
   // Slave two
89
   // Wishbone Slave interface
90
   wbs1_adr_i,
91
   wbs1_dat_i,
92
   wbs1_sel_i,
93
   wbs1_we_i,
94
   wbs1_cyc_i,
95
   wbs1_stb_i,
96
   wbs1_cti_i,
97
   wbs1_bte_i,
98
 
99
   wbs1_dat_o,
100
   wbs1_ack_o,
101
   wbs1_err_o,
102
   wbs1_rty_o,
103
 
104
   /*
105
   // Slave three
106
   // Wishbone Slave interface
107
   wbs2_adr_i,
108
   wbs2_dat_i,
109
   wbs2_sel_i,
110
   wbs2_we_i,
111
   wbs2_cyc_i,
112
   wbs2_stb_i,
113
   wbs2_cti_i,
114
   wbs2_bte_i,
115
 
116
   wbs2_dat_o,
117
   wbs2_ack_o,
118
   wbs2_err_o,
119
   wbs2_rty_o,
120
 
121
   // Slave four
122
   // Wishbone Slave interface
123
   wbs3_adr_i,
124
   wbs3_dat_i,
125
   wbs3_sel_i,
126
   wbs3_we_i,
127
   wbs3_cyc_i,
128
   wbs3_stb_i,
129
   wbs3_cti_i,
130
   wbs3_bte_i,
131
 
132
   wbs3_dat_o,
133
   wbs3_ack_o,
134
   wbs3_err_o,
135
   wbs3_rty_o,
136
 
137
   // Slave five
138
   // Wishbone Slave interface
139
   wbs4_adr_i,
140
   wbs4_dat_i,
141
   wbs4_sel_i,
142
   wbs4_we_i,
143
   wbs4_cyc_i,
144
   wbs4_stb_i,
145
   wbs4_cti_i,
146
   wbs4_bte_i,
147
 
148
   wbs4_dat_o,
149
   wbs4_ack_o,
150
   wbs4_err_o,
151
   wbs4_rty_o,
152
 
153
    // Slave six
154
    // Wishbone Slave interface
155
    wbs5_adr_i,
156
    wbs5_dat_i,
157
    wbs5_sel_i,
158
    wbs5_we_i,
159
    wbs5_cyc_i,
160
    wbs5_stb_i,
161
    wbs5_cti_i,
162
    wbs5_bte_i,
163
 
164
    wbs5_dat_o,
165
    wbs5_ack_o,
166
    wbs5_err_o,
167
    wbs5_rty_o,
168
 
169
    // Slave seven
170
    // Wishbone Slave interface
171
    wbs6_adr_i,
172
    wbs6_dat_i,
173
    wbs6_sel_i,
174
    wbs6_we_i,
175
    wbs6_cyc_i,
176
    wbs6_stb_i,
177
    wbs6_cti_i,
178
    wbs6_bte_i,
179
 
180
    wbs6_dat_o,
181
    wbs6_ack_o,
182
    wbs6_err_o,
183
    wbs6_rty_o,
184
 
185
    // Slave eight
186
    // Wishbone Slave interface
187
    wbs7_adr_i,
188
    wbs7_dat_i,
189
    wbs7_sel_i,
190
    wbs7_we_i,
191
    wbs7_cyc_i,
192
    wbs7_stb_i,
193
    wbs7_cti_i,
194
    wbs7_bte_i,
195
 
196
    wbs7_dat_o,
197
    wbs7_ack_o,
198
    wbs7_err_o,
199
    wbs7_rty_o,
200
 
201
    // Slave nine
202
    // Wishbone Slave interface
203
    wbs8_adr_i,
204
    wbs8_dat_i,
205
    wbs8_sel_i,
206
    wbs8_we_i,
207
    wbs8_cyc_i,
208
    wbs8_stb_i,
209
    wbs8_cti_i,
210
    wbs8_bte_i,
211
 
212
    wbs8_dat_o,
213
    wbs8_ack_o,
214
    wbs8_err_o,
215
    wbs8_rty_o,
216
 
217
    // Slave ten
218
    // Wishbone Slave interface
219
    wbs9_adr_i,
220
    wbs9_dat_i,
221
    wbs9_sel_i,
222
    wbs9_we_i,
223
    wbs9_cyc_i,
224
    wbs9_stb_i,
225
    wbs9_cti_i,
226
    wbs9_bte_i,
227
 
228
    wbs9_dat_o,
229
    wbs9_ack_o,
230
    wbs9_err_o,
231
    wbs9_rty_o,
232
 
233
    // Slave eleven
234
    // Wishbone Slave interface
235
    wbs10_adr_i,
236
    wbs10_dat_i,
237
    wbs10_sel_i,
238
    wbs10_we_i,
239
    wbs10_cyc_i,
240
    wbs10_stb_i,
241
    wbs10_cti_i,
242
    wbs10_bte_i,
243
 
244
    wbs10_dat_o,
245
    wbs10_ack_o,
246
    wbs10_err_o,
247
    wbs10_rty_o,
248
 
249
    // Slave twelve
250
    // Wishbone Slave interface
251
    wbs11_adr_i,
252
    wbs11_dat_i,
253
    wbs11_sel_i,
254
    wbs11_we_i,
255
    wbs11_cyc_i,
256
    wbs11_stb_i,
257
    wbs11_cti_i,
258
    wbs11_bte_i,
259
 
260
    wbs11_dat_o,
261
    wbs11_ack_o,
262
    wbs11_err_o,
263
    wbs11_rty_o,
264
 
265
    // Slave thirteen
266
    // Wishbone Slave interface
267
    wbs12_adr_i,
268
    wbs12_dat_i,
269
    wbs12_sel_i,
270
    wbs12_we_i,
271
    wbs12_cyc_i,
272
    wbs12_stb_i,
273
    wbs12_cti_i,
274
    wbs12_bte_i,
275
 
276
    wbs12_dat_o,
277
    wbs12_ack_o,
278
    wbs12_err_o,
279
    wbs12_rty_o,
280
 
281
    // Slave fourteen
282
    // Wishbone Slave interface
283
    wbs13_adr_i,
284
    wbs13_dat_i,
285
    wbs13_sel_i,
286
    wbs13_we_i,
287
    wbs13_cyc_i,
288
    wbs13_stb_i,
289
    wbs13_cti_i,
290
    wbs13_bte_i,
291
 
292
    wbs13_dat_o,
293
    wbs13_ack_o,
294
    wbs13_err_o,
295
    wbs13_rty_o,
296
 
297
    // Slave fifteen
298
    // Wishbone Slave interface
299
    wbs14_adr_i,
300
    wbs14_dat_i,
301
    wbs14_sel_i,
302
    wbs14_we_i,
303
    wbs14_cyc_i,
304
    wbs14_stb_i,
305
    wbs14_cti_i,
306
    wbs14_bte_i,
307
 
308
    wbs14_dat_o,
309
    wbs14_ack_o,
310
    wbs14_err_o,
311
    wbs14_rty_o,
312
 
313
    // Slave sixteen
314
    // Wishbone Slave interface
315
    wbs15_adr_i,
316
    wbs15_dat_i,
317
    wbs15_sel_i,
318
    wbs15_we_i,
319
    wbs15_cyc_i,
320
    wbs15_stb_i,
321
    wbs15_cti_i,
322
    wbs15_bte_i,
323
 
324
    wbs15_dat_o,
325
    wbs15_ack_o,
326
    wbs15_err_o,
327
    wbs15_rty_o,
328
 
329
    // Slave seventeen
330
    // Wishbone Slave interface
331
    wbs16_adr_i,
332
    wbs16_dat_i,
333
    wbs16_sel_i,
334
    wbs16_we_i,
335
    wbs16_cyc_i,
336
    wbs16_stb_i,
337
    wbs16_cti_i,
338
    wbs16_bte_i,
339
 
340
    wbs16_dat_o,
341
    wbs16_ack_o,
342
    wbs16_err_o,
343
    wbs16_rty_o,
344
    */
345
 
346
   wb_clk,
347
   wb_rst
348
   );
349
 
350
   parameter wb_dat_width = 32;
351
   parameter wb_adr_width = 32;
352
 
353
   parameter wb_addr_match_width = 8;
354
 
355
   parameter wb_num_slaves = 2; // must also (un)comment things if changing
356
 
357
   // Slave addresses - these should be defparam'd from top level
358
   // Declare them as you need them
359
   parameter slave0_adr = 0;
360
   parameter slave1_adr = 0;
361
   parameter slave2_adr = 0;
362
   parameter slave3_adr = 0;
363
   parameter slave4_adr = 0;
364
   parameter slave5_adr = 0;
365
   parameter slave6_adr = 0;
366
   parameter slave7_adr = 0;
367
   parameter slave8_adr = 0;
368
   parameter slave9_adr = 0;
369
   parameter slave10_adr = 0;
370
   parameter slave11_adr = 0;
371
   parameter slave12_adr = 0;
372
 
373
   // Select for slave 0
374
`define WB_ARB_ADDR_MATCH_SEL_SLAVE0 wb_adr_width-1:wb_adr_width-4
375
`define WB_ARB_ADDR_MATCH_SEL wb_adr_width-1:wb_adr_width-wb_addr_match_width
376
 
377
   input wb_clk;
378
   input wb_rst;
379
 
380
   // WB Master one
381
   input [wb_adr_width-1:0] wbm0_adr_o;
382
   input [wb_dat_width-1:0] wbm0_dat_o;
383
   input [3:0]               wbm0_sel_o;
384
   input                    wbm0_we_o;
385
   input                    wbm0_cyc_o;
386
   input                    wbm0_stb_o;
387
   input [2:0]               wbm0_cti_o;
388
   input [1:0]               wbm0_bte_o;
389
   output [wb_dat_width-1:0] wbm0_dat_i;
390
   output                    wbm0_ack_i;
391
   output                    wbm0_err_i;
392
   output                    wbm0_rty_i;
393
 
394
 
395
   input [wb_adr_width-1:0]  wbm1_adr_o;
396
   input [wb_dat_width-1:0]  wbm1_dat_o;
397
   input [3:0]                wbm1_sel_o;
398
   input                     wbm1_we_o;
399
   input                     wbm1_cyc_o;
400
   input                     wbm1_stb_o;
401
   input [2:0]                wbm1_cti_o;
402
   input [1:0]                wbm1_bte_o;
403
   output [wb_dat_width-1:0] wbm1_dat_i;
404
   output                    wbm1_ack_i;
405
   output                    wbm1_err_i;
406
   output                    wbm1_rty_i;
407
 
408
 
409
   // Slave one
410
   // Wishbone Slave interface
411
   output [wb_adr_width-1:0] wbs0_adr_i;
412
   output [wb_dat_width-1:0] wbs0_dat_i;
413
   output [3:0]               wbs0_sel_i;
414
   output                    wbs0_we_i;
415
   output                    wbs0_cyc_i;
416
   output                    wbs0_stb_i;
417
   output [2:0]       wbs0_cti_i;
418
   output [1:0]       wbs0_bte_i;
419
   input [wb_dat_width-1:0]  wbs0_dat_o;
420
   input                     wbs0_ack_o;
421
   input                     wbs0_err_o;
422
   input                     wbs0_rty_o;
423
 
424
 
425
   // Wishbone Slave interface
426
   output [wb_adr_width-1:0] wbs1_adr_i;
427
   output [wb_dat_width-1:0] wbs1_dat_i;
428
   output [3:0]               wbs1_sel_i;
429
   output                    wbs1_we_i;
430
   output                    wbs1_cyc_i;
431
   output                    wbs1_stb_i;
432
   output [2:0]       wbs1_cti_i;
433
   output [1:0]       wbs1_bte_i;
434
   input [wb_dat_width-1:0]  wbs1_dat_o;
435
   input                     wbs1_ack_o;
436
   input                     wbs1_err_o;
437
   input                     wbs1_rty_o;
438
 
439
/*
440
   // Wishbone Slave interface
441
   output [wb_adr_width-1:0] wbs2_adr_i;
442
   output [wb_dat_width-1:0] wbs2_dat_i;
443
   output [3:0]              wbs2_sel_i;
444
   output                    wbs2_we_i;
445
   output                    wbs2_cyc_i;
446
   output                    wbs2_stb_i;
447
   output [2:0]              wbs2_cti_i;
448
   output [1:0]              wbs2_bte_i;
449
   input [wb_dat_width-1:0]  wbs2_dat_o;
450
   input                     wbs2_ack_o;
451
   input                     wbs2_err_o;
452
   input                     wbs2_rty_o;
453
 
454
 
455
   // Wishbone Slave interface
456
   output [wb_adr_width-1:0] wbs3_adr_i;
457
   output [wb_dat_width-1:0] wbs3_dat_i;
458
   output [3:0]              wbs3_sel_i;
459
   output                    wbs3_we_i;
460
   output                    wbs3_cyc_i;
461
   output                    wbs3_stb_i;
462
   output [2:0]              wbs3_cti_i;
463
   output [1:0]              wbs3_bte_i;
464
   input [wb_dat_width-1:0]  wbs3_dat_o;
465
   input                     wbs3_ack_o;
466
   input                     wbs3_err_o;
467
   input                     wbs3_rty_o;
468
 
469
 
470
   // Wishbone Slave interface
471
   output [wb_adr_width-1:0] wbs4_adr_i;
472
   output [wb_dat_width-1:0] wbs4_dat_i;
473
   output [3:0]              wbs4_sel_i;
474
   output                    wbs4_we_i;
475
   output                    wbs4_cyc_i;
476
   output                    wbs4_stb_i;
477
   output [2:0]              wbs4_cti_i;
478
   output [1:0]              wbs4_bte_i;
479
   input [wb_dat_width-1:0]  wbs4_dat_o;
480
   input                     wbs4_ack_o;
481
   input                     wbs4_err_o;
482
   input                     wbs4_rty_o;
483
 
484
 
485
   // Wishbone Slave interface
486
   output [wb_adr_width-1:0] wbs5_adr_i;
487
   output [wb_dat_width-1:0] wbs5_dat_i;
488
   output [3:0]              wbs5_sel_i;
489
   output                    wbs5_we_i;
490
   output                    wbs5_cyc_i;
491
   output                    wbs5_stb_i;
492
   output [2:0]              wbs5_cti_i;
493
   output [1:0]              wbs5_bte_i;
494
   input [wb_dat_width-1:0]  wbs5_dat_o;
495
   input                     wbs5_ack_o;
496
   input                     wbs5_err_o;
497
   input                     wbs5_rty_o;
498
 
499
 
500
   // Wishbone Slave interface
501
   output [wb_adr_width-1:0] wbs6_adr_i;
502
   output [wb_dat_width-1:0] wbs6_dat_i;
503
   output [3:0]              wbs6_sel_i;
504
   output                    wbs6_we_i;
505
   output                    wbs6_cyc_i;
506
   output                    wbs6_stb_i;
507
   output [2:0]              wbs6_cti_i;
508
   output [1:0]              wbs6_bte_i;
509
   input [wb_dat_width-1:0]  wbs6_dat_o;
510
   input                     wbs6_ack_o;
511
   input                     wbs6_err_o;
512
   input                     wbs6_rty_o;
513
 
514
 
515
   // Wishbone Slave interface
516
   output [wb_adr_width-1:0] wbs7_adr_i;
517
   output [wb_dat_width-1:0] wbs7_dat_i;
518
   output [3:0]              wbs7_sel_i;
519
   output                    wbs7_we_i;
520
   output                    wbs7_cyc_i;
521
   output                    wbs7_stb_i;
522
   output [2:0]              wbs7_cti_i;
523
   output [1:0]              wbs7_bte_i;
524
   input [wb_dat_width-1:0]  wbs7_dat_o;
525
   input                     wbs7_ack_o;
526
   input                     wbs7_err_o;
527
   input                     wbs7_rty_o;
528
 
529
 
530
   // Wishbone Slave interface
531
   output [wb_adr_width-1:0] wbs8_adr_i;
532
   output [wb_dat_width-1:0] wbs8_dat_i;
533
   output [3:0]              wbs8_sel_i;
534
   output                    wbs8_we_i;
535
   output                    wbs8_cyc_i;
536
   output                    wbs8_stb_i;
537
   output [2:0]              wbs8_cti_i;
538
   output [1:0]              wbs8_bte_i;
539
   input [wb_dat_width-1:0]  wbs8_dat_o;
540
   input                     wbs8_ack_o;
541
   input                     wbs8_err_o;
542
   input                     wbs8_rty_o;
543
 
544
 
545
   // Wishbone Slave interface
546
   output [wb_adr_width-1:0] wbs9_adr_i;
547
   output [wb_dat_width-1:0] wbs9_dat_i;
548
   output [3:0]              wbs9_sel_i;
549
   output                    wbs9_we_i;
550
   output                    wbs9_cyc_i;
551
   output                    wbs9_stb_i;
552
   output [2:0]              wbs9_cti_i;
553
   output [1:0]              wbs9_bte_i;
554
   input [wb_dat_width-1:0]  wbs9_dat_o;
555
   input                     wbs9_ack_o;
556
   input                     wbs9_err_o;
557
   input                     wbs9_rty_o;
558
 
559
 
560
   // Wishbone Slave interface
561
   output [wb_adr_width-1:0] wbs10_adr_i;
562
   output [wb_dat_width-1:0] wbs10_dat_i;
563
   output [3:0]              wbs10_sel_i;
564
   output                    wbs10_we_i;
565
   output                    wbs10_cyc_i;
566
   output                    wbs10_stb_i;
567
   output [2:0]              wbs10_cti_i;
568
   output [1:0]              wbs10_bte_i;
569
   input [wb_dat_width-1:0]  wbs10_dat_o;
570
   input                     wbs10_ack_o;
571
   input                     wbs10_err_o;
572
   input                     wbs10_rty_o;
573
 
574
 
575
   // Wishbone Slave interface
576
   output [wb_adr_width-1:0] wbs11_adr_i;
577
   output [wb_dat_width-1:0] wbs11_dat_i;
578
   output [3:0]              wbs11_sel_i;
579
   output                    wbs11_we_i;
580
   output                    wbs11_cyc_i;
581
   output                    wbs11_stb_i;
582
   output [2:0]              wbs11_cti_i;
583
   output [1:0]              wbs11_bte_i;
584
   input [wb_dat_width-1:0]  wbs11_dat_o;
585
   input                     wbs11_ack_o;
586
   input                     wbs11_err_o;
587
   input                     wbs11_rty_o;
588
 
589
 
590
   // Wishbone Slave interface
591
   output [wb_adr_width-1:0] wbs12_adr_i;
592
   output [wb_dat_width-1:0] wbs12_dat_i;
593
   output [3:0]              wbs12_sel_i;
594
   output                    wbs12_we_i;
595
   output                    wbs12_cyc_i;
596
   output                    wbs12_stb_i;
597
   output [2:0]              wbs12_cti_i;
598
   output [1:0]              wbs12_bte_i;
599
   input [wb_dat_width-1:0]  wbs12_dat_o;
600
   input                     wbs12_ack_o;
601
   input                     wbs12_err_o;
602
   input                     wbs12_rty_o;
603
 
604
 
605
   // Wishbone Slave interface
606
   output [wb_adr_width-1:0] wbs13_adr_i;
607
   output [wb_dat_width-1:0] wbs13_dat_i;
608
   output [3:0]              wbs13_sel_i;
609
   output                    wbs13_we_i;
610
   output                    wbs13_cyc_i;
611
   output                    wbs13_stb_i;
612
   output [2:0]              wbs13_cti_i;
613
   output [1:0]              wbs13_bte_i;
614
   input [wb_dat_width-1:0]  wbs13_dat_o;
615
   input                     wbs13_ack_o;
616
   input                     wbs13_err_o;
617
   input                     wbs13_rty_o;
618
 
619
 
620
   // Wishbone Slave interface
621
   output [wb_adr_width-1:0] wbs14_adr_i;
622
   output [wb_dat_width-1:0] wbs14_dat_i;
623
   output [3:0]              wbs14_sel_i;
624
   output                    wbs14_we_i;
625
   output                    wbs14_cyc_i;
626
   output                    wbs14_stb_i;
627
   output [2:0]              wbs14_cti_i;
628
   output [1:0]              wbs14_bte_i;
629
   input [wb_dat_width-1:0]  wbs14_dat_o;
630
   input                     wbs14_ack_o;
631
   input                     wbs14_err_o;
632
   input                     wbs14_rty_o;
633
 
634
 
635
   // Wishbone Slave interface
636
   output [wb_adr_width-1:0] wbs15_adr_i;
637
   output [wb_dat_width-1:0] wbs15_dat_i;
638
   output [3:0]              wbs15_sel_i;
639
   output                    wbs15_we_i;
640
   output                    wbs15_cyc_i;
641
   output                    wbs15_stb_i;
642
   output [2:0]              wbs15_cti_i;
643
   output [1:0]              wbs15_bte_i;
644
   input [wb_dat_width-1:0]  wbs15_dat_o;
645
   input                     wbs15_ack_o;
646
   input                     wbs15_err_o;
647
   input                     wbs15_rty_o;
648
 
649
 
650
   // Wishbone Slave interface
651
   output [wb_adr_width-1:0] wbs16_adr_i;
652
   output [wb_dat_width-1:0] wbs16_dat_i;
653
   output [3:0]              wbs16_sel_i;
654
   output                    wbs16_we_i;
655
   output                    wbs16_cyc_i;
656
   output                    wbs16_stb_i;
657
   output [2:0]              wbs16_cti_i;
658
   output [1:0]              wbs16_bte_i;
659
   input [wb_dat_width-1:0]  wbs16_dat_o;
660
   input                     wbs16_ack_o;
661
   input                     wbs16_err_o;
662
   input                     wbs16_rty_o;
663
 
664
*/
665
 
666
   reg               watchdog_err;
667
 
668
`ifdef ARBITER_DBUS_REGISTERING
669
 
670
 
671
   // Registering setup:
672
   // Masters typically register their outputs, so do the master selection and
673
   // muxing before registering in the arbiter. Keep the common parts outside
674
   // for code brevity.
675
 
676
   // Master ins -> |MUX> -> these wires
677
   wire [wb_adr_width-1:0]   wbm_adr_o_w;
678
   wire [wb_dat_width-1:0]   wbm_dat_o_w;
679
   wire [3:0]                 wbm_sel_o_w;
680
   wire                      wbm_we_o_w;
681
   wire                      wbm_cyc_o_w;
682
   wire                      wbm_stb_o_w;
683
   wire [2:0]                 wbm_cti_o_w;
684
   wire [1:0]                 wbm_bte_o_w;
685
   // Slave ins -> |MUX> -> these wires
686
   wire [wb_dat_width-1:0]   wbm_dat_i;
687
   wire                      wbm_ack_i;
688
   wire                      wbm_err_i;
689
   wire                      wbm_rty_i;
690
 
691
   // Registers after masters input mux
692
   reg [wb_adr_width-1:0]    wbm_adr_o_r;
693
   reg [wb_dat_width-1:0]    wbm_dat_o_r;
694
   reg [3:0]                  wbm_sel_o_r;
695
   reg                       wbm_we_o_r;
696
   reg                       wbm_cyc_o_r;
697
   reg                       wbm_stb_o_r;
698
   reg [2:0]                  wbm_cti_o_r;
699
   reg [1:0]                  wbm_bte_o_r;
700
 
701
   // Master input mux register wires
702
   wire [wb_adr_width-1:0]   wbm_adr_o;
703
   wire [wb_dat_width-1:0]   wbm_dat_o;
704
   wire [3:0]                 wbm_sel_o;
705
   wire                      wbm_we_o;
706
   wire                      wbm_cyc_o;
707
   wire                      wbm_stb_o;
708
   wire [2:0]                 wbm_cti_o;
709
   wire [1:0]                 wbm_bte_o;
710
 
711
   // Registers after slaves input mux
712
   reg [wb_dat_width-1:0]    wbm_dat_i_r;
713
   reg                       wbm_ack_i_r;
714
   reg                       wbm_err_i_r;
715
   reg                       wbm_rty_i_r;
716
 
717
   // Master select (MUX controls)
718
   wire [1:0]                 master_sel;
719
   // priority to wbm1, the debug master
720
   assign master_sel[0] = wbm0_cyc_o & !wbm1_cyc_o;
721
   assign master_sel[1] = wbm1_cyc_o;
722
 
723
 
724
   // Master input mux, priority to debug master
725
   assign wbm_adr_o_w = master_sel[1] ? wbm1_adr_o :
726
                      wbm0_adr_o;
727
 
728
   assign wbm_dat_o_w = master_sel[1] ? wbm1_dat_o :
729
                      wbm0_dat_o;
730
 
731
   assign wbm_sel_o_w = master_sel[1] ? wbm1_sel_o :
732
                      wbm0_sel_o;
733
 
734
   assign wbm_we_o_w = master_sel[1] ? wbm1_we_o :
735
                      wbm0_we_o;
736
 
737
   assign wbm_cyc_o_w = master_sel[1] ? wbm1_cyc_o :
738
                      wbm0_cyc_o;
739
 
740
   assign wbm_stb_o_w = master_sel[1] ? wbm1_stb_o :
741
                     wbm0_stb_o;
742
 
743
   assign wbm_cti_o_w = master_sel[1] ? wbm1_cti_o :
744
                     wbm0_cti_o;
745
 
746
   assign wbm_bte_o_w = master_sel[1] ? wbm1_bte_o :
747
                      wbm0_bte_o;
748
 
749
 
750
   // Register muxed master signals
751
   always @(posedge wb_clk)
752
     begin
753
        wbm_adr_o_r <= wbm_adr_o_w;
754
        wbm_dat_o_r <= wbm_dat_o_w;
755
        wbm_sel_o_r <= wbm_sel_o_w;
756
        wbm_we_o_r <= wbm_we_o_w;
757
        wbm_cyc_o_r <= wbm_cyc_o_w;
758
        wbm_stb_o_r <= wbm_stb_o_w & !wbm_ack_i & !wbm_ack_i_r;
759
        wbm_cti_o_r <= wbm_cti_o_w;
760
        wbm_bte_o_r <= wbm_bte_o_w;
761
 
762
        wbm_dat_i_r <= wbm_dat_i;
763
        wbm_ack_i_r <= wbm_ack_i;
764
        wbm_err_i_r <= wbm_err_i;
765
        wbm_rty_i_r <= wbm_rty_i;
766
     end // always @ (posedge wb_clk)
767
 
768
 
769
   assign wbm_adr_o = wbm_adr_o_r;
770
   assign wbm_dat_o = wbm_dat_o_r;
771
   assign wbm_sel_o = wbm_sel_o_r;
772
   assign wbm_we_o = wbm_we_o_r;
773
   assign wbm_cyc_o = wbm_cyc_o_r;
774
   assign wbm_stb_o = wbm_stb_o_r;
775
   assign wbm_cti_o = wbm_cti_o_r;
776
   assign wbm_bte_o = wbm_bte_o_r;
777
 
778
   // Master input mux, priority to debug master
779
   assign wbm0_dat_i = wbm_dat_i_r;
780
   assign wbm0_ack_i = wbm_ack_i_r & master_sel[0];
781
   assign wbm0_err_i = wbm_err_i_r & master_sel[0];
782
   assign wbm0_rty_i = wbm_rty_i_r & master_sel[0];
783
 
784
   assign wbm1_dat_i = wbm_dat_i_r;
785
   assign wbm1_ack_i = wbm_ack_i_r & master_sel[1];
786
   assign wbm1_err_i = wbm_err_i_r & master_sel[1];
787
   assign wbm1_rty_i = wbm_rty_i_r & master_sel[1];
788
 
789
`else // !`ifdef ARBITER_DBUS_REGISTERING
790
 
791
   // Master input mux output wires
792
   wire [wb_adr_width-1:0]   wbm_adr_o;
793
   wire [wb_dat_width-1:0]   wbm_dat_o;
794
   wire [3:0]                 wbm_sel_o;
795
   wire                      wbm_we_o;
796
   wire                      wbm_cyc_o;
797
   wire                      wbm_stb_o;
798
   wire [2:0]                 wbm_cti_o;
799
   wire [1:0]                 wbm_bte_o;
800
 
801
   // Master select
802
   wire [1:0]                 master_sel;
803
   // priority to wbm1, the debug master
804
   assign master_sel[0] = wbm0_cyc_o & !wbm1_cyc_o;
805
   assign master_sel[1] = wbm1_cyc_o;
806
 
807
 
808
   // Master input mux, priority to debug master
809
   assign wbm_adr_o = master_sel[1] ? wbm1_adr_o :
810
                      wbm0_adr_o;
811
 
812
   assign wbm_dat_o = master_sel[1] ? wbm1_dat_o :
813
                      wbm0_dat_o;
814
 
815
   assign wbm_sel_o = master_sel[1] ? wbm1_sel_o :
816
                      wbm0_sel_o;
817
 
818
   assign wbm_we_o = master_sel[1] ? wbm1_we_o :
819
                      wbm0_we_o;
820
 
821
   assign wbm_cyc_o = master_sel[1] ? wbm1_cyc_o :
822
                      wbm0_cyc_o;
823
 
824
   assign wbm_stb_o = master_sel[1] ? wbm1_stb_o :
825
                     wbm0_stb_o;
826
 
827
   assign wbm_cti_o = master_sel[1] ? wbm1_cti_o :
828
                     wbm0_cti_o;
829
 
830
   assign wbm_bte_o = master_sel[1] ? wbm1_bte_o :
831
                      wbm0_bte_o;
832
 
833
 
834
   wire [wb_dat_width-1:0]   wbm_dat_i;
835
   wire                      wbm_ack_i;
836
   wire                      wbm_err_i;
837
   wire                      wbm_rty_i;
838
 
839
 
840
   assign wbm0_dat_i = wbm_dat_i;
841
   assign wbm0_ack_i = wbm_ack_i & master_sel[0];
842
   assign wbm0_err_i = wbm_err_i & master_sel[0];
843
   assign wbm0_rty_i = wbm_rty_i & master_sel[0];
844
 
845
   assign wbm1_dat_i = wbm_dat_i;
846
   assign wbm1_ack_i = wbm_ack_i & master_sel[1];
847
   assign wbm1_err_i = wbm_err_i & master_sel[1];
848
   assign wbm1_rty_i = wbm_rty_i & master_sel[1];
849
 
850
 
851
 
852
`endif // !`ifdef ARBITER_DBUS_REGISTERING
853
 
854
 
855
   // Slave select wire
856
   wire [wb_num_slaves-1:0]  wb_slave_sel;
857 362 julius
   reg [wb_num_slaves-1:0]   wb_slave_sel_r;
858
 
859
   // Register wb_slave_sel_r to break combinatorial loop when selecting default
860
   // slave
861
   always @(posedge wb_clk)
862
     wb_slave_sel_r <= wb_slave_sel;
863 361 julius
 
864
   // Slave out mux in wires   
865
   wire [wb_dat_width-1:0]   wbs_dat_o_mux_i [0:wb_num_slaves-1];
866
   wire                      wbs_ack_o_mux_i [0:wb_num_slaves-1];
867
   wire                      wbs_err_o_mux_i [0:wb_num_slaves-1];
868
   wire                      wbs_rty_o_mux_i [0:wb_num_slaves-1];
869
 
870
   //
871
   // Slave selects
872
   //
873
   assign wb_slave_sel[0] = wbm_adr_o[31:28] == slave0_adr | wbm_adr_o[31:28] == 4'hf; // Special case, point all reads to ROM address to here
874
 
875
   // Auto select last slave when others are not selected
876 362 julius
   assign wb_slave_sel[1] = !(wb_slave_sel_r[0]);
877 361 julius
 
878
/*
879
   assign wb_slave_sel[1] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave1_adr;
880
   assign wb_slave_sel[2] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave2_adr;
881
   assign wb_slave_sel[3] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave3_adr;
882
   assign wb_slave_sel[4] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave4_adr;
883
   assign wb_slave_sel[5] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave5_adr;
884
   assign wb_slave_sel[6] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave6_adr;
885
   assign wb_slave_sel[7] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave7_adr;
886
   assign wb_slave_sel[8] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave8_adr;
887
   assign wb_slave_sel[9] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave9_adr;
888
   assign wb_slave_sel[10] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave10_adr;
889
   assign wb_slave_sel[11] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave11_adr;
890
   assign wb_slave_sel[12] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave12_adr;
891
   assign wb_slave_sel[13] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave13_adr;
892
   assign wb_slave_sel[14] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave14_adr;
893
   assign wb_slave_sel[15] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave15_adr;
894
   assign wb_slave_sel[16] = wbm_adr_o[`WB_ARB_ADDR_MATCH_SEL] == slave16_adr;
895
*/
896
 
897
`ifdef ARBITER_DBUS_WATCHDOG
898
   reg [`ARBITER_DBUS_WATCHDOG_TIMER_WIDTH:0] watchdog_timer;
899
   reg                       wbm_stb_r; // Register strobe
900
   wire                      wbm_stb_edge; // Detect its edge
901
 
902
   always @(posedge wb_clk)
903
     wbm_stb_r <= wbm_stb_o;
904
 
905
   assign wbm_stb_edge = (wbm_stb_o & !wbm_stb_r);
906
 
907
   // Counter logic
908
   always @(posedge wb_clk)
909
     if (wb_rst) watchdog_timer <= 0;
910
     else if (wbm_ack_i) // When we see an ack, turn off timer
911
       watchdog_timer <= 0;
912
     else if (wbm_stb_edge) // New access means start timer again
913
       watchdog_timer <= 1;
914
     else if (|watchdog_timer) // Continue counting if counter > 0
915
       watchdog_timer <= watchdog_timer + 1;
916
 
917
   always @(posedge wb_clk)
918
     watchdog_err <= (&watchdog_timer);
919
 
920
 
921
`else // !`ifdef ARBITER_DBUS_WATCHDOG
922
 
923
   always @(posedge wb_clk)
924
     watchdog_err <= 0;
925
 
926
`endif // !`ifdef ARBITER_DBUS_WATCHDOG
927
 
928
 
929
 
930
   // Slave 0 inputs
931
   assign wbs0_adr_i = wbm_adr_o;
932
   assign wbs0_dat_i = wbm_dat_o;
933
   assign wbs0_sel_i = wbm_sel_o;
934 362 julius
   assign wbs0_cyc_i = wbm_cyc_o & wb_slave_sel_r[0];
935
   assign wbs0_stb_i = wbm_stb_o & wb_slave_sel_r[0];
936 361 julius
   assign wbs0_we_i =  wbm_we_o;
937
   assign wbs0_cti_i = wbm_cti_o;
938
   assign wbs0_bte_i = wbm_bte_o;
939
   assign wbs_dat_o_mux_i[0] = wbs0_dat_o;
940 362 julius
   assign wbs_ack_o_mux_i[0] = wbs0_ack_o & wb_slave_sel_r[0];
941
   assign wbs_err_o_mux_i[0] = wbs0_err_o & wb_slave_sel_r[0];
942
   assign wbs_rty_o_mux_i[0] = wbs0_rty_o & wb_slave_sel_r[0];
943 361 julius
 
944
 
945
   // Slave 1 inputs
946
   assign wbs1_adr_i = wbm_adr_o;
947
   assign wbs1_dat_i = wbm_dat_o;
948
   assign wbs1_sel_i = wbm_sel_o;
949 362 julius
   assign wbs1_cyc_i = wbm_cyc_o & wb_slave_sel_r[1];
950
   assign wbs1_stb_i = wbm_stb_o & wb_slave_sel_r[1];
951 361 julius
   assign wbs1_we_i =  wbm_we_o;
952
   assign wbs1_cti_i = wbm_cti_o;
953
   assign wbs1_bte_i = wbm_bte_o;
954
   assign wbs_dat_o_mux_i[1] = wbs1_dat_o;
955 362 julius
   assign wbs_ack_o_mux_i[1] = wbs1_ack_o & wb_slave_sel_r[1];
956
   assign wbs_err_o_mux_i[1] = wbs1_err_o & wb_slave_sel_r[1];
957
   assign wbs_rty_o_mux_i[1] = wbs1_rty_o & wb_slave_sel_r[1];
958 361 julius
 
959
/*
960
   // Slave 2 inputs
961
   assign wbs2_adr_i = wbm_adr_o;
962
   assign wbs2_dat_i = wbm_dat_o;
963
   assign wbs2_sel_i = wbm_sel_o;
964 362 julius
   assign wbs2_cyc_i = wbm_cyc_o & wb_slave_sel_r[2];
965
   assign wbs2_stb_i = wbm_stb_o & wb_slave_sel_r[2];
966 361 julius
   assign wbs2_we_i =  wbm_we_o;
967
   assign wbs2_cti_i = wbm_cti_o;
968
   assign wbs2_bte_i = wbm_bte_o;
969
   assign wbs_dat_o_mux_i[2] = wbs2_dat_o;
970 362 julius
   assign wbs_ack_o_mux_i[2] = wbs2_ack_o & wb_slave_sel_r[2];
971
   assign wbs_err_o_mux_i[2] = wbs2_err_o & wb_slave_sel_r[2];
972
   assign wbs_rty_o_mux_i[2] = wbs2_rty_o & wb_slave_sel_r[2];
973 361 julius
 
974
 
975
   // Slave 3 inputs
976
   assign wbs3_adr_i = wbm_adr_o;
977
   assign wbs3_dat_i = wbm_dat_o;
978
   assign wbs3_sel_i = wbm_sel_o;
979 362 julius
   assign wbs3_cyc_i = wbm_cyc_o & wb_slave_sel_r[3];
980
   assign wbs3_stb_i = wbm_stb_o & wb_slave_sel_r[3];
981 361 julius
   assign wbs3_we_i =  wbm_we_o;
982
   assign wbs3_cti_i = wbm_cti_o;
983
   assign wbs3_bte_i = wbm_bte_o;
984
   assign wbs_dat_o_mux_i[3] = wbs3_dat_o;
985 362 julius
   assign wbs_ack_o_mux_i[3] = wbs3_ack_o & wb_slave_sel_r[3];
986
   assign wbs_err_o_mux_i[3] = wbs3_err_o & wb_slave_sel_r[3];
987
   assign wbs_rty_o_mux_i[3] = wbs3_rty_o & wb_slave_sel_r[3];
988 361 julius
 
989
   // Slave 4 inputs
990
   assign wbs4_adr_i = wbm_adr_o;
991
   assign wbs4_dat_i = wbm_dat_o;
992
   assign wbs4_sel_i = wbm_sel_o;
993 362 julius
   assign wbs4_cyc_i = wbm_cyc_o & wb_slave_sel_r[4];
994
   assign wbs4_stb_i = wbm_stb_o & wb_slave_sel_r[4];
995 361 julius
   assign wbs4_we_i =  wbm_we_o;
996
   assign wbs4_cti_i = wbm_cti_o;
997
   assign wbs4_bte_i = wbm_bte_o;
998
   assign wbs_dat_o_mux_i[4] = wbs4_dat_o;
999 362 julius
   assign wbs_ack_o_mux_i[4] = wbs4_ack_o & wb_slave_sel_r[4];
1000
   assign wbs_err_o_mux_i[4] = wbs4_err_o & wb_slave_sel_r[4];
1001
   assign wbs_rty_o_mux_i[4] = wbs4_rty_o & wb_slave_sel_r[4];
1002 361 julius
 
1003
 
1004
   // Slave 5 inputs
1005
   assign wbs5_adr_i = wbm_adr_o;
1006
   assign wbs5_dat_i = wbm_dat_o;
1007
   assign wbs5_sel_i = wbm_sel_o;
1008 362 julius
   assign wbs5_cyc_i = wbm_cyc_o & wb_slave_sel_r[5];
1009
   assign wbs5_stb_i = wbm_stb_o & wb_slave_sel_r[5];
1010 361 julius
   assign wbs5_we_i =  wbm_we_o;
1011
   assign wbs5_cti_i = wbm_cti_o;
1012
   assign wbs5_bte_i = wbm_bte_o;
1013
   assign wbs_dat_o_mux_i[5] = wbs5_dat_o;
1014 362 julius
   assign wbs_ack_o_mux_i[5] = wbs5_ack_o & wb_slave_sel_r[5];
1015
   assign wbs_err_o_mux_i[5] = wbs5_err_o & wb_slave_sel_r[5];
1016
   assign wbs_rty_o_mux_i[5] = wbs5_rty_o & wb_slave_sel_r[5];
1017 361 julius
 
1018
 
1019
   // Slave 6 inputs
1020
   assign wbs6_adr_i = wbm_adr_o;
1021
   assign wbs6_dat_i = wbm_dat_o;
1022
   assign wbs6_sel_i = wbm_sel_o;
1023 362 julius
   assign wbs6_cyc_i = wbm_cyc_o & wb_slave_sel_r[6];
1024
   assign wbs6_stb_i = wbm_stb_o & wb_slave_sel_r[6];
1025 361 julius
   assign wbs6_we_i =  wbm_we_o;
1026
   assign wbs6_cti_i = wbm_cti_o;
1027
   assign wbs6_bte_i = wbm_bte_o;
1028
   assign wbs_dat_o_mux_i[6] = wbs6_dat_o;
1029 362 julius
   assign wbs_ack_o_mux_i[6] = wbs6_ack_o & wb_slave_sel_r[6];
1030
   assign wbs_err_o_mux_i[6] = wbs6_err_o & wb_slave_sel_r[6];
1031
   assign wbs_rty_o_mux_i[6] = wbs6_rty_o & wb_slave_sel_r[6];
1032 361 julius
 
1033
 
1034
   // Slave 7 inputs
1035
   assign wbs7_adr_i = wbm_adr_o;
1036
   assign wbs7_dat_i = wbm_dat_o;
1037
   assign wbs7_sel_i = wbm_sel_o;
1038 362 julius
   assign wbs7_cyc_i = wbm_cyc_o & wb_slave_sel_r[7];
1039
   assign wbs7_stb_i = wbm_stb_o & wb_slave_sel_r[7];
1040 361 julius
   assign wbs7_we_i =  wbm_we_o;
1041
   assign wbs7_cti_i = wbm_cti_o;
1042
   assign wbs7_bte_i = wbm_bte_o;
1043
   assign wbs_dat_o_mux_i[7] = wbs7_dat_o;
1044 362 julius
   assign wbs_ack_o_mux_i[7] = wbs7_ack_o & wb_slave_sel_r[7];
1045
   assign wbs_err_o_mux_i[7] = wbs7_err_o & wb_slave_sel_r[7];
1046
   assign wbs_rty_o_mux_i[7] = wbs7_rty_o & wb_slave_sel_r[7];
1047 361 julius
 
1048
 
1049
   // Slave 8 inputs
1050
   assign wbs8_adr_i = wbm_adr_o;
1051
   assign wbs8_dat_i = wbm_dat_o;
1052
   assign wbs8_sel_i = wbm_sel_o;
1053 362 julius
   assign wbs8_cyc_i = wbm_cyc_o & wb_slave_sel_r[8];
1054
   assign wbs8_stb_i = wbm_stb_o & wb_slave_sel_r[8];
1055 361 julius
   assign wbs8_we_i =  wbm_we_o;
1056
   assign wbs8_cti_i = wbm_cti_o;
1057
   assign wbs8_bte_i = wbm_bte_o;
1058
   assign wbs_dat_o_mux_i[8] = wbs8_dat_o;
1059 362 julius
   assign wbs_ack_o_mux_i[8] = wbs8_ack_o & wb_slave_sel_r[8];
1060
   assign wbs_err_o_mux_i[8] = wbs8_err_o & wb_slave_sel_r[8];
1061
   assign wbs_rty_o_mux_i[8] = wbs8_rty_o & wb_slave_sel_r[8];
1062 361 julius
 
1063
 
1064
   // Slave 9 inputs
1065
   assign wbs9_adr_i = wbm_adr_o;
1066
   assign wbs9_dat_i = wbm_dat_o;
1067
   assign wbs9_sel_i = wbm_sel_o;
1068 362 julius
   assign wbs9_cyc_i = wbm_cyc_o & wb_slave_sel_r[9];
1069
   assign wbs9_stb_i = wbm_stb_o & wb_slave_sel_r[9];
1070 361 julius
   assign wbs9_we_i =  wbm_we_o;
1071
   assign wbs9_cti_i = wbm_cti_o;
1072
   assign wbs9_bte_i = wbm_bte_o;
1073
   assign wbs_dat_o_mux_i[9] = wbs9_dat_o;
1074 362 julius
   assign wbs_ack_o_mux_i[9] = wbs9_ack_o & wb_slave_sel_r[9];
1075
   assign wbs_err_o_mux_i[9] = wbs9_err_o & wb_slave_sel_r[9];
1076
   assign wbs_rty_o_mux_i[9] = wbs9_rty_o & wb_slave_sel_r[9];
1077 361 julius
 
1078
 
1079
   // Slave 10 inputs
1080
   assign wbs10_adr_i = wbm_adr_o;
1081
   assign wbs10_dat_i = wbm_dat_o;
1082
   assign wbs10_sel_i = wbm_sel_o;
1083 362 julius
   assign wbs10_cyc_i = wbm_cyc_o & wb_slave_sel_r[10];
1084
   assign wbs10_stb_i = wbm_stb_o & wb_slave_sel_r[10];
1085 361 julius
   assign wbs10_we_i =  wbm_we_o;
1086
   assign wbs10_cti_i = wbm_cti_o;
1087
   assign wbs10_bte_i = wbm_bte_o;
1088
   assign wbs_dat_o_mux_i[10] = wbs10_dat_o;
1089 362 julius
   assign wbs_ack_o_mux_i[10] = wbs10_ack_o & wb_slave_sel_r[10];
1090
   assign wbs_err_o_mux_i[10] = wbs10_err_o & wb_slave_sel_r[10];
1091
   assign wbs_rty_o_mux_i[10] = wbs10_rty_o & wb_slave_sel_r[10];
1092 361 julius
 
1093
 
1094
   // Slave 11 inputs
1095
   assign wbs11_adr_i = wbm_adr_o;
1096
   assign wbs11_dat_i = wbm_dat_o;
1097
   assign wbs11_sel_i = wbm_sel_o;
1098 362 julius
   assign wbs11_cyc_i = wbm_cyc_o & wb_slave_sel_r[11];
1099
   assign wbs11_stb_i = wbm_stb_o & wb_slave_sel_r[11];
1100 361 julius
   assign wbs11_we_i =  wbm_we_o;
1101
   assign wbs11_cti_i = wbm_cti_o;
1102
   assign wbs11_bte_i = wbm_bte_o;
1103
   assign wbs_dat_o_mux_i[11] = wbs11_dat_o;
1104 362 julius
   assign wbs_ack_o_mux_i[11] = wbs11_ack_o & wb_slave_sel_r[11];
1105
   assign wbs_err_o_mux_i[11] = wbs11_err_o & wb_slave_sel_r[11];
1106
   assign wbs_rty_o_mux_i[11] = wbs11_rty_o & wb_slave_sel_r[11];
1107 361 julius
 
1108
 
1109
   // Slave 12 inputs
1110
   assign wbs12_adr_i = wbm_adr_o;
1111
   assign wbs12_dat_i = wbm_dat_o;
1112
   assign wbs12_sel_i = wbm_sel_o;
1113 362 julius
   assign wbs12_cyc_i = wbm_cyc_o & wb_slave_sel_r[12];
1114
   assign wbs12_stb_i = wbm_stb_o & wb_slave_sel_r[12];
1115 361 julius
   assign wbs12_we_i =  wbm_we_o;
1116
   assign wbs12_cti_i = wbm_cti_o;
1117
   assign wbs12_bte_i = wbm_bte_o;
1118
   assign wbs_dat_o_mux_i[12] = wbs12_dat_o;
1119 362 julius
   assign wbs_ack_o_mux_i[12] = wbs12_ack_o & wb_slave_sel_r[12];
1120
   assign wbs_err_o_mux_i[12] = wbs12_err_o & wb_slave_sel_r[12];
1121
   assign wbs_rty_o_mux_i[12] = wbs12_rty_o & wb_slave_sel_r[12];
1122 361 julius
 
1123
 
1124
   // Slave 13 inputs
1125
   assign wbs13_adr_i = wbm_adr_o;
1126
   assign wbs13_dat_i = wbm_dat_o;
1127
   assign wbs13_sel_i = wbm_sel_o;
1128 362 julius
   assign wbs13_cyc_i = wbm_cyc_o & wb_slave_sel_r[13];
1129
   assign wbs13_stb_i = wbm_stb_o & wb_slave_sel_r[13];
1130 361 julius
   assign wbs13_we_i =  wbm_we_o;
1131
   assign wbs13_cti_i = wbm_cti_o;
1132
   assign wbs13_bte_i = wbm_bte_o;
1133
   assign wbs_dat_o_mux_i[13] = wbs13_dat_o;
1134 362 julius
   assign wbs_ack_o_mux_i[13] = wbs13_ack_o & wb_slave_sel_r[13];
1135
   assign wbs_err_o_mux_i[13] = wbs13_err_o & wb_slave_sel_r[13];
1136
   assign wbs_rty_o_mux_i[13] = wbs13_rty_o & wb_slave_sel_r[13];
1137 361 julius
 
1138
 
1139
   // Slave 14 inputs
1140
   assign wbs14_adr_i = wbm_adr_o;
1141
   assign wbs14_dat_i = wbm_dat_o;
1142
   assign wbs14_sel_i = wbm_sel_o;
1143 362 julius
   assign wbs14_cyc_i = wbm_cyc_o & wb_slave_sel_r[14];
1144
   assign wbs14_stb_i = wbm_stb_o & wb_slave_sel_r[14];
1145 361 julius
   assign wbs14_we_i =  wbm_we_o;
1146
   assign wbs14_cti_i = wbm_cti_o;
1147
   assign wbs14_bte_i = wbm_bte_o;
1148
   assign wbs_dat_o_mux_i[14] = wbs14_dat_o;
1149 362 julius
   assign wbs_ack_o_mux_i[14] = wbs14_ack_o & wb_slave_sel_r[14];
1150
   assign wbs_err_o_mux_i[14] = wbs14_err_o & wb_slave_sel_r[14];
1151
   assign wbs_rty_o_mux_i[14] = wbs14_rty_o & wb_slave_sel_r[14];
1152 361 julius
 
1153
 
1154
   // Slave 15 inputs
1155
   assign wbs15_adr_i = wbm_adr_o;
1156
   assign wbs15_dat_i = wbm_dat_o;
1157
   assign wbs15_sel_i = wbm_sel_o;
1158 362 julius
   assign wbs15_cyc_i = wbm_cyc_o & wb_slave_sel_r[15];
1159
   assign wbs15_stb_i = wbm_stb_o & wb_slave_sel_r[15];
1160 361 julius
   assign wbs15_we_i =  wbm_we_o;
1161
   assign wbs15_cti_i = wbm_cti_o;
1162
   assign wbs15_bte_i = wbm_bte_o;
1163
   assign wbs_dat_o_mux_i[15] = wbs15_dat_o;
1164 362 julius
   assign wbs_ack_o_mux_i[15] = wbs15_ack_o & wb_slave_sel_r[15];
1165
   assign wbs_err_o_mux_i[15] = wbs15_err_o & wb_slave_sel_r[15];
1166
   assign wbs_rty_o_mux_i[15] = wbs15_rty_o & wb_slave_sel_r[15];
1167 361 julius
 
1168
 
1169
   // Slave 16 inputs
1170
   assign wbs16_adr_i = wbm_adr_o;
1171
   assign wbs16_dat_i = wbm_dat_o;
1172
   assign wbs16_sel_i = wbm_sel_o;
1173 362 julius
   assign wbs16_cyc_i = wbm_cyc_o & wb_slave_sel_r[16];
1174
   assign wbs16_stb_i = wbm_stb_o & wb_slave_sel_r[16];
1175 361 julius
   assign wbs16_we_i =  wbm_we_o;
1176
   assign wbs16_cti_i = wbm_cti_o;
1177
   assign wbs16_bte_i = wbm_bte_o;
1178
   assign wbs_dat_o_mux_i[16] = wbs16_dat_o;
1179 362 julius
   assign wbs_ack_o_mux_i[16] = wbs16_ack_o & wb_slave_sel_r[16];
1180
   assign wbs_err_o_mux_i[16] = wbs16_err_o & wb_slave_sel_r[16];
1181
   assign wbs_rty_o_mux_i[16] = wbs16_rty_o & wb_slave_sel_r[16];
1182 361 julius
 
1183
*/
1184
 
1185
 
1186
 
1187
   // Master out mux from slave in data
1188 362 julius
   assign wbm_dat_i = wb_slave_sel_r[0] ? wbs_dat_o_mux_i[0] :
1189
                      wb_slave_sel_r[1] ? wbs_dat_o_mux_i[1] :
1190
/*                    wb_slave_sel_r[2] ? wbs_dat_o_mux_i[2] :
1191
                      wb_slave_sel_r[3] ? wbs_dat_o_mux_i[3] :
1192
                      wb_slave_sel_r[4] ? wbs_dat_o_mux_i[4] :
1193
                      wb_slave_sel_r[5] ? wbs_dat_o_mux_i[5] :
1194
                      wb_slave_sel_r[6] ? wbs_dat_o_mux_i[6] :
1195
                      wb_slave_sel_r[7] ? wbs_dat_o_mux_i[7] :
1196
                      wb_slave_sel_r[8] ? wbs_dat_o_mux_i[8] :
1197
                      wb_slave_sel_r[9] ? wbs_dat_o_mux_i[9] :
1198
                      wb_slave_sel_r[10] ? wbs_dat_o_mux_i[10] :
1199
                      wb_slave_sel_r[11] ? wbs_dat_o_mux_i[11] :
1200
                      wb_slave_sel_r[12] ? wbs_dat_o_mux_i[12] :
1201
                      wb_slave_sel_r[13] ? wbs_dat_o_mux_i[13] :
1202
                      wb_slave_sel_r[14] ? wbs_dat_o_mux_i[14] :
1203
                      wb_slave_sel_r[15] ? wbs_dat_o_mux_i[15] :
1204
                      wb_slave_sel_r[16] ? wbs_dat_o_mux_i[16] :
1205 361 julius
*/
1206
                      wbs_dat_o_mux_i[0];
1207
   // Master out acks, or together
1208
   assign wbm_ack_i = wbs_ack_o_mux_i[0] |
1209
                      wbs_ack_o_mux_i[1] /*|
1210
                      wbs_ack_o_mux_i[2] |
1211
                      wbs_ack_o_mux_i[3] |
1212
                      wbs_ack_o_mux_i[4] |
1213
                      wbs_ack_o_mux_i[5] |
1214
                      wbs_ack_o_mux_i[6] |
1215
                      wbs_ack_o_mux_i[7] |
1216
                      wbs_ack_o_mux_i[8] |
1217
                      wbs_ack_o_mux_i[9] |
1218
                      wbs_ack_o_mux_i[10] |
1219
                      wbs_ack_o_mux_i[11] |
1220
                      wbs_ack_o_mux_i[12] |
1221
                      wbs_ack_o_mux_i[13] |
1222
                      wbs_ack_o_mux_i[14] |
1223
                      wbs_ack_o_mux_i[15] |
1224
                      wbs_ack_o_mux_i[16] */
1225
                      ;
1226
 
1227
 
1228
   assign wbm_err_i = wbs_err_o_mux_i[0] |
1229
                      wbs_err_o_mux_i[1] |/*
1230
                      wbs_err_o_mux_i[2] |
1231
                      wbs_err_o_mux_i[3] |
1232
                      wbs_err_o_mux_i[4] |
1233
                      wbs_err_o_mux_i[5] |
1234
                      wbs_err_o_mux_i[6] |
1235
                      wbs_err_o_mux_i[7] |
1236
                      wbs_err_o_mux_i[8] |
1237
                      wbs_err_o_mux_i[9] |
1238
                      wbs_err_o_mux_i[10] |
1239
                      wbs_err_o_mux_i[11] |
1240
                      wbs_err_o_mux_i[12] |
1241
                      wbs_err_o_mux_i[13] |
1242
                      wbs_err_o_mux_i[14] |
1243
                      wbs_err_o_mux_i[15] |
1244
                      wbs_err_o_mux_i[16] |*/
1245
                      watchdog_err  ;
1246
 
1247
 
1248
   assign wbm_rty_i = wbs_rty_o_mux_i[0] |
1249
                      wbs_rty_o_mux_i[1]/*|
1250
                      wbs_rty_o_mux_i[2] |
1251
                      wbs_rty_o_mux_i[3] |
1252
                      wbs_rty_o_mux_i[4] |
1253
                      wbs_rty_o_mux_i[5] |
1254
                      wbs_rty_o_mux_i[6] |
1255
                      wbs_rty_o_mux_i[7] |
1256
                      wbs_rty_o_mux_i[8] |
1257
                      wbs_rty_o_mux_i[9] |
1258
                      wbs_rty_o_mux_i[10] |
1259
                      wbs_rty_o_mux_i[11] |
1260
                      wbs_rty_o_mux_i[12] |
1261
                      wbs_rty_o_mux_i[13] |
1262
                      wbs_rty_o_mux_i[14] |
1263
                      wbs_rty_o_mux_i[15] |
1264
                      wbs_rty_o_mux_i[16]*/;
1265
 
1266
endmodule // arbiter_dbus
1267
 

powered by: WebSVN 2.1.0

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