1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: sparc_exu_eclbyplog.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 | // Module Name: sparc_exu_eclbyplog |
---|
24 | // Description: This block implements the bypass logic for a single |
---|
25 | // operand. It takes the destination registers of all |
---|
26 | // four forwarding sources and the rs. It also has the |
---|
27 | // thread for the instruction in each stage and whether |
---|
28 | // the instruction writes to the register file. It won't |
---|
29 | // bypass if rs =0. |
---|
30 | */ |
---|
31 | module sparc_exu_eclbyplog (/*AUTOARG*/ |
---|
32 | // Outputs |
---|
33 | rs_sel_mux1_m, rs_sel_mux1_w, rs_sel_mux1_w2, rs_sel_mux1_other, |
---|
34 | rs_sel_mux2_usemux1, rs_sel_mux2_rf, rs_sel_mux2_e, |
---|
35 | rs_sel_mux2_ld, rs_sel_longmux_g2, rs_sel_longmux_w2, |
---|
36 | rs_sel_longmux_ldxa, |
---|
37 | // Inputs |
---|
38 | sehold, use_other, rs, rd_e, rd_m, ecl_irf_rd_w, ld_rd_g, |
---|
39 | wb_byplog_rd_w2, wb_byplog_rd_g2, tid_d, thr_match_de, |
---|
40 | thr_match_dm, ecl_irf_tid_w, ld_thr_match_dg, wb_byplog_tid_w2, |
---|
41 | ld_thr_match_dg2, ifu_exu_kill_e, wb_e, bypass_m, |
---|
42 | lsu_exu_dfill_vld_g, bypass_w, wb_byplog_wen_w2, wb_byplog_wen_g2, |
---|
43 | ecl_byp_ldxa_g |
---|
44 | ) ; |
---|
45 | input sehold; |
---|
46 | input use_other; |
---|
47 | input [4:0] rs; // source register |
---|
48 | input [4:0] rd_e; // destination regs for all stages |
---|
49 | input [4:0] rd_m; |
---|
50 | input [4:0] ecl_irf_rd_w; |
---|
51 | input [4:0] ld_rd_g; |
---|
52 | input [4:0] wb_byplog_rd_w2; |
---|
53 | input [4:0] wb_byplog_rd_g2; |
---|
54 | input [1:0] tid_d; |
---|
55 | input thr_match_de; |
---|
56 | input thr_match_dm; |
---|
57 | input [1:0] ecl_irf_tid_w; |
---|
58 | input ld_thr_match_dg; |
---|
59 | input [1:0] wb_byplog_tid_w2; |
---|
60 | input ld_thr_match_dg2; |
---|
61 | input ifu_exu_kill_e; |
---|
62 | input wb_e; // whether each stage writes to reg |
---|
63 | input bypass_m; // file |
---|
64 | input lsu_exu_dfill_vld_g; |
---|
65 | input bypass_w; |
---|
66 | input wb_byplog_wen_w2; |
---|
67 | input wb_byplog_wen_g2; |
---|
68 | input ecl_byp_ldxa_g; |
---|
69 | |
---|
70 | output rs_sel_mux1_m; |
---|
71 | output rs_sel_mux1_w; |
---|
72 | output rs_sel_mux1_w2; |
---|
73 | output rs_sel_mux1_other; |
---|
74 | output rs_sel_mux2_usemux1; |
---|
75 | output rs_sel_mux2_rf; |
---|
76 | output rs_sel_mux2_e; |
---|
77 | output rs_sel_mux2_ld; |
---|
78 | output rs_sel_longmux_g2; |
---|
79 | output rs_sel_longmux_w2; |
---|
80 | output rs_sel_longmux_ldxa; |
---|
81 | |
---|
82 | wire use_e, use_m, use_w, use_w2, use_rf, use_ld, use_ldxa; |
---|
83 | wire match_e, match_m, match_w, match_w2, match_ld; // outputs of comparison |
---|
84 | wire match_g2; |
---|
85 | wire bypass; // boolean that allows bypassing |
---|
86 | wire rs_is_nonzero; |
---|
87 | |
---|
88 | // Don't bypass if rs == 0 or we are supposed to use other |
---|
89 | assign rs_is_nonzero = rs[0]|rs[1]|rs[2]|rs[3]|rs[4]; |
---|
90 | assign bypass = rs_is_nonzero & ~use_other & ~sehold; |
---|
91 | |
---|
92 | // Normal pipe priority: E, M, W, RF |
---|
93 | // Ld priority: LD, RF |
---|
94 | // W2 priority: E, M, W2, RF |
---|
95 | assign use_e = match_e & wb_e & ~ifu_exu_kill_e; |
---|
96 | assign use_m = match_m & bypass_m & ~use_e; |
---|
97 | assign use_w = match_w & bypass_w & ~use_m & ~use_e; |
---|
98 | assign use_ld = match_ld & lsu_exu_dfill_vld_g & ~ecl_byp_ldxa_g; |
---|
99 | assign use_ldxa = match_ld & ecl_byp_ldxa_g; |
---|
100 | assign use_w2 = (match_w2 & wb_byplog_wen_w2 | match_g2 & wb_byplog_wen_g2) & ~use_e & ~use_m; |
---|
101 | assign use_rf = ~use_w2 & ~use_w & ~use_m & ~use_e & ~use_ld & ~use_ldxa; |
---|
102 | |
---|
103 | // mux1[M, W, W2, OTHER(optional)] |
---|
104 | // mux2[mux1, RF, E, LD] |
---|
105 | assign rs_sel_mux2_e = (use_e & bypass); |
---|
106 | assign rs_sel_mux2_rf = ((use_rf | ~bypass) & ~(use_other & ~sehold)); |
---|
107 | assign rs_sel_mux2_ld = (use_ld & ~use_e & ~use_w & ~use_m & ~use_w2 & bypass); |
---|
108 | assign rs_sel_mux2_usemux1 = (use_other & ~sehold) | (~rs_sel_mux1_other & ~use_e); |
---|
109 | assign rs_sel_mux1_other = ~((use_m | use_w | use_w2 | use_ldxa) & bypass); |
---|
110 | assign rs_sel_mux1_w2 = ((use_w2 | use_ldxa) & bypass); |
---|
111 | assign rs_sel_mux1_w = (use_w & ~use_w2 & ~use_ldxa & bypass); |
---|
112 | assign rs_sel_mux1_m = (use_m & ~use_w2 & ~use_ldxa & bypass); |
---|
113 | |
---|
114 | assign rs_sel_longmux_ldxa = use_ldxa; |
---|
115 | assign rs_sel_longmux_g2 = match_g2 & wb_byplog_wen_g2 & ~use_ldxa; |
---|
116 | assign rs_sel_longmux_w2 = ~use_ldxa & ~(match_g2 & wb_byplog_wen_g2); |
---|
117 | |
---|
118 | // Comparisons |
---|
119 | assign match_e = thr_match_de & (rs[4:0] == rd_e[4:0]); |
---|
120 | // sparc_exu_eclcomp7 e_comp7(.out(match_e), .in1({tid_d[1:0],rs[4:0]}), |
---|
121 | // .in2({ecl_rml_tid_e[1:0],rd_e[4:0]})); |
---|
122 | assign match_m = thr_match_dm & (rs[4:0] == rd_m[4:0]); |
---|
123 | // sparc_exu_eclcomp7 m_comp7(.out(match_m), .in1({tid_d[1:0],rs[4:0]}), |
---|
124 | // .in2({tid_m[1:0],rd_m[4:0]})); |
---|
125 | sparc_exu_eclcomp7 w_comp7(.out(match_w), .in1({tid_d[1:0],rs[4:0]}), |
---|
126 | .in2({ecl_irf_tid_w[1:0],ecl_irf_rd_w[4:0]})); |
---|
127 | sparc_exu_eclcomp7 w2_comp7(.out(match_w2), .in1({tid_d[1:0],rs[4:0]}), |
---|
128 | .in2({wb_byplog_tid_w2[1:0],wb_byplog_rd_w2[4:0]})); |
---|
129 | assign match_ld = ld_thr_match_dg & (rs[4:0] == ld_rd_g[4:0]); |
---|
130 | assign match_g2 = ld_thr_match_dg2 & (rs[4:0] == wb_byplog_rd_g2[4:0]); |
---|
131 | /* -----\/----- EXCLUDED -----\/----- |
---|
132 | sparc_exu_eclcomp7 ld_comp7(.out(match_ld), .in1({tid_d[1:0],rs[4:0]}), |
---|
133 | .in2({ld_tid_g[1:0],ld_rd_g[4:0]})); |
---|
134 | sparc_exu_eclcomp7 g2_comp7(.out(match_g2), .in1({tid_d[1:0],rs[4:0]}), |
---|
135 | .in2({wb_byplog_tid_g2[1:0],wb_byplog_rd_g2[4:0]})); |
---|
136 | -----/\----- EXCLUDED -----/\----- */ |
---|
137 | |
---|
138 | |
---|
139 | endmodule // sparc_exu_eclbyplog |
---|