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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [core/] [wishbone/] [cross/] [wb_conmax_arb.v] - Blame information for rev 2

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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