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

Subversion Repositories rtf68ksys

[/] [rtf68ksys/] [trunk/] [rtl/] [verilog/] [PSGBusArb.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robfinch
/* ===============================================================
2
        (C) 2007  Robert Finch
3
        All rights reserved.
4
 
5
        PSGBusArb.v
6
 
7
    This source code is available for evaluation and validation purposes
8
    only. This copyright statement and disclaimer must remain present in
9
    the file.
10
 
11
 
12
        NO WARRANTY.
13
    THIS Work, IS PROVIDEDED "AS IS" WITH NO WARRANTIES OF ANY KIND, WHETHER
14
    EXPRESS OR IMPLIED. The user must assume the entire risk of using the
15
    Work.
16
 
17
    IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
18
    INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES WHATSOEVER RELATING TO
19
    THE USE OF THIS WORK, OR YOUR RELATIONSHIP WITH THE AUTHOR.
20
 
21
    IN ADDITION, IN NO EVENT DOES THE AUTHOR AUTHORIZE YOU TO USE THE WORK
22
    IN APPLICATIONS OR SYSTEMS WHERE THE WORK'S FAILURE TO PERFORM CAN
23
    REASONABLY BE EXPECTED TO RESULT IN A SIGNIFICANT PHYSICAL INJURY, OR IN
24
    LOSS OF LIFE. ANY SUCH USE BY YOU IS ENTIRELY AT YOUR OWN RISK, AND YOU
25
    AGREE TO HOLD THE AUTHOR AND CONTRIBUTORS HARMLESS FROM ANY CLAIMS OR
26
    LOSSES RELATING TO SUCH UNAUTHORIZED USE.
27
 
28
                Arbitrates access to the system bus among up to eight
29
        wave table channels for the bcSid. This arbitrator is part
30
        of a tree that ends up looking like a single arbitration
31
        request to the system.
32
 
33
        Spartan3
34
        19 LUTs / 11 slices
35
=============================================================== */
36
 
37
module PSGBusArb(rst, clk, ce, ack,
38
        req0, req1, req2, req3, req4, req5, req6, req7,
39
        sel0, sel1, sel2, sel3, sel4, sel5, sel6, sel7, seln);
40
input rst;              // reset
41
input clk;              // clock (eg 100MHz)
42
input ce;               // clock enable (eg 25MHz)
43
input ack;              // bus transfer completed
44
input req0;             // requester 0 wants the bus
45
input req1;             // requester 1 wants the bus
46
input req2;             // ...
47
input req3;
48
input req4;
49
input req5;
50
input req6;
51
input req7;
52
output sel0;    // requester 0 granted the bus
53
reg sel0;
54
output sel1;
55
reg sel1;
56
output sel2;
57
reg sel2;
58
output sel3;
59
reg sel3;
60
output sel4;
61
reg sel4;
62
output sel5;
63
reg sel5;
64
output sel6;
65
reg sel6;
66
output sel7;
67
reg sel7;
68
output [2:0] seln;       // who has the bus
69
reg [2:0] seln;
70
 
71
always @(posedge clk) begin
72
        if (rst) begin
73
                sel0 <= 1'b0;
74
                sel1 <= 1'b0;
75
                sel2 <= 1'b0;
76
                sel3 <= 1'b0;
77
                sel4 <= 1'b0;
78
                sel5 <= 1'b0;
79
                sel6 <= 1'b0;
80
                sel7 <= 1'b0;
81
                seln <= 3'd0;
82
        end
83
        else begin
84
                if (ce&ack) begin
85
                        if (req0) begin
86
                                sel0 <= 1'b1;
87
                                sel1 <= 1'b0;
88
                                sel2 <= 1'b0;
89
                                sel3 <= 1'b0;
90
                                sel4 <= 1'b0;
91
                                sel5 <= 1'b0;
92
                                sel6 <= 1'b0;
93
                                sel7 <= 1'b0;
94
                                seln <= 3'd0;
95
                        end
96
                        else if (req1) begin
97
                                sel1 <= 1'b1;
98
                                sel0 <= 1'b0;
99
                                sel2 <= 1'b0;
100
                                sel3 <= 1'b0;
101
                                sel4 <= 1'b0;
102
                                sel5 <= 1'b0;
103
                                sel6 <= 1'b0;
104
                                sel7 <= 1'b0;
105
                                seln <= 3'd1;
106
                        end
107
                        else if (req2) begin
108
                                sel2 <= 1'b1;
109
                                sel0 <= 1'b0;
110
                                sel1 <= 1'b0;
111
                                sel3 <= 1'b0;
112
                                sel4 <= 1'b0;
113
                                sel5 <= 1'b0;
114
                                sel6 <= 1'b0;
115
                                sel7 <= 1'b0;
116
                                seln <= 3'd2;
117
                        end
118
                        else if (req3) begin
119
                                sel3 <= 1'b1;
120
                                sel0 <= 1'b0;
121
                                sel1 <= 1'b0;
122
                                sel2 <= 1'b0;
123
                                sel4 <= 1'b0;
124
                                sel5 <= 1'b0;
125
                                sel6 <= 1'b0;
126
                                sel7 <= 1'b0;
127
                                seln <= 3'd3;
128
                        end
129
                        else if (req4) begin
130
                                sel4 <= 1'b1;
131
                                sel0 <= 1'b0;
132
                                sel1 <= 1'b0;
133
                                sel2 <= 1'b0;
134
                                sel3 <= 1'b0;
135
                                sel5 <= 1'b0;
136
                                sel6 <= 1'b0;
137
                                sel7 <= 1'b0;
138
                                seln <= 3'd4;
139
                        end
140
                        else if (req5) begin
141
                                sel5 <= 1'b1;
142
                                sel0 <= 1'b0;
143
                                sel1 <= 1'b0;
144
                                sel2 <= 1'b0;
145
                                sel3 <= 1'b0;
146
                                sel4 <= 1'b0;
147
                                sel6 <= 1'b0;
148
                                sel7 <= 1'b0;
149
                                seln <= 3'd5;
150
                        end
151
                        else if (req6) begin
152
                                sel6 <= 1'b1;
153
                                sel0 <= 1'b0;
154
                                sel1 <= 1'b0;
155
                                sel2 <= 1'b0;
156
                                sel3 <= 1'b0;
157
                                sel4 <= 1'b0;
158
                                sel5 <= 1'b0;
159
                                sel7 <= 1'b0;
160
                                seln <= 3'd6;
161
                        end
162
                        else if (req7) begin
163
                                sel7 <= 1'b1;
164
                                sel0 <= 1'b0;
165
                                sel1 <= 1'b0;
166
                                sel2 <= 1'b0;
167
                                sel3 <= 1'b0;
168
                                sel4 <= 1'b0;
169
                                sel5 <= 1'b0;
170
                                sel6 <= 1'b0;
171
                                seln <= 3'd7;
172
                        end
173
                        // otherwise, hold onto last owner
174
                        else begin
175
                                sel0 <= sel0;
176
                                sel1 <= sel1;
177
                                sel2 <= sel2;
178
                                sel3 <= sel3;
179
                                sel4 <= sel4;
180
                                sel5 <= sel5;
181
                                sel6 <= sel6;
182
                                sel7 <= sel7;
183
                                seln <= seln;
184
                        end
185
                end
186
        end
187
end
188
 
189
endmodule

powered by: WebSVN 2.1.0

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