Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: gkt_pqm_ctl.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 gkt_pqm_ctl ( | |
36 | l1clk, | |
37 | scan_in, | |
38 | spc_aclk, | |
39 | spc_bclk, | |
40 | scan_out, | |
41 | pqm_req_drop, | |
42 | pqm_empty, | |
43 | spc_pcx_req_pq, | |
44 | pcx_grant); | |
45 | wire siclk; | |
46 | wire soclk; | |
47 | wire [1:0] qcnt_inc; | |
48 | wire [1:0] qcnt; | |
49 | wire [1:0] qcnt_dec; | |
50 | wire qfull; | |
51 | wire incr; | |
52 | wire decr; | |
53 | wire hold; | |
54 | wire [1:0] qcnt_next; | |
55 | wire dff_qcnt_scanin; | |
56 | wire dff_qcnt_scanout; | |
57 | ||
58 | ||
59 | // globals | |
60 | input l1clk; | |
61 | input scan_in; | |
62 | input spc_aclk; | |
63 | input spc_bclk; | |
64 | output scan_out; | |
65 | ||
66 | output pqm_req_drop; | |
67 | output pqm_empty; | |
68 | ||
69 | ||
70 | input spc_pcx_req_pq; | |
71 | input pcx_grant; | |
72 | ||
73 | // scan renames | |
74 | assign siclk = spc_aclk; | |
75 | assign soclk = spc_bclk; | |
76 | // end scan | |
77 | ||
78 | ||
79 | //////////////////////////////////////////////////////// | |
80 | // keep track of ccx fifo | |
81 | // l15 can send 2 requests followed by a 3rd speculative req. | |
82 | // If a grant is not seen in the cycle when 3rd req is launched, | |
83 | // then it is dropped by ccx, and l15 has to resend it. | |
84 | ||
85 | assign qcnt_inc[1:0] = qcnt[1:0] + 2'b01; | |
86 | assign qcnt_dec[1:0] = (qcnt[1:0] == 2'b00)? 2'b00: (qcnt[1:0] - 2'b01); | |
87 | ||
88 | assign qfull = qcnt[1]; | |
89 | assign pqm_empty = ~qcnt[1] & ~qcnt[0]; | |
90 | ||
91 | // do not increment if qfull, the req is going to get dropped. | |
92 | ||
93 | assign incr = spc_pcx_req_pq & ~qfull & ~pcx_grant; | |
94 | assign decr = ~spc_pcx_req_pq & pcx_grant; | |
95 | assign hold = ~incr & ~decr; | |
96 | //assign qcnt_next[1:0] = incr? qcnt_inc[1:0]: decr ? qcnt_dec[1:0] : qcnt[1:0]; | |
97 | ||
98 | assign qcnt_next[1:0] = ({2{incr}} & qcnt_inc[1:0]) | | |
99 | ({2{decr}} & qcnt_dec[1:0]) | | |
100 | ({2{hold}} & qcnt[1:0]); | |
101 | ||
102 | // pcx_grant is a very late signal. | |
103 | // | |
104 | ||
105 | ||
106 | // 0in overflow -var qcnt_next[1:0] -min 0 -max 2 | |
107 | ||
108 | assign pqm_req_drop = qcnt[1] & spc_pcx_req_pq & ~pcx_grant; | |
109 | ||
110 | gkt_pqm_ctl_msff_ctl_macro__width_2 dff_qcnt | |
111 | ( | |
112 | .scan_in(dff_qcnt_scanin), | |
113 | .scan_out(dff_qcnt_scanout), | |
114 | .din (qcnt_next[1:0]), | |
115 | .dout (qcnt[1:0]), | |
116 | .l1clk (l1clk), | |
117 | .siclk(siclk), | |
118 | .soclk(soclk) | |
119 | ); | |
120 | ||
121 | // fixscan start: | |
122 | assign dff_qcnt_scanin = scan_in ; | |
123 | assign scan_out = dff_qcnt_scanout ; | |
124 | // fixscan end: | |
125 | endmodule // gkt_pqm_ctl | |
126 | ||
127 | ||
128 | ||
129 | ||
130 | ||
131 | ||
132 | // any PARAMS parms go into naming of macro | |
133 | ||
134 | module gkt_pqm_ctl_msff_ctl_macro__width_2 ( | |
135 | din, | |
136 | l1clk, | |
137 | scan_in, | |
138 | siclk, | |
139 | soclk, | |
140 | dout, | |
141 | scan_out); | |
142 | wire [1:0] fdin; | |
143 | wire [0:0] so; | |
144 | ||
145 | input [1:0] din; | |
146 | input l1clk; | |
147 | input scan_in; | |
148 | ||
149 | ||
150 | input siclk; | |
151 | input soclk; | |
152 | ||
153 | output [1:0] dout; | |
154 | output scan_out; | |
155 | assign fdin[1:0] = din[1:0]; | |
156 | ||
157 | ||
158 | ||
159 | ||
160 | ||
161 | ||
162 | dff #(2) d0_0 ( | |
163 | .l1clk(l1clk), | |
164 | .siclk(siclk), | |
165 | .soclk(soclk), | |
166 | .d(fdin[1:0]), | |
167 | .si({scan_in,so[0:0]}), | |
168 | .so({so[0:0],scan_out}), | |
169 | .q(dout[1:0]) | |
170 | ); | |
171 | ||
172 | ||
173 | ||
174 | ||
175 | ||
176 | ||
177 | ||
178 | ||
179 | ||
180 | ||
181 | ||
182 | ||
183 | endmodule | |
184 | ||
185 | ||
186 | ||
187 | ||
188 | ||
189 | ||
190 | ||
191 |