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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [verilog/] [minsoc/] [wb_conmax/] [trunk/] [rtl/] [verilog/] [wb_conmax_slave_if.v] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 parrado
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE Connection Matrix Slave Interface                 ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Rudolf Usselmann                                   ////
7
////          rudi@asics.ws                                      ////
8
////                                                             ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/cores/wb_conmax/ ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
15
////                         www.asics.ws                        ////
16
////                         rudi@asics.ws                       ////
17
////                                                             ////
18
//// This source file may be used and distributed without        ////
19
//// restriction provided that this copyright statement is not   ////
20
//// removed from the file and that any derivative work contains ////
21
//// the original copyright notice and the associated disclaimer.////
22
////                                                             ////
23
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
24
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
25
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
26
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
27
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
28
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
29
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
30
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
31
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
32
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
33
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
34
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
35
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
36
////                                                             ////
37
/////////////////////////////////////////////////////////////////////
38
 
39
//  CVS Log
40
//
41
//  $Id: wb_conmax_slave_if.v,v 1.2 2002-10-03 05:40:07 rudi Exp $
42
//
43
//  $Date: 2002-10-03 05:40:07 $
44
//  $Revision: 1.2 $
45
//  $Author: rudi $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: not supported by cvs2svn $
51
//               Revision 1.1.1.1  2001/10/19 11:01:39  rudi
52
//               WISHBONE CONMAX IP Core
53
//
54
//
55
//
56
//
57
//
58
 
