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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [verilog/] [minsoc/] [wb_conmax/] [tags/] [start/] [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) 2001 Rudolf Usselmann                         ////
15
////                    rudi@asics.ws                            ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
//  CVS Log
39
//
40
//  $Id: wb_conmax_arb.v,v 1.1.1.1 2001-10-19 11:01:40 rudi Exp $
41
//
42
//  $Date: 2001-10-19 11:01:40 $
43
//  $Revision: 1.1.1.1 $
44
//  $Author: rudi $
45
//  $Locker:  $
46
//  $State: Exp $
47
//
48
// Change History:
49
//               $Log: not supported by cvs2svn $
50
//
51
//
52
//
53
//
54
//
55
//                        
56
 
57
`include "wb_conmax_defines.v"
58
 
59
module wb_conmax_arb(clk, rst, req, gnt, next);
60
 
61
input           clk;
62
input           rst;
63
input   [7:0]    req;            // Req input
64
output  [2:0]    gnt;            // Grant output
65
input           next;           // Next Target
66
 
67
///////////////////////////////////////////////////////////////////////
68
//
69
// Parameters
70
//
71
 
72
parameter       [2:0]
73
                grant0 = 3'h0,
74
                grant1 = 3'h1,
75
                grant2 = 3'h2,
76
                grant3 = 3'h3,
77
                grant4 = 3'h4,
78
                grant5 = 3'h5,
79
                grant6 = 3'h6,
80
                grant7 = 3'h7;
81
 
82
///////////////////////////////////////////////////////////////////////
83
//
84
// Local Registers and Wires
85
//
86
 
87
reg [2:0]        state, next_state;
88
 
89
///////////////////////////////////////////////////////////////////////
90
//
91
//  Misc Logic 
92
//
93
 
94
assign  gnt = state;
95
 
96
always@(posedge clk or posedge rst)
97
        if(rst)         state <= #1 grant0;
98
        else            state <= #1 next_state;
99
 
100
///////////////////////////////////////////////////////////////////////
101
//
102
// Next State Logic
103
//   - implements round robin arbitration algorithm
104
//   - switches grant if current req is dropped or next is asserted
105
//   - parks at last grant
106
//
107
 
108
always@(state or req or next)
109
   begin
110
        next_state = state;     // Default Keep State
111
        case(state)             // synopsys parallel_case full_case
112
           grant0:
113
                // if this req is dropped or next is asserted, check for other req's
114
                if(!req[0] | next)
115
                   begin
116
                        if(req[1])      next_state = grant1;
117
                        else
118
                        if(req[2])      next_state = grant2;
119
                        else
120
                        if(req[3])      next_state = grant3;
121
                        else
122
                        if(req[4])      next_state = grant4;
123
                        else
124
                        if(req[5])      next_state = grant5;
125
                        else
126
                        if(req[6])      next_state = grant6;
127
                        else
128
                        if(req[7])      next_state = grant7;
129
                   end
130
           grant1:
131
                // if this req is dropped or next is asserted, check for other req's
132
                if(!req[1] | next)
133
                   begin
134
                        if(req[2])      next_state = grant2;
135
                        else
136
                        if(req[3])      next_state = grant3;
137
                        else
138
                        if(req[4])      next_state = grant4;
139
                        else
140
                        if(req[5])      next_state = grant5;
141
                        else
142
                        if(req[6])      next_state = grant6;
143
                        else
144
                        if(req[7])      next_state = grant7;
145
                        else
146
                        if(req[0])       next_state = grant0;
147
                   end
148
           grant2:
149
                // if this req is dropped or next is asserted, check for other req's
150
                if(!req[2] | next)
151
                   begin
152
                        if(req[3])      next_state = grant3;
153
                        else
154
                        if(req[4])      next_state = grant4;
155
                        else
156
                        if(req[5])      next_state = grant5;
157
                        else
158
                        if(req[6])      next_state = grant6;
159
                        else
160
                        if(req[7])      next_state = grant7;
161
                        else
162
                        if(req[0])       next_state = grant0;
163
                        else
164
                        if(req[1])      next_state = grant1;
165
                   end
166
           grant3:
167
                // if this req is dropped or next is asserted, check for other req's
168
                if(!req[3] | next)
169
                   begin
170
                        if(req[4])      next_state = grant4;
171
                        else
172
                        if(req[5])      next_state = grant5;
173
                        else
174
                        if(req[6])      next_state = grant6;
175
                        else
176
                        if(req[7])      next_state = grant7;
177
                        else
178
                        if(req[0])       next_state = grant0;
179
                        else
180
                        if(req[1])      next_state = grant1;
181
                        else
182
                        if(req[2])      next_state = grant2;
183
                   end
184
           grant4:
185
                // if this req is dropped or next is asserted, check for other req's
186
                if(!req[4] | next)
187
                   begin
188
                        if(req[5])      next_state = grant5;
189
                        else
190
                        if(req[6])      next_state = grant6;
191
                        else
192
                        if(req[7])      next_state = grant7;
193
                        else
194
                        if(req[0])       next_state = grant0;
195
                        else
196
                        if(req[1])      next_state = grant1;
197
                        else
198
                        if(req[2])      next_state = grant2;
199
                        else
200
                        if(req[3])      next_state = grant3;
201
                   end
202
           grant5:
203
                // if this req is dropped or next is asserted, check for other req's
204
                if(!req[5] | next)
205
                   begin
206
                        if(req[6])      next_state = grant6;
207
                        else
208
                        if(req[7])      next_state = grant7;
209
                        else
210
                        if(req[0])       next_state = grant0;
211
                        else
212
                        if(req[1])      next_state = grant1;
213
                        else
214
                        if(req[2])      next_state = grant2;
215
                        else
216
                        if(req[3])      next_state = grant3;
217
                        else
218
                        if(req[4])      next_state = grant4;
219
                   end
220
           grant6:
221
                // if this req is dropped or next is asserted, check for other req's
222
                if(!req[6] | next)
223
                   begin
224
                        if(req[7])      next_state = grant7;
225
                        else
226
                        if(req[0])       next_state = grant0;
227
                        else
228
                        if(req[1])      next_state = grant1;
229
                        else
230
                        if(req[2])      next_state = grant2;
231
                        else
232
                        if(req[3])      next_state = grant3;
233
                        else
234
                        if(req[4])      next_state = grant4;
235
                        else
236
                        if(req[5])      next_state = grant5;
237
                   end
238
           grant7:
239
                // if this req is dropped or next is asserted, check for other req's
240
                if(!req[7] | next)
241
                   begin
242
                        if(req[0])       next_state = grant0;
243
                        else
244
                        if(req[1])      next_state = grant1;
245
                        else
246
                        if(req[2])      next_state = grant2;
247
                        else
248
                        if(req[3])      next_state = grant3;
249
                        else
250
                        if(req[4])      next_state = grant4;
251
                        else
252
                        if(req[5])      next_state = grant5;
253
                        else
254
                        if(req[6])      next_state = grant6;
255
                   end
256
        endcase
257
   end
258
 
259
endmodule
260
 

powered by: WebSVN 2.1.0

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