| 1 |
95 |
fafa1971 |
// ========== Copyright Header Begin ==========================================
|
| 2 |
|
|
//
|
| 3 |
|
|
// OpenSPARC T1 Processor File: sparc_ifu_wseldp.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 |
113 |
albert.wat |
`ifdef SIMPLY_RISC_TWEAKS
|
| 22 |
|
|
`define SIMPLY_RISC_SCANIN .si(0)
|
| 23 |
|
|
`else
|
| 24 |
|
|
`define SIMPLY_RISC_SCANIN .si()
|
| 25 |
|
|
`endif
|
| 26 |
95 |
fafa1971 |
//////////////////////////////////////////////////////////////////////
|
| 27 |
|
|
/*
|
| 28 |
|
|
// Module Name: sparc_ifu_wsel
|
| 29 |
|
|
// Description:
|
| 30 |
|
|
// Way selects removed from icache and done here
|
| 31 |
|
|
*/
|
| 32 |
|
|
|
| 33 |
|
|
module sparc_ifu_wseldp (/*AUTOARG*/
|
| 34 |
|
|
// Outputs
|
| 35 |
|
|
wsel_fdp_fetdata_s1, wsel_fdp_topdata_s1, wsel_mbist_icache_data,
|
| 36 |
|
|
so,
|
| 37 |
|
|
// Inputs
|
| 38 |
|
|
rclk, se, si, icd_wsel_fetdata_s1, icd_wsel_topdata_s1,
|
| 39 |
|
|
itlb_wsel_waysel_s1, ifq_erb_asiway_f
|
| 40 |
|
|
);
|
| 41 |
|
|
|
| 42 |
|
|
input rclk,
|
| 43 |
|
|
se,
|
| 44 |
|
|
si;
|
| 45 |
|
|
|
| 46 |
|
|
input [135:0] icd_wsel_fetdata_s1,
|
| 47 |
|
|
icd_wsel_topdata_s1;
|
| 48 |
|
|
|
| 49 |
|
|
input [3:0] itlb_wsel_waysel_s1;
|
| 50 |
|
|
input [1:0] ifq_erb_asiway_f;
|
| 51 |
|
|
|
| 52 |
|
|
output [33:0] wsel_fdp_fetdata_s1;
|
| 53 |
|
|
output [33:0] wsel_fdp_topdata_s1;
|
| 54 |
|
|
|
| 55 |
|
|
output [67:0] wsel_mbist_icache_data;
|
| 56 |
|
|
|
| 57 |
|
|
output so;
|
| 58 |
|
|
|
| 59 |
|
|
// local signals
|
| 60 |
|
|
wire [3:0] dec_asiway_s_l,
|
| 61 |
|
|
waysel_buf_s1;
|
| 62 |
|
|
wire [1:0] asiway_s;
|
| 63 |
|
|
|
| 64 |
|
|
wire [33:0] rdc_fetdata_s1,
|
| 65 |
|
|
rdc_topdata_s1,
|
| 66 |
|
|
erb_asidata_s,
|
| 67 |
|
|
asi_topdata_s;
|
| 68 |
|
|
wire clk;
|
| 69 |
|
|
|
| 70 |
|
|
//
|
| 71 |
|
|
// Code begins here
|
| 72 |
|
|
//
|
| 73 |
|
|
//------------------
|
| 74 |
|
|
// Control Portion
|
| 75 |
|
|
//------------------
|
| 76 |
|
|
|
| 77 |
|
|
assign clk = rclk;
|
| 78 |
|
|
|
| 79 |
|
|
// flop and decode waysel
|
| 80 |
113 |
albert.wat |
dff_s #(2) asiway_reg(.din (ifq_erb_asiway_f),
|
| 81 |
95 |
fafa1971 |
.q (asiway_s),
|
| 82 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 83 |
95 |
fafa1971 |
assign dec_asiway_s_l[0] = ~(~asiway_s[1] & ~asiway_s[0]);
|
| 84 |
|
|
assign dec_asiway_s_l[1] = ~(~asiway_s[1] & asiway_s[0]);
|
| 85 |
|
|
assign dec_asiway_s_l[2] = ~( asiway_s[1] & ~asiway_s[0]);
|
| 86 |
|
|
assign dec_asiway_s_l[3] = ~( asiway_s[1] & asiway_s[0]);
|
| 87 |
|
|
|
| 88 |
|
|
//--------------------------
|
| 89 |
|
|
// Datapath Section
|
| 90 |
|
|
//--------------------------
|
| 91 |
|
|
|
| 92 |
|
|
// buffer wayselect from itlb
|
| 93 |
|
|
// align these buffers with the corresponding pins in itlb
|
| 94 |
|
|
assign waysel_buf_s1 = itlb_wsel_waysel_s1;
|
| 95 |
|
|
|
| 96 |
|
|
// Very Timing Critical Wayselect Muxes
|
| 97 |
|
|
// !!Cannot be a one-hot mux!!
|
| 98 |
|
|
// use ao2222
|
| 99 |
|
|
// bw_u1_ao2222_2x #(34) fetway_mx(.z (rdc_fetdata_s1[33:0]),
|
| 100 |
|
|
// .a2 (icd_wsel_fetdata_s1[33:0]),
|
| 101 |
|
|
// .b2 (icd_wsel_fetdata_s1[67:34]),
|
| 102 |
|
|
// .c2 (icd_wsel_fetdata_s1[101:68]),
|
| 103 |
|
|
// .d2 (icd_wsel_fetdata_s1[135:102]),
|
| 104 |
|
|
// .a1 (waysel_buf_s1[0]),
|
| 105 |
|
|
// .b1 (waysel_buf_s1[1]),
|
| 106 |
|
|
// .c1 (waysel_buf_s1[2]),
|
| 107 |
|
|
// .d1 (waysel_buf_s1[3]));
|
| 108 |
|
|
|
| 109 |
|
|
// bw_u1_ao2222_2x #(34) topway_mx(.z (rdc_topdata_s1[33:0]),
|
| 110 |
|
|
// .a2 (icd_wsel_topdata_s1[33:0]),
|
| 111 |
|
|
// .b2 (icd_wsel_topdata_s1[67:34]),
|
| 112 |
|
|
// .c2 (icd_wsel_topdata_s1[101:68]),
|
| 113 |
|
|
// .d2 (icd_wsel_topdata_s1[135:102]),
|
| 114 |
|
|
// .a1 (waysel_buf_s1[0]),
|
| 115 |
|
|
// .b1 (waysel_buf_s1[1]),
|
| 116 |
|
|
// .c1 (waysel_buf_s1[2]),
|
| 117 |
|
|
// .d1 (waysel_buf_s1[3]));
|
| 118 |
|
|
|
| 119 |
|
|
assign rdc_fetdata_s1 = icd_wsel_fetdata_s1[33:0] & {34{waysel_buf_s1[0]}} |
|
| 120 |
|
|
icd_wsel_fetdata_s1[67:34] & {34{waysel_buf_s1[1]}} |
|
| 121 |
|
|
icd_wsel_fetdata_s1[101:68] & {34{waysel_buf_s1[2]}} |
|
| 122 |
|
|
icd_wsel_fetdata_s1[135:102] & {34{waysel_buf_s1[3]}};
|
| 123 |
|
|
|
| 124 |
|
|
assign rdc_topdata_s1 = icd_wsel_topdata_s1[33:0] & {34{waysel_buf_s1[0]}} |
|
| 125 |
|
|
icd_wsel_topdata_s1[67:34] & {34{waysel_buf_s1[1]}} |
|
| 126 |
|
|
icd_wsel_topdata_s1[101:68] & {34{waysel_buf_s1[2]}} |
|
| 127 |
|
|
icd_wsel_topdata_s1[135:102] & {34{waysel_buf_s1[3]}};
|
| 128 |
|
|
|
| 129 |
|
|
// buffer and send to fdp
|
| 130 |
|
|
assign wsel_fdp_fetdata_s1 = rdc_fetdata_s1;
|
| 131 |
|
|
assign wsel_fdp_topdata_s1 = rdc_topdata_s1;
|
| 132 |
|
|
|
| 133 |
|
|
// mux for asi data, not critical
|
| 134 |
|
|
dp_mux4ds #(34) asid_mx(.dout (erb_asidata_s[33:0]),
|
| 135 |
|
|
.in0 (icd_wsel_fetdata_s1[33:0]),
|
| 136 |
|
|
.in1 (icd_wsel_fetdata_s1[67:34]),
|
| 137 |
|
|
.in2 (icd_wsel_fetdata_s1[101:68]),
|
| 138 |
|
|
.in3 (icd_wsel_fetdata_s1[135:102]),
|
| 139 |
|
|
.sel0_l (dec_asiway_s_l[0]),
|
| 140 |
|
|
.sel1_l (dec_asiway_s_l[1]),
|
| 141 |
|
|
.sel2_l (dec_asiway_s_l[2]),
|
| 142 |
|
|
.sel3_l (dec_asiway_s_l[3]));
|
| 143 |
|
|
|
| 144 |
|
|
dp_mux4ds #(34) asitop_mx(.dout (asi_topdata_s[33:0]),
|
| 145 |
|
|
.in0 (icd_wsel_topdata_s1[33:0]),
|
| 146 |
|
|
.in1 (icd_wsel_topdata_s1[67:34]),
|
| 147 |
|
|
.in2 (icd_wsel_topdata_s1[101:68]),
|
| 148 |
|
|
.in3 (icd_wsel_topdata_s1[135:102]),
|
| 149 |
|
|
.sel0_l (dec_asiway_s_l[0]),
|
| 150 |
|
|
.sel1_l (dec_asiway_s_l[1]),
|
| 151 |
|
|
.sel2_l (dec_asiway_s_l[2]),
|
| 152 |
|
|
.sel3_l (dec_asiway_s_l[3]));
|
| 153 |
|
|
|
| 154 |
|
|
// buffer before sending to bist/errdp
|
| 155 |
|
|
assign wsel_mbist_icache_data = {asi_topdata_s[33:32],
|
| 156 |
|
|
erb_asidata_s[33:32],
|
| 157 |
|
|
asi_topdata_s[31:0],
|
| 158 |
|
|
erb_asidata_s[31:0]};
|
| 159 |
|
|
|
| 160 |
|
|
// Everything below can be ignored for physical implementation
|
| 161 |
|
|
// monitor for waysel -- moved here from itlb
|
| 162 |
|
|
// Keeping this around for 0-in. cmp level check is in icache_mutex_mon.v
|
| 163 |
|
|
|
| 164 |
113 |
albert.wat |
`ifdef DEFINE_0IN
|
| 165 |
|
|
always @ (negedge clk)
|
| 166 |
|
|
begin
|
| 167 |
|
|
if (!((waysel_buf_s1 == 4'b0001) ||
|
| 168 |
|
|
(waysel_buf_s1 == 4'b0010) ||
|
| 169 |
|
|
(waysel_buf_s1 == 4'b0100) ||
|
| 170 |
|
|
(waysel_buf_s1 == 4'b1000) ||
|
| 171 |
|
|
(waysel_buf_s1 == 4'b0000)))
|
| 172 |
|
|
begin
|
| 173 |
|
|
// 0in <fire -message "FATAL ERROR: icache waysel not mutex"
|
| 174 |
|
|
//$error("IC_WAYSEL", "FATAL ERROR: icache waysel not mutex %b",
|
| 175 |
|
|
// waysel_buf_s1);
|
| 176 |
|
|
end
|
| 177 |
|
|
end // always @ (negedge clk)
|
| 178 |
|
|
`endif
|
| 179 |
95 |
fafa1971 |
|
| 180 |
|
|
endmodule // sparc_ifu_wseldp
|
| 181 |
|
|
|