1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: spu_mald.v |
---|
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
---|
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. |
---|
6 | // |
---|
7 | // The above named program is free software; you can redistribute it and/or |
---|
8 | // modify it under the terms of the GNU General Public |
---|
9 | // License version 2 as published by the Free Software Foundation. |
---|
10 | // |
---|
11 | // The above named program is distributed in the hope that it will be |
---|
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | // General Public License for more details. |
---|
15 | // |
---|
16 | // You should have received a copy of the GNU General Public |
---|
17 | // License along with this work; if not, write to the Free Software |
---|
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
19 | // |
---|
20 | // ========== Copyright Header End ============================================ |
---|
21 | //////////////////////////////////////////////////////////////////////// |
---|
22 | /* |
---|
23 | // Description: state machine for load requests to L2. |
---|
24 | */ |
---|
25 | //////////////////////////////////////////////////////////////////////// |
---|
26 | // Global header file includes |
---|
27 | //////////////////////////////////////////////////////////////////////// |
---|
28 | |
---|
29 | module spu_mald ( |
---|
30 | |
---|
31 | /*outputs*/ |
---|
32 | spu_mald_rstln, |
---|
33 | spu_mald_maaddr_addrinc, |
---|
34 | spu_mald_memwen, |
---|
35 | spu_mald_mpa_addrinc, |
---|
36 | spu_mald_ldreq, |
---|
37 | spu_mald_done, |
---|
38 | spu_mald_force_mpa_add16, |
---|
39 | |
---|
40 | spu_mald_done_set, |
---|
41 | |
---|
42 | /*inputs*/ |
---|
43 | ld_inprog, |
---|
44 | ldreq_ack, |
---|
45 | ln_received, |
---|
46 | len_neqz, |
---|
47 | mactl_ldop, |
---|
48 | spu_maaddr_mpa1maddr0, |
---|
49 | spu_mactl_iss_pulse_dly, |
---|
50 | |
---|
51 | spu_wen_ma_unc_err_pulse, |
---|
52 | |
---|
53 | spu_mactl_stxa_force_abort, |
---|
54 | |
---|
55 | se, |
---|
56 | reset, |
---|
57 | rclk); |
---|
58 | |
---|
59 | // --------------------------------------------------------- |
---|
60 | input reset; |
---|
61 | input rclk; |
---|
62 | input se; |
---|
63 | |
---|
64 | input ld_inprog; |
---|
65 | input ldreq_ack; |
---|
66 | input ln_received; |
---|
67 | input len_neqz; |
---|
68 | input mactl_ldop; |
---|
69 | input spu_maaddr_mpa1maddr0; |
---|
70 | input spu_mactl_iss_pulse_dly; |
---|
71 | |
---|
72 | input spu_wen_ma_unc_err_pulse; |
---|
73 | |
---|
74 | input spu_mactl_stxa_force_abort; |
---|
75 | // --------------------------------------------------------- |
---|
76 | output spu_mald_rstln; |
---|
77 | output spu_mald_maaddr_addrinc; |
---|
78 | output spu_mald_memwen; |
---|
79 | output spu_mald_mpa_addrinc; |
---|
80 | |
---|
81 | output spu_mald_ldreq; |
---|
82 | output spu_mald_done; |
---|
83 | output spu_mald_force_mpa_add16; |
---|
84 | |
---|
85 | output spu_mald_done_set; |
---|
86 | |
---|
87 | // --------------------------------------------------------- |
---|
88 | |
---|
89 | wire tr2wait4ln_frm_ldreq; |
---|
90 | |
---|
91 | // --------------------------------------------------------- |
---|
92 | /******************************* |
---|
93 | |
---|
94 | there are 8 states: |
---|
95 | |
---|
96 | 000001 idle |
---|
97 | 000010 ld1_req |
---|
98 | 000100 ld2_req |
---|
99 | 001000 wait_4ln1 |
---|
100 | 010000 wait_4ln2 |
---|
101 | 100000 mamem_wr |
---|
102 | |
---|
103 | ********************************/ |
---|
104 | wire local_stxa_abort; |
---|
105 | // ------------------------------------------------------ |
---|
106 | // we need a state set to indcate ld is done, and when an |
---|
107 | // masync gets issued later, then the load asi is returned. |
---|
108 | wire spu_mald_done_wen = (spu_mald_done | spu_wen_ma_unc_err_pulse | local_stxa_abort) & |
---|
109 | mactl_ldop; |
---|
110 | wire spu_mald_done_rst = reset | spu_mactl_iss_pulse_dly; |
---|
111 | |
---|
112 | dffre_s #(1) spu_mald_done_ff ( |
---|
113 | .din(1'b1) , |
---|
114 | .q(spu_mald_done_set), |
---|
115 | .en(spu_mald_done_wen), |
---|
116 | .rst(spu_mald_done_rst), .clk (rclk), .se(se), .si(), .so()); |
---|
117 | |
---|
118 | // ------------------------------------------------------ |
---|
119 | // ------------------------------------------------------ |
---|
120 | // ------------------------------------------------------ |
---|
121 | // ------------------------------------------------------ |
---|
122 | // ------------------------------------------------------ |
---|
123 | |
---|
124 | wire state_reset = reset | spu_mald_done | spu_wen_ma_unc_err_pulse | |
---|
125 | local_stxa_abort; |
---|
126 | |
---|
127 | // ------------------------------------------------------ |
---|
128 | dff_s #(1) idle_state_ff ( |
---|
129 | .din(nxt_idle_state) , |
---|
130 | .q(cur_idle_state), |
---|
131 | .clk (rclk), .se(se), .si(), .so()); |
---|
132 | |
---|
133 | dffr_s #(1) ldreq_state_ff ( |
---|
134 | .din(nxt_ldreq_state) , |
---|
135 | .q(cur_ldreq_state), |
---|
136 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
137 | |
---|
138 | dffr_s #(1) wait4ln_state_ff ( |
---|
139 | .din(nxt_wait4ln_state) , |
---|
140 | .q(cur_wait4ln_state), |
---|
141 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
142 | |
---|
143 | dffr_s #(1) mamemwr_state_ff ( |
---|
144 | .din(nxt_mamemwr_state) , |
---|
145 | .q(cur_mamemwr_state), |
---|
146 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
147 | |
---|
148 | dffr_s #(1) chk4mpa1maddr0_state_ff ( |
---|
149 | .din(nxt_chk4mpa1maddr0_state) , |
---|
150 | .q(cur_chk4mpa1maddr0_state), |
---|
151 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
152 | |
---|
153 | // ------------------------------------------------------ |
---|
154 | // ------------------------------------------------------ |
---|
155 | |
---|
156 | wire start_ldop = spu_mactl_iss_pulse_dly & mactl_ldop; |
---|
157 | |
---|
158 | // -------------------------------------------------------------- |
---|
159 | // transition to idle state. |
---|
160 | |
---|
161 | assign spu_mald_done = cur_chk4mpa1maddr0_state & ~len_neqz; |
---|
162 | |
---|
163 | assign nxt_idle_state = ( |
---|
164 | state_reset | |
---|
165 | (spu_mald_done) | |
---|
166 | (cur_idle_state & ~start_ldop)); |
---|
167 | |
---|
168 | // -------------------------------------------------------------- |
---|
169 | // transition to ldreq state. |
---|
170 | |
---|
171 | |
---|
172 | assign nxt_ldreq_state = ( |
---|
173 | (cur_chk4mpa1maddr0_state & ~spu_maaddr_mpa1maddr0 & len_neqz) | |
---|
174 | (cur_idle_state & start_ldop) | |
---|
175 | (cur_ldreq_state & ~ldreq_ack)); |
---|
176 | |
---|
177 | assign spu_mald_rstln = (cur_mamemwr_state & ld_inprog & len_neqz) | local_stxa_abort | |
---|
178 | spu_wen_ma_unc_err_pulse; |
---|
179 | |
---|
180 | // -------------------------------------------------------------- |
---|
181 | // transition to wait4ln state. |
---|
182 | |
---|
183 | //assign tr2wait4ln_frm_ldreq = cur_ldreq_state & ldreq_ack & ln_received; |
---|
184 | assign tr2wait4ln_frm_ldreq = cur_ldreq_state & ldreq_ack ; |
---|
185 | |
---|
186 | assign nxt_wait4ln_state = ( |
---|
187 | (tr2wait4ln_frm_ldreq) | |
---|
188 | (cur_wait4ln_state & ~ln_received)); |
---|
189 | |
---|
190 | // -------------------------------------------------------------- |
---|
191 | // transition to mamemwr state. |
---|
192 | |
---|
193 | wire tr2mamemwr_frm_wait4ln = cur_wait4ln_state & ln_received; |
---|
194 | wire tr2mamemwr_frm_chk4mpa1maddr0 = cur_chk4mpa1maddr0_state & spu_maaddr_mpa1maddr0 & len_neqz; |
---|
195 | |
---|
196 | wire mald_memwen = ( tr2mamemwr_frm_wait4ln | |
---|
197 | tr2mamemwr_frm_chk4mpa1maddr0) & len_neqz; |
---|
198 | |
---|
199 | // added this delay for the Parity Gen. added extra cycle. |
---|
200 | wire mald_memwen_dly; |
---|
201 | dffr_s #(1) wen_dly_ff ( |
---|
202 | .din(mald_memwen) , |
---|
203 | .q(mald_memwen_dly), |
---|
204 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
205 | |
---|
206 | |
---|
207 | assign nxt_mamemwr_state = ( mald_memwen_dly ); |
---|
208 | |
---|
209 | assign local_stxa_abort = mald_memwen_dly & spu_mactl_stxa_force_abort; |
---|
210 | |
---|
211 | // -------------------------------------------------------------- |
---|
212 | // transition to chk4mpa1maddr0 state. |
---|
213 | |
---|
214 | assign nxt_chk4mpa1maddr0_state = ( |
---|
215 | (cur_mamemwr_state) ); |
---|
216 | |
---|
217 | |
---|
218 | // -------------------------------------------------------------- |
---|
219 | // ************************************************************** |
---|
220 | // -------------------------------------------------------------- |
---|
221 | assign spu_mald_memwen = nxt_mamemwr_state; |
---|
222 | |
---|
223 | assign spu_mald_maaddr_addrinc = cur_mamemwr_state; |
---|
224 | |
---|
225 | assign spu_mald_mpa_addrinc = cur_mamemwr_state ; |
---|
226 | |
---|
227 | assign spu_mald_force_mpa_add16 = 1'b0 ; |
---|
228 | |
---|
229 | assign spu_mald_ldreq = cur_ldreq_state ; |
---|
230 | |
---|
231 | |
---|
232 | |
---|
233 | endmodule |
---|