Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_mmu_arbiter_rrobin.v | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | module dmu_mmu_arbiter_rrobin ( | |
36 | next_grant, | |
37 | csr_done, | |
38 | // csreq_pending, | |
39 | // lkupreq_pending, | |
40 | clk, | |
41 | rst_l, | |
42 | csrequest | |
43 | ); | |
44 | ||
45 | ||
46 | output next_grant; | |
47 | //output lkupreq_pending, csreq_pending; | |
48 | output csr_done; | |
49 | input csrequest; | |
50 | input clk, rst_l; | |
51 | ||
52 | ||
53 | reg curr_grant; | |
54 | reg curr_grant_d1; | |
55 | reg ram_done; | |
56 | reg ram_done_d1; | |
57 | ||
58 | // assign lkup_deque = ram_done & next_grant; | |
59 | // assign lkup_deque = next_grant; | |
60 | assign csr_done = ram_done_d1 & ~curr_grant_d1; | |
61 | ||
62 | always @(posedge clk) begin | |
63 | if (!rst_l) begin | |
64 | curr_grant <= 1'b0; | |
65 | curr_grant_d1 <= 1'b0; | |
66 | end | |
67 | else begin | |
68 | curr_grant <= next_grant; | |
69 | curr_grant_d1 <= curr_grant; | |
70 | end | |
71 | end | |
72 | ||
73 | ||
74 | // wire lkup_mux_out = lkupreq ? ~next_grant : 1'b0; | |
75 | // wire csr_mux_out = csrequest ? next_grant : 1'b0; | |
76 | ||
77 | assign next_grant = csrequest ? 1'b0 : 1'b1; | |
78 | ||
79 | ||
80 | // always @(posedge clk) begin | |
81 | // if (!rst_l) | |
82 | // lkupreq_pending <= 1'b0; | |
83 | // else | |
84 | // lkupreq_pending <= lkup_mux_out; | |
85 | // end | |
86 | ||
87 | // always @(posedge clk) begin | |
88 | // if (!rst_l) | |
89 | // csreq_pending <= 1'b0; | |
90 | // else | |
91 | // csreq_pending <= csr_mux_out; | |
92 | // end | |
93 | ||
94 | always @(posedge clk) begin | |
95 | if (!rst_l) begin | |
96 | ram_done_d1 <= 1'b0; | |
97 | ram_done <= 1'b0; | |
98 | end | |
99 | else begin | |
100 | // ram_done_d1 <= ram_done & ~next_grant; | |
101 | ram_done <= ~next_grant; | |
102 | ram_done_d1 <= ram_done; | |
103 | end | |
104 | end | |
105 | ||
106 | // always @(curr_grant or lkupreq or | |
107 | // csrequest or lkupreq_pending or | |
108 | // csreq_pending ) begin | |
109 | ||
110 | // next_grant = curr_grant; | |
111 | // ram_done = 1'b0; | |
112 | ||
113 | // casex ({lkupreq_pending,csreq_pending,lkupreq,csrequest}) | |
114 | // 4'b10xx : begin | |
115 | // next_grant = 1'b1; | |
116 | // ram_done = 1'b1; | |
117 | // end | |
118 | // 4'b01xx : begin | |
119 | // next_grant = 1'b0; | |
120 | // ram_done = 1'b1; | |
121 | // end | |
122 | // 4'b11xx : begin | |
123 | // next_grant = 1'b0; | |
124 | // ram_done = 1'b1; | |
125 | // end | |
126 | // 4'b0010 : begin | |
127 | // next_grant = 1'b1; | |
128 | // ram_done = 1'b1; | |
129 | // end | |
130 | // 4'b0001 : begin | |
131 | // next_grant = 1'b0; | |
132 | // ram_done = 1'b1; | |
133 | // end | |
134 | // 4'b0011 : begin | |
135 | // next_grant = 1'b0; | |
136 | // ram_done = 1'b1; | |
137 | // end | |
138 | // 4'b0000 : begin | |
139 | // next_grant = curr_grant; | |
140 | // ram_done = 1'b0; | |
141 | // end | |
142 | // default : next_grant = 1'bx; | |
143 | // endcase | |
144 | // end | |
145 | endmodule |