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

Subversion Repositories wdsp

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 parrado
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  General Round Robin Arbiter                                ////
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_arb.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:40  rudi
52
//               WISHBONE CONMAX IP Core
53
//
54
//
55
//
56
//
57
//
58
//
59
//                        
60
 
61
`include "wb_conmax_defines.v"
62
 
63
module wb_conmax_arb(clk, rst, req, gnt, next);
64
 
65
input           clk;
66
input           rst;
67
input   [7:0]    req;            // Req input
68
output  [2:0]    gnt;            // Grant output
69
input           next;           // Next Target
70
 
71
///////////////////////////////////////////////////////////////////////
72
//
73
// Parameters
74
//
75
 
76
parameter       [2:0]
77
                grant0 = 3'h0,
78
                grant1 = 3'h1,
79
                grant2 = 3'h2,
80
                grant3 = 3'h3,
81
                grant4 = 3'h4,
82
                grant5 = 3'h5,
83
                grant6 = 3'h6,
84
                grant7 = 3'h7;
85
 
86
///////////////////////////////////////////////////////////////////////
87
//
88
// Local Registers and Wires
89
//
90
 
91
reg [2:0]        state, next_state;
92
 
93
///////////////////////////////////////////////////////////////////////
94
//
95
//  Misc Logic 
96
//
97
 
98
assign  gnt = state;
99
 
100
always@(posedge clk or posedge rst)
101
        if(rst)         state <= #1 grant0;
102
        else            state <= #1 next_state;
103
 
104
///////////////////////////////////////////////////////////////////////
105
//
106
// Next State Logic
107
//   - implements round robin arbitration algorithm
108
//   - switches grant if current req is dropped or next is asserted
109
//   - parks at last grant
110
//
111
 
112
always@(state or req or next)
113
   begin
114
        next_state = state;     // Default Keep State
115
        case(state)             // synopsys parallel_case full_case
116
           grant0:
117
                // if this req is dropped or next is asserted, check for other req's
118
                if(!req[0] | next)
119
                   begin
120
                        if(req[1])      next_state = grant1;
121
                        else
122
                        if(req[2])      next_state = grant2;
123
                        else
124
                        if(req[3])      next_state = grant3;
125
                        else
126
                        if(req[4])      next_state = grant4;
127
                        else
128
                        if(req[5])      next_state = grant5;
129
                        else
130
                        if(req[6])      next_state = grant6;
131
                        else
132
                        if(req[7])      next_state = grant7;
133
                   end
134
           grant1:
135
                // if this req is dropped or next is asserted, check for other req's
136
                if(!req[1] | next)
137
                   begin
138
                        if(req[2])      next_state = grant2;
139
                        else
140
                        if(req[3])      next_state = grant3;
141
                        else
142
                        if(req[4])      next_state = grant4;
143
                        else
144
                        if(req[5])      next_state = grant5;
145
                        else
146
                        if(req[6])      next_state = grant6;
147
                        else
148
                        if(req[7])      next_state = grant7;
149
                        else
150
                        if(req[0])       next_state = grant0;
151
                   end
152
           grant2:
153
                // if this req is dropped or next is asserted, check for other req's
154
                if(!req[2] | next)
155
                   begin
156
                        if(req[3])      next_state = grant3;
157
                        else
158
                        if(req[4])      next_state = grant4;
159
                        else
160
                        if(req[5])      next_state = grant5;
161
                        else
162
                        if(req[6])      next_state = grant6;
163
                        else
164
                        if(req[7])      next_state = grant7;
165
                        else
166
                        if(req[0])       next_state = grant0;
167
                        else
168
                        if(req[1])      next_state = grant1;
169
                   end
170
           grant3:
171
                // if this req is dropped or next is asserted, check for other req's
172
                if(!req[3] | next)
173
                   begin
174
                        if(req[4])      next_state = grant4;
175
                        else
176
                        if(req[5])      next_state = grant5;
177
                        else
178
                        if(req[6])      next_state = grant6;
179
                        else
180
                        if(req[7])      next_state = grant7;
181
                        else
182
                        if(req[0])       next_state = grant0;
183
                        else
184
                        if(req[1])      next_state = grant1;
185
                        else
186
                        if(req[2])      next_state = grant2;
187
                   end
188
           grant4:
189
                // if this req is dropped or next is asserted, check for other req's
190
                if(!req[4] | next)
191
                   begin
192
                        if(req[5])      next_state = grant5;
193
                        else
194
                        if(req[6])      next_state = grant6;
195
                        else
196
                        if(req[7])      next_state = grant7;
197
                        else
198
                        if(req[0])       next_state = grant0;
199
                        else
200
                        if(req[1])      next_state = grant1;
201
                        else
202
                        if(req[2])      next_state = grant2;
203
                        else
204
                        if(req[3])      next_state = grant3;
205
                   end
206
           grant5:
207
                // if this req is dropped or next is asserted, check for other req's
208
                if(!req[5] | next)
209
                   begin
210
                        if(req[6])      next_state = grant6;
211
                        else
212
                        if(req[7])      next_state = grant7;
213
                        else
214
                        if(req[0])       next_state = grant0;
215
                        else
216
                        if(req[1])      next_state = grant1;
217
                        else
218
                        if(req[2])      next_state = grant2;
219
                        else
220
                        if(req[3])      next_state = grant3;
221
                        else
222
                        if(req[4])      next_state = grant4;
223
                   end
224
           grant6:
225
                // if this req is dropped or next is asserted, check for other req's
226
                if(!req[6] | next)
227
                   begin
228
                        if(req[7])      next_state = grant7;
229
                        else
230
                        if(req[0])       next_state = grant0;
231
                        else
232
                        if(req[1])      next_state = grant1;
233
                        else
234
                        if(req[2])      next_state = grant2;
235
                        else
236
                        if(req[3])      next_state = grant3;
237
                        else
238
                        if(req[4])      next_state = grant4;
239
                        else
240
                        if(req[5])      next_state = grant5;
241
                   end
242
           grant7:
243
                // if this req is dropped or next is asserted, check for other req's
244
                if(!req[7] | next)
245
                   begin
246
                        if(req[0])       next_state = grant0;
247
                        else
248
                        if(req[1])      next_state = grant1;
249
                        else
250
                        if(req[2])      next_state = grant2;
251
                        else
252
                        if(req[3])      next_state = grant3;
253
                        else
254
                        if(req[4])      next_state = grant4;
255
                        else
256
                        if(req[5])      next_state = grant5;
257
                        else
258
                        if(req[6])      next_state = grant6;
259
                   end
260
        endcase
261
   end
262
 
263
endmodule
264
 

powered by: WebSVN 2.1.0

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