[6] | 1 | // ========== Copyright Header Begin ========================================== |
---|
| 2 | // |
---|
| 3 | // OpenSPARC T1 Processor File: spu_maexp.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 | module spu_maexp ( |
---|
| 23 | |
---|
| 24 | /*outputs*/ |
---|
| 25 | spu_maexp_e_rd_oprnd_sel, |
---|
| 26 | spu_maexp_shift_e, |
---|
| 27 | spu_maexp_e_data_wen, |
---|
| 28 | spu_maexp_incr_es_ptr, |
---|
| 29 | |
---|
| 30 | spu_maexp_es_max_init, |
---|
| 31 | spu_maexp_es_e_ptr_rst, |
---|
| 32 | |
---|
| 33 | spu_maexp_done_set, |
---|
| 34 | spu_maexp_memren, |
---|
| 35 | |
---|
| 36 | spu_maexp_start_mulred_aequb, |
---|
| 37 | spu_maexp_start_mulred_anoteqb, |
---|
| 38 | |
---|
| 39 | spu_mactl_stxa_force_abort, |
---|
| 40 | |
---|
| 41 | /*inputs*/ |
---|
| 42 | spu_maaddr_esmax, |
---|
| 43 | spu_maaddr_esmod64, |
---|
| 44 | spu_madp_e_eq_one, |
---|
| 45 | spu_mared_red_done, |
---|
| 46 | |
---|
| 47 | spu_mactl_iss_pulse_dly, |
---|
| 48 | spu_mactl_expop, |
---|
| 49 | |
---|
| 50 | spu_mactl_kill_op, |
---|
| 51 | |
---|
| 52 | se, |
---|
| 53 | reset, |
---|
| 54 | rclk); |
---|
| 55 | |
---|
| 56 | input reset; |
---|
| 57 | input rclk; |
---|
| 58 | input se; |
---|
| 59 | |
---|
| 60 | input spu_maaddr_esmax; |
---|
| 61 | input spu_maaddr_esmod64; |
---|
| 62 | input spu_madp_e_eq_one; |
---|
| 63 | input spu_mared_red_done; |
---|
| 64 | |
---|
| 65 | input spu_mactl_iss_pulse_dly; |
---|
| 66 | input spu_mactl_expop; |
---|
| 67 | input spu_mactl_kill_op; |
---|
| 68 | input spu_mactl_stxa_force_abort; |
---|
| 69 | // -------------------------------------------------------------------------------- |
---|
| 70 | |
---|
| 71 | output spu_maexp_e_rd_oprnd_sel; |
---|
| 72 | output spu_maexp_shift_e; |
---|
| 73 | output spu_maexp_e_data_wen; |
---|
| 74 | output spu_maexp_incr_es_ptr; |
---|
| 75 | output spu_maexp_es_max_init; |
---|
| 76 | output spu_maexp_es_e_ptr_rst; |
---|
| 77 | |
---|
| 78 | output spu_maexp_done_set; |
---|
| 79 | output spu_maexp_memren; |
---|
| 80 | |
---|
| 81 | output spu_maexp_start_mulred_aequb; |
---|
| 82 | output spu_maexp_start_mulred_anoteqb; |
---|
| 83 | |
---|
| 84 | // -------------------------------------------------------------------------------- |
---|
| 85 | // -------------------------------------------------------------------------------- |
---|
| 86 | |
---|
| 87 | wire spu_maexp_exp_done,tr2idle_frm_esmax,tr2rde_frm_idle,tr2rde_frm_esmax, |
---|
| 88 | tr2gotomulred1_frm_rde,tr2gotomulred1_frm_esmax,tr2echk_frm_gotomulred1, |
---|
| 89 | tr2gotomulred2_frm_echk,tr2esmax_frm_gotomulred2,tr2esmax_frm_echk; |
---|
| 90 | // -------------------------------------------------------------------------------- |
---|
| 91 | // -------------------------------------------------------------------------------- |
---|
| 92 | wire cur_rde_state; |
---|
| 93 | wire local_stxa_abort; |
---|
| 94 | // -------------------------------------------------------------------------------- |
---|
| 95 | // -------------------------------------------------------------------------------- |
---|
| 96 | // ------------------------------------------------------------------------- |
---|
| 97 | // we need a state set to indcate exp is done, and when an |
---|
| 98 | // masync gets issued later, then the load asi is returned. |
---|
| 99 | wire spu_maexp_done_wen = (spu_maexp_exp_done | spu_mactl_kill_op | |
---|
| 100 | local_stxa_abort) & spu_mactl_expop ; |
---|
| 101 | wire spu_maexp_done_rst = reset | spu_mactl_iss_pulse_dly; |
---|
| 102 | |
---|
| 103 | dffre_s #(1) spu_maexp_done_ff ( |
---|
| 104 | .din(1'b1) , |
---|
| 105 | .q(spu_maexp_done_set), |
---|
| 106 | .en(spu_maexp_done_wen), |
---|
| 107 | .rst(spu_maexp_done_rst), .clk (rclk), .se(se), .si(), .so()); |
---|
| 108 | |
---|
| 109 | // -------------------------------------------------------------------------------- |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | // this was causing rd and wr contention in idct when running random diags. cur_rde_state |
---|
| 113 | //cause perr which caused expop to go to idle, but maaeqb state machine was in progress |
---|
| 114 | //and then a ldop was started which caused a rd of mem for ldop and a write during |
---|
| 115 | //maaeqb op in progress. |
---|
| 116 | |
---|
| 117 | //assign local_stxa_abort = (cur_rde_state | spu_mared_red_done) & spu_mactl_stxa_force_abort; |
---|
| 118 | assign local_stxa_abort = spu_mared_red_done & spu_mactl_stxa_force_abort; |
---|
| 119 | |
---|
| 120 | wire state_reset = reset | spu_maexp_exp_done | spu_mactl_kill_op | |
---|
| 121 | local_stxa_abort; |
---|
| 122 | |
---|
| 123 | // ------------------------------------------------------------------------------- |
---|
| 124 | // ------------------------------------------------------------------------------- |
---|
| 125 | |
---|
| 126 | wire expop_start = spu_mactl_iss_pulse_dly & spu_mactl_expop; |
---|
| 127 | |
---|
| 128 | // ------------------------------------------------------------------------------- |
---|
| 129 | // ------------------------------------------------------------------------------- |
---|
| 130 | // ------------------------------------------------------------------------------- |
---|
| 131 | // ------------------------------------------------------------------------------- |
---|
| 132 | dff_s #(1) idle_state_ff ( |
---|
| 133 | .din(nxt_idle_state) , |
---|
| 134 | .q(cur_idle_state), |
---|
| 135 | .clk (rclk), .se(se), .si(), .so()); |
---|
| 136 | |
---|
| 137 | dffr_s #(1) rde_state_ff ( |
---|
| 138 | .din(nxt_rde_state) , |
---|
| 139 | .q(cur_rde_state), |
---|
| 140 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
| 141 | |
---|
| 142 | dffr_s #(1) gotomulred1_state_ff ( |
---|
| 143 | .din(nxt_gotomulred1_state) , |
---|
| 144 | .q(cur_gotomulred1_state), |
---|
| 145 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
| 146 | |
---|
| 147 | dffr_s #(1) echk_state_ff ( |
---|
| 148 | .din(nxt_echk_state) , |
---|
| 149 | .q(cur_echk_state), |
---|
| 150 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
| 151 | |
---|
| 152 | dffr_s #(1) gotomulred2_state_ff ( |
---|
| 153 | .din(nxt_gotomulred2_state) , |
---|
| 154 | .q(cur_gotomulred2_state), |
---|
| 155 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
| 156 | |
---|
| 157 | dffr_s #(1) esmax_state_ff ( |
---|
| 158 | .din(nxt_esmax_state) , |
---|
| 159 | .q(cur_esmax_state), |
---|
| 160 | .rst(state_reset), .clk (rclk), .se(se), .si(), .so()); |
---|
| 161 | |
---|
| 162 | // ------------------------------------------------------------------------------- |
---|
| 163 | // ------------------------------------------------------------------------------- |
---|
| 164 | // ------------------------------------------------------------------------------- |
---|
| 165 | // ------------------------------------------------------------------------------- |
---|
| 166 | // ------------------------------------------------------------------------------- |
---|
| 167 | // transition to idle state |
---|
| 168 | |
---|
| 169 | assign tr2idle_frm_esmax = spu_maaddr_esmax & cur_esmax_state; |
---|
| 170 | |
---|
| 171 | assign spu_maexp_exp_done = tr2idle_frm_esmax; |
---|
| 172 | |
---|
| 173 | assign nxt_idle_state = ( |
---|
| 174 | state_reset | |
---|
| 175 | tr2idle_frm_esmax | |
---|
| 176 | (cur_idle_state & ~expop_start)); |
---|
| 177 | |
---|
| 178 | // ------------------------------------------------------------------------------- |
---|
| 179 | // transition to rde state |
---|
| 180 | |
---|
| 181 | assign tr2rde_frm_idle = cur_idle_state & expop_start; |
---|
| 182 | |
---|
| 183 | /* |
---|
| 184 | wire dly_tr2rde_frm_idle; |
---|
| 185 | dff_s #(1) dly_tr2rde_frm_idle_ff ( |
---|
| 186 | .din(tr2rde_frm_idle) , |
---|
| 187 | .q(dly_tr2rde_frm_idle), |
---|
| 188 | .clk (rclk), |
---|
| 189 | .clk (rclk) |
---|
| 190 | , .se(se), .si(), .so()); |
---|
| 191 | */ |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | assign tr2rde_frm_esmax = cur_esmax_state & ~spu_maaddr_esmax & spu_maaddr_esmod64; |
---|
| 195 | |
---|
| 196 | assign nxt_rde_state = ( |
---|
| 197 | tr2rde_frm_idle | |
---|
| 198 | tr2rde_frm_esmax ); |
---|
| 199 | |
---|
| 200 | // ------------------------------------------------------------------------------- |
---|
| 201 | // transition to gotomulred1 state |
---|
| 202 | |
---|
| 203 | assign tr2gotomulred1_frm_rde = cur_rde_state; |
---|
| 204 | assign tr2gotomulred1_frm_esmax = cur_esmax_state & ~spu_maaddr_esmax & |
---|
| 205 | ~spu_maaddr_esmod64; |
---|
| 206 | |
---|
| 207 | assign nxt_gotomulred1_state = ( |
---|
| 208 | tr2gotomulred1_frm_rde | |
---|
| 209 | tr2gotomulred1_frm_esmax | |
---|
| 210 | (cur_gotomulred1_state & ~spu_mared_red_done) ); |
---|
| 211 | |
---|
| 212 | // ------------------------------------------------------------------------------- |
---|
| 213 | // transition to echk state |
---|
| 214 | |
---|
| 215 | assign tr2echk_frm_gotomulred1 = cur_gotomulred1_state & spu_mared_red_done; |
---|
| 216 | |
---|
| 217 | assign nxt_echk_state = ( |
---|
| 218 | tr2echk_frm_gotomulred1); |
---|
| 219 | |
---|
| 220 | // ------------------------------------------------------------------------------- |
---|
| 221 | // transition to gotomulred2 state |
---|
| 222 | |
---|
| 223 | assign tr2gotomulred2_frm_echk = cur_echk_state & spu_madp_e_eq_one; |
---|
| 224 | |
---|
| 225 | assign nxt_gotomulred2_state = ( |
---|
| 226 | tr2gotomulred2_frm_echk | |
---|
| 227 | (cur_gotomulred2_state & ~spu_mared_red_done) ); |
---|
| 228 | |
---|
| 229 | // ------------------------------------------------------------------------------- |
---|
| 230 | // transition to esmax state |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | assign tr2esmax_frm_gotomulred2 = cur_gotomulred2_state & spu_mared_red_done; |
---|
| 234 | assign tr2esmax_frm_echk = cur_echk_state & ~spu_madp_e_eq_one; |
---|
| 235 | |
---|
| 236 | assign nxt_esmax_state = ( |
---|
| 237 | tr2esmax_frm_gotomulred2 | |
---|
| 238 | tr2esmax_frm_echk); |
---|
| 239 | |
---|
| 240 | // ------------------------------------------------------------------------------- |
---|
| 241 | // ------------------------------------------------------------------------------- |
---|
| 242 | // ------------------------------------------------------------------------------- |
---|
| 243 | // ------------------------------------------------------------------------------- |
---|
| 244 | // SEL XXNM OR XANM |
---|
| 245 | |
---|
| 246 | /* |
---|
| 247 | wire spu_maexp_xxnm_sel_set = tr2rde_frm_idle | tr2esmax_frm_echk | |
---|
| 248 | tr2esmax_frm_gotomulred2; |
---|
| 249 | |
---|
| 250 | wire spu_maexp_xxnm_sel_rst = state_reset | tr2echk_frm_gotomulred1; |
---|
| 251 | |
---|
| 252 | dffre_s #(1) xxnm_set_ff ( |
---|
| 253 | .din(1'b1) , |
---|
| 254 | .q(spu_maexp_xxnm_sel_q), |
---|
| 255 | .en(spu_maexp_xxnm_sel_set), |
---|
| 256 | .rst(spu_maexp_xxnm_sel_rst), .clk (rclk), |
---|
| 257 | .rst(spu_maexp_xxnm_sel_rst), .clk (rclk) |
---|
| 258 | , .se(se), .si(), .so()); |
---|
| 259 | |
---|
| 260 | assign spu_maexp_b_to_x_sel = spu_maexp_xxnm_sel_q; |
---|
| 261 | assign spu_maexp_b_to_a_sel = ~spu_maexp_xxnm_sel_q; |
---|
| 262 | */ |
---|
| 263 | |
---|
| 264 | // ------------------------------------------------------------------------------- |
---|
| 265 | |
---|
| 266 | assign spu_maexp_e_rd_oprnd_sel = tr2rde_frm_idle | tr2rde_frm_esmax; |
---|
| 267 | assign spu_maexp_memren = spu_maexp_e_rd_oprnd_sel; |
---|
| 268 | |
---|
| 269 | assign spu_maexp_shift_e = nxt_esmax_state; // muxsel in madp |
---|
| 270 | // write enable when data is from mamem or a shift write |
---|
| 271 | assign spu_maexp_e_data_wen = cur_rde_state | nxt_esmax_state; |
---|
| 272 | |
---|
| 273 | //assign spu_maexp_incr_es_ptr = tr2echk_frm_gotomulred1; |
---|
| 274 | assign spu_maexp_incr_es_ptr = tr2rde_frm_esmax | tr2gotomulred1_frm_esmax; |
---|
| 275 | |
---|
| 276 | assign spu_maexp_es_max_init = tr2rde_frm_idle; |
---|
| 277 | |
---|
| 278 | assign spu_maexp_es_e_ptr_rst = state_reset; |
---|
| 279 | // ------------------------------------------------------------------------------- |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | //assign spu_maexp_start_mulred = tr2gotomulred1_frm_rde | tr2gotomulred1_frm_esmax | |
---|
| 283 | // tr2gotomulred2_frm_echk ; |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | assign spu_maexp_start_mulred_aequb = tr2gotomulred1_frm_rde | tr2gotomulred1_frm_esmax; |
---|
| 287 | assign spu_maexp_start_mulred_anoteqb = tr2gotomulred2_frm_echk; |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | |
---|
| 292 | // ------------------------------------------------------------------------------- |
---|
| 293 | |
---|
| 294 | endmodule |
---|