59
`include "wb_conmax_defines.v"
60
 
61
module wb_conmax_slave_if(
62
 
63
        clk_i, rst_i, conf,
64
 
65
        // Slave interface
66
        wb_data_i, wb_data_o, wb_addr_o, wb_sel_o, wb_we_o, wb_cyc_o,
67
        wb_stb_o, wb_ack_i, wb_err_i, wb_rty_i,
68
 
69
        // Master 0 Interface
70
        m0_data_i, m0_data_o, m0_addr_i, m0_sel_i, m0_we_i, m0_cyc_i,
71
        m0_stb_i, m0_ack_o, m0_err_o, m0_rty_o,
72
 
73
        // Master 1 Interface
74
        m1_data_i, m1_data_o, m1_addr_i, m1_sel_i, m1_we_i, m1_cyc_i,
75
        m1_stb_i, m1_ack_o, m1_err_o, m1_rty_o,
76
 
77
        // Master 2 Interface
78
        m2_data_i, m2_data_o, m2_addr_i, m2_sel_i, m2_we_i, m2_cyc_i,
79
        m2_stb_i, m2_ack_o, m2_err_o, m2_rty_o,
80
 
81
        // Master 3 Interface
82
        m3_data_i, m3_data_o, m3_addr_i, m3_sel_i, m3_we_i, m3_cyc_i,
83
        m3_stb_i, m3_ack_o, m3_err_o, m3_rty_o,
84
 
85
        // Master 4 Interface
86
        m4_data_i, m4_data_o, m4_addr_i, m4_sel_i, m4_we_i, m4_cyc_i,
87
        m4_stb_i, m4_ack_o, m4_err_o, m4_rty_o,
88
 
89
        // Master 5 Interface
90
        m5_data_i, m5_data_o, m5_addr_i, m5_sel_i, m5_we_i, m5_cyc_i,
91
        m5_stb_i, m5_ack_o, m5_err_o, m5_rty_o,
92
 
93
        // Master 6 Interface
94
        m6_data_i, m6_data_o, m6_addr_i, m6_sel_i, m6_we_i, m6_cyc_i,
95
        m6_stb_i, m6_ack_o, m6_err_o, m6_rty_o,
96
 
97
        // Master 7 Interface
98
        m7_data_i, m7_data_o, m7_addr_i, m7_sel_i, m7_we_i, m7_cyc_i,
99
        m7_stb_i, m7_ack_o, m7_err_o, m7_rty_o
100
        );
101
 
102
////////////////////////////////////////////////////////////////////
103
//
104
// Module Parameters
105
//
106
 
107
parameter [1:0]          pri_sel = 2'd2;
108
parameter               aw      = 32;           // Address bus Width
109
parameter               dw      = 32;           // Data bus Width
110
parameter               sw      = dw / 8;       // Number of Select Lines
111
 
112
////////////////////////////////////////////////////////////////////
113
//
114
// Module IOs
115
//
116
 
117
input                   clk_i, rst_i;
118
input   [15:0]           conf;
119
 
120
// Slave Interface
121
input   [dw-1:0] wb_data_i;
122
output  [dw-1:0] wb_data_o;
123
output  [aw-1:0] wb_addr_o;
124
output  [sw-1:0] wb_sel_o;
125
output                  wb_we_o;
126
output                  wb_cyc_o;
127
output                  wb_stb_o;
128
input                   wb_ack_i;
129
input                   wb_err_i;
130
input                   wb_rty_i;
131
 
132
// Master 0 Interface
133
input   [dw-1:0] m0_data_i;
134
output  [dw-1:0] m0_data_o;
135
input   [aw-1:0] m0_addr_i;
136
input   [sw-1:0] m0_sel_i;
137
input                   m0_we_i;
138
input                   m0_cyc_i;
139
input                   m0_stb_i;
140
output                  m0_ack_o;
141
output                  m0_err_o;
142
output                  m0_rty_o;
143
 
144
// Master 1 Interface
145
input   [dw-1:0] m1_data_i;
146
output  [dw-1:0] m1_data_o;
147
input   [aw-1:0] m1_addr_i;
148
input   [sw-1:0] m1_sel_i;
149
input                   m1_we_i;
150
input                   m1_cyc_i;
151
input                   m1_stb_i;
152
output                  m1_ack_o;
153
output                  m1_err_o;
154
output                  m1_rty_o;
155
 
156
// Master 2 Interface
157
input   [dw-1:0] m2_data_i;
158
output  [dw-1:0] m2_data_o;
159
input   [aw-1:0] m2_addr_i;
160
input   [sw-1:0] m2_sel_i;
161
input                   m2_we_i;
162
input                   m2_cyc_i;
163
input                   m2_stb_i;
164
output                  m2_ack_o;
165
output                  m2_err_o;
166
output                  m2_rty_o;
167
 
168
// Master 3 Interface
169
input   [dw-1:0] m3_data_i;
170
output  [dw-1:0] m3_data_o;
171
input   [aw-1:0] m3_addr_i;
172
input   [sw-1:0] m3_sel_i;
173
input                   m3_we_i;
174
input                   m3_cyc_i;
175
input                   m3_stb_i;
176
output                  m3_ack_o;
177
output                  m3_err_o;
178
output                  m3_rty_o;
179
 
180
// Master 4 Interface
181
input   [dw-1:0] m4_data_i;
182
output  [dw-1:0] m4_data_o;
183
input   [aw-1:0] m4_addr_i;
184
input   [sw-1:0] m4_sel_i;
185
input                   m4_we_i;
186
input                   m4_cyc_i;
187
input                   m4_stb_i;
188
output                  m4_ack_o;
189
output                  m4_err_o;
190
output                  m4_rty_o;
191
 
192
// Master 5 Interface
193
input   [dw-1:0] m5_data_i;
194
output  [dw-1:0] m5_data_o;
195
input   [aw-1:0] m5_addr_i;
196
input   [sw-1:0] m5_sel_i;
197
input                   m5_we_i;
198
input                   m5_cyc_i;
199
input                   m5_stb_i;
200
output                  m5_ack_o;
201
output                  m5_err_o;
202
output                  m5_rty_o;
203
 
204
// Master 6 Interface
205
input   [dw-1:0] m6_data_i;
206
output  [dw-1:0] m6_data_o;
207
input   [aw-1:0] m6_addr_i;
208
input   [sw-1:0] m6_sel_i;
209
input                   m6_we_i;
210
input                   m6_cyc_i;
211
input                   m6_stb_i;
212
output                  m6_ack_o;
213
output                  m6_err_o;
214
output                  m6_rty_o;
215
 
216
// Master 7 Interface
217
input   [dw-1:0] m7_data_i;
218
output  [dw-1:0] m7_data_o;
219
input   [aw-1:0] m7_addr_i;
220
input   [sw-1:0] m7_sel_i;
221
input                   m7_we_i;
222
input                   m7_cyc_i;
223
input                   m7_stb_i;
224
output                  m7_ack_o;
225
output                  m7_err_o;
226
output                  m7_rty_o;
227
 
228
////////////////////////////////////////////////////////////////////
229
//
230
// Local Wires
231
//
232
 
233
reg     [aw-1:0] wb_addr_o;
234
reg     [dw-1:0] wb_data_o;
235
reg     [sw-1:0] wb_sel_o;
236
reg                     wb_we_o;
237
reg                     wb_cyc_o;
238
reg                     wb_stb_o;
239
wire    [2:0]            mast_sel_simple;
240
wire    [2:0]            mast_sel_pe;
241
wire    [2:0]            mast_sel;
242
 
243
reg                     next;
244
reg                     m0_cyc_r, m1_cyc_r, m2_cyc_r, m3_cyc_r;
245
reg                     m4_cyc_r, m5_cyc_r, m6_cyc_r, m7_cyc_r;
246
 
247
////////////////////////////////////////////////////////////////////
248
//
249
// Select logic
250
//
251
 
252
always @(posedge clk_i)
253
        next <= #1 ~wb_cyc_o;
254
 
255
 
256
wb_conmax_arb arb(
257
        .clk(           clk_i           ),
258
        .rst(           rst_i           ),
259
        .req(   {       m7_cyc_i,
260
                        m6_cyc_i,
261
                        m5_cyc_i,
262
                        m4_cyc_i,
263
                        m3_cyc_i,
264
                        m2_cyc_i,
265
                        m1_cyc_i,
266
                        m0_cyc_i }      ),
267
        .gnt(           mast_sel_simple ),
268
        .next(          1'b0            )
269
        );
270
 
271
wb_conmax_msel #(pri_sel) msel(
272
        .clk_i(         clk_i           ),
273
        .rst_i(         rst_i           ),
274
        .conf(          conf            ),
275
        .req(   {       m7_cyc_i,
276
                        m6_cyc_i,
277
                        m5_cyc_i,
278
                        m4_cyc_i,
279
                        m3_cyc_i,
280
                        m2_cyc_i,
281
                        m1_cyc_i,
282
                        m0_cyc_i}       ),
283
        .sel(           mast_sel_pe     ),
284
        .next(          next            )
285
        );
286
 
287
assign mast_sel = (pri_sel == 2'd0) ? mast_sel_simple : mast_sel_pe;
288
 
289
////////////////////////////////////////////////////////////////////
290
//
291
// Address & Data Pass
292
//
293
 
294
always @(mast_sel or m0_addr_i or m1_addr_i or m2_addr_i or m3_addr_i
295
        or m4_addr_i or m5_addr_i or m6_addr_i or m7_addr_i)
296
        case(mast_sel)  // synopsys parallel_case
297
           3'd0: wb_addr_o = m0_addr_i;
298
           3'd1: wb_addr_o = m1_addr_i;
299
           3'd2: wb_addr_o = m2_addr_i;
300
           3'd3: wb_addr_o = m3_addr_i;
301
           3'd4: wb_addr_o = m4_addr_i;
302
           3'd5: wb_addr_o = m5_addr_i;
303
           3'd6: wb_addr_o = m6_addr_i;
304
           3'd7: wb_addr_o = m7_addr_i;
305
           default: wb_addr_o = {aw{1'bx}};
306
        endcase
307
 
308
always @(mast_sel or m0_sel_i or m1_sel_i or m2_sel_i or m3_sel_i
309
        or m4_sel_i or m5_sel_i or m6_sel_i or m7_sel_i)
310
        case(mast_sel)  // synopsys parallel_case
311
           3'd0: wb_sel_o = m0_sel_i;
312
           3'd1: wb_sel_o = m1_sel_i;
313
           3'd2: wb_sel_o = m2_sel_i;
314
           3'd3: wb_sel_o = m3_sel_i;
315
           3'd4: wb_sel_o = m4_sel_i;
316
           3'd5: wb_sel_o = m5_sel_i;
317
           3'd6: wb_sel_o = m6_sel_i;
318
           3'd7: wb_sel_o = m7_sel_i;
319
           default: wb_sel_o = {sw{1'bx}};
320
        endcase
321
 
322
always @(mast_sel or m0_data_i or m1_data_i or m2_data_i or m3_data_i
323
        or m4_data_i or m5_data_i or m6_data_i or m7_data_i)
324
        case(mast_sel)  // synopsys parallel_case
325
           3'd0: wb_data_o = m0_data_i;
326
           3'd1: wb_data_o = m1_data_i;
327
           3'd2: wb_data_o = m2_data_i;
328
           3'd3: wb_data_o = m3_data_i;
329
           3'd4: wb_data_o = m4_data_i;
330
           3'd5: wb_data_o = m5_data_i;
331
           3'd6: wb_data_o = m6_data_i;
332
           3'd7: wb_data_o = m7_data_i;
333
           default: wb_data_o = {dw{1'bx}};
334
        endcase
335
 
336
assign m0_data_o = wb_data_i;
337
assign m1_data_o = wb_data_i;
338
assign m2_data_o = wb_data_i;
339
assign m3_data_o = wb_data_i;
340
assign m4_data_o = wb_data_i;
341
assign m5_data_o = wb_data_i;
342
assign m6_data_o = wb_data_i;
343
assign m7_data_o = wb_data_i;
344
 
345
////////////////////////////////////////////////////////////////////
346
//
347
// Control Signal Pass
348
//
349
 
350
always @(mast_sel or m0_we_i or m1_we_i or m2_we_i or m3_we_i
351
        or m4_we_i or m5_we_i or m6_we_i or m7_we_i)
352
        case(mast_sel)  // synopsys parallel_case
353
           3'd0: wb_we_o = m0_we_i;
354
           3'd1: wb_we_o = m1_we_i;
355
           3'd2: wb_we_o = m2_we_i;
356
           3'd3: wb_we_o = m3_we_i;
357
           3'd4: wb_we_o = m4_we_i;
358
           3'd5: wb_we_o = m5_we_i;
359
           3'd6: wb_we_o = m6_we_i;
360
           3'd7: wb_we_o = m7_we_i;
361
           default: wb_we_o = 1'bx;
362
        endcase
363
 
364
always @(posedge clk_i)
365
        m0_cyc_r <= #1 m0_cyc_i;
366
 
367
always @(posedge clk_i)
368
        m1_cyc_r <= #1 m1_cyc_i;
369
 
370
always @(posedge clk_i)
371
        m2_cyc_r <= #1 m2_cyc_i;
372
 
373
always @(posedge clk_i)
374
        m3_cyc_r <= #1 m3_cyc_i;
375
 
376
always @(posedge clk_i)
377
        m4_cyc_r <= #1 m4_cyc_i;
378
 
379
always @(posedge clk_i)
380
        m5_cyc_r <= #1 m5_cyc_i;
381
 
382
always @(posedge clk_i)
383
        m6_cyc_r <= #1 m6_cyc_i;
384
 
385
always @(posedge clk_i)
386
        m7_cyc_r <= #1 m7_cyc_i;
387
 
388
always @(mast_sel or m0_cyc_i or m1_cyc_i or m2_cyc_i or m3_cyc_i
389
        or m4_cyc_i or m5_cyc_i or m6_cyc_i or m7_cyc_i
390
        or m0_cyc_r or m1_cyc_r or m2_cyc_r or m3_cyc_r
391
        or m4_cyc_r or m5_cyc_r or m6_cyc_r or m7_cyc_r)
392
        case(mast_sel)  // synopsys parallel_case
393
           3'd0: wb_cyc_o = m0_cyc_i & m0_cyc_r;
394
           3'd1: wb_cyc_o = m1_cyc_i & m1_cyc_r;
395
           3'd2: wb_cyc_o = m2_cyc_i & m2_cyc_r;
396
           3'd3: wb_cyc_o = m3_cyc_i & m3_cyc_r;
397
           3'd4: wb_cyc_o = m4_cyc_i & m4_cyc_r;
398
           3'd5: wb_cyc_o = m5_cyc_i & m5_cyc_r;
399
           3'd6: wb_cyc_o = m6_cyc_i & m6_cyc_r;
400
           3'd7: wb_cyc_o = m7_cyc_i & m7_cyc_r;
401
           default: wb_cyc_o = 1'b0;
402
        endcase
403
 
404
always @(mast_sel or m0_stb_i or m1_stb_i or m2_stb_i or m3_stb_i
405
        or m4_stb_i or m5_stb_i or m6_stb_i or m7_stb_i)
406
        case(mast_sel)  // synopsys parallel_case
407
           3'd0: wb_stb_o = m0_stb_i;
408
           3'd1: wb_stb_o = m1_stb_i;
409
           3'd2: wb_stb_o = m2_stb_i;
410
           3'd3: wb_stb_o = m3_stb_i;
411
           3'd4: wb_stb_o = m4_stb_i;
412
           3'd5: wb_stb_o = m5_stb_i;
413
           3'd6: wb_stb_o = m6_stb_i;
414
           3'd7: wb_stb_o = m7_stb_i;
415
           default: wb_stb_o = 1'b0;
416
        endcase
417
 
418
assign m0_ack_o = (mast_sel==3'd0) & wb_ack_i;
419
assign m1_ack_o = (mast_sel==3'd1) & wb_ack_i;
420
assign m2_ack_o = (mast_sel==3'd2) & wb_ack_i;
421
assign m3_ack_o = (mast_sel==3'd3) & wb_ack_i;
422
assign m4_ack_o = (mast_sel==3'd4) & wb_ack_i;
423
assign m5_ack_o = (mast_sel==3'd5) & wb_ack_i;
424
assign m6_ack_o = (mast_sel==3'd6) & wb_ack_i;
425
assign m7_ack_o = (mast_sel==3'd7) & wb_ack_i;
426
 
427
assign m0_err_o = (mast_sel==3'd0) & wb_err_i;
428
assign m1_err_o = (mast_sel==3'd1) & wb_err_i;
429
assign m2_err_o = (mast_sel==3'd2) & wb_err_i;
430
assign m3_err_o = (mast_sel==3'd3) & wb_err_i;
431
assign m4_err_o = (mast_sel==3'd4) & wb_err_i;
432
assign m5_err_o = (mast_sel==3'd5) & wb_err_i;
433
assign m6_err_o = (mast_sel==3'd6) & wb_err_i;
434
assign m7_err_o = (mast_sel==3'd7) & wb_err_i;
435
 
436
assign m0_rty_o = (mast_sel==3'd0) & wb_rty_i;
437
assign m1_rty_o = (mast_sel==3'd1) & wb_rty_i;
438
assign m2_rty_o = (mast_sel==3'd2) & wb_rty_i;
439
assign m3_rty_o = (mast_sel==3'd3) & wb_rty_i;
440
assign m4_rty_o = (mast_sel==3'd4) & wb_rty_i;
441
assign m5_rty_o = (mast_sel==3'd5) & wb_rty_i;
442
assign m6_rty_o = (mast_sel==3'd6) & wb_rty_i;
443
assign m7_rty_o = (mast_sel==3'd7) & wb_rty_i;
444
 
445
endmodule
446
 

powered by: WebSVN 2.1.0

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