// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: lsu_tgc_ctl.v
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
wire dff_way_vld_scanout;
wire [8:5] local_bist_addr_1;
wire dff_bist_fail_scanin;
wire dff_bist_fail_scanout;
wire [7:0] wdata_or_addr;
input [15:0] dva_valid_m;
input [15:0] dva_valid2_m; // redundant copies
input [12:11] lsu_va_b12to11_m;
input [10:6] exu_lsu_address_e;
output [3:0] tgc_cache_way_vld_m;
output [3:0] tgc_cache_way_vld2_m;
output [1:0] tgc_way_sel_m;
output [10:6] tgc_dva_rd_addr_e;
output [31:0] tgc_dva_din;
input [1:0] mbi_cmpsel; // encoded
output [7:0] bist_wdata_1;
output [7:0] bist_cmp_data;
output [1:0] bist_cmpsel_1;
output [8:5] bist_addr_1;
input tcu_pce_ov; // scan signals
assign pce_ov = tcu_pce_ov;
//////////////////////////////
//////////////////////////////
// Enable flops only when load is in M or during bist
assign ld_vld_m_clken = dcc_ld_inst_vld_m | mbi_run | tgc_mbi_run | ~lsu_lsu_pmen;
lsu_tgc_ctl_l1clkhdr_ctl_macro clkgen0 (
//////////////////////////////
assign tgc_cache_way_vld_m[3:0] = ({4{(lsu_va_m[5:4] == 2'b00)}} & dva_valid_m[3:0]) |
({4{(lsu_va_m[5:4] == 2'b01)}} & dva_valid_m[7:4]) |
({4{(lsu_va_m[5:4] == 2'b10)}} & dva_valid_m[11:8]) |
({4{(lsu_va_m[5:4] == 2'b11)}} & dva_valid_m[15:12]);
assign tgc_cache_way_vld2_m[3:0] = ({4{(lsu_va_m[5:4] == 2'b00)}} & dva_valid2_m[3:0]) |
({4{(lsu_va_m[5:4] == 2'b01)}} & dva_valid2_m[7:4]) |
({4{(lsu_va_m[5:4] == 2'b10)}} & dva_valid2_m[11:8]) |
({4{(lsu_va_m[5:4] == 2'b11)}} & dva_valid2_m[15:12]);
// Valid bit error detection
assign verr_m[0] = tgc_cache_way_vld_m[0] ^ tgc_cache_way_vld2_m[0];
assign verr_m[1] = tgc_cache_way_vld_m[1] ^ tgc_cache_way_vld2_m[1];
assign verr_m[2] = tgc_cache_way_vld_m[2] ^ tgc_cache_way_vld2_m[2];
assign verr_m[3] = tgc_cache_way_vld_m[3] ^ tgc_cache_way_vld2_m[3];
lsu_tgc_ctl_msff_ctl_macro__width_4 dff_way_vld (
.scan_in(dff_way_vld_scanin),
.scan_out(dff_way_vld_scanout),
assign tgc_dva_din[31:0] = tgc_mbi_run ? {4{mbi_wdata[7:0]}} : {{16{dcc_dva_din2_e}},{16{dcc_dva_din_e}}};
// This is the tag way select used for diagnostic and bist reads
assign tgc_way_sel_m[1:0] = tgc_mbi_run ? local_bist_addr_1[8:7] : lsu_va_b12to11_m[12:11];
assign dva_fail = bist_dva_cmp_en & ({dva_valid_m[15:0],dva_valid2_m[15:0]} != {4{bist_wdata_1[7:0]}});
assign dta_fail = bist_dta_cmp_en & ~tgd_bist_compare;
assign dtb_fail = bist_dtb_cmp_en & ~tgd_bist_compare & ~mbi_cambist_run;
lsu_tgc_ctl_msff_ctl_macro__width_3 dff_bist_fail (
.scan_in(dff_bist_fail_scanin),
.scan_out(dff_bist_fail_scanout),
.din ({dta_fail, dtb_fail, dva_fail}),
.dout ({lsu_mbi_dta_fail,lsu_mbi_dtb_fail,lsu_mbi_dva_fail}),
// Address muxing for DVA array
assign tgc_dva_rd_addr_e[10:6] = tgc_mbi_run ? mbi_addr[4:0] : exu_lsu_address_e[10:6];
////////////////////////////////////////////////////////////////////////////////
// Flops for bist signals
assign wdata_or_addr[7:0] = mbi_cambist_run ? mbi_addr[7:0] : mbi_wdata[7:0];
lsu_tgc_ctl_msff_ctl_macro__width_38 dff_bist (
.scan_in(dff_bist_scanin),
.scan_out(dff_bist_scanout),
mbi_dta_read_en, bist_dta_rd_1,
mbi_dtb_read_en, dtb_read_en,
bist_dtb_rd_1, mbi_dva_read_en,
wdata_or_addr[7:0], bist_wdata_1[7:0],
mbi_cmpsel[1:0], bist_cmpsel_1[0],
mbi_addr[8:5], cmp_data_in[7:0]
bist_dta_rd_1, bist_dta_rd_2,
dtb_read_en, bist_dtb_rd_1,
bist_dtb_rd_2, bist_dva_cmp_en,
bist_wdata_1[7:0], bist_wdata_2[7:0],
bist_cmpsel_1[1:0], bist_cmpsel_2,
local_bist_addr_1[8:5],bist_cmp_data[7:0]
assign cmp_data_in[7:0] = bist_dtb_rd_1 ? bist_wdata_2[7:0] : bist_wdata_1[7:0];
assign bist_addr_1[8:5] = local_bist_addr_1[8:5];
assign bist_dta_cmp_en = bist_dta_rd_2;
assign bist_dtb_cmp_en = bist_dtb_rd_2;
lsu_tgc_ctl_spare_ctl_macro__num_1 spares (
.scan_out(spares_scanout),
assign dff_way_vld_scanin = scan_in ;
assign dff_bist_fail_scanin = dff_way_vld_scanout ;
assign dff_bist_scanin = dff_bist_fail_scanout ;
assign spares_scanin = dff_bist_scanout ;
assign scan_out = spares_scanout ;
// any PARAMS parms go into naming of macro
module lsu_tgc_ctl_l1clkhdr_ctl_macro (
// any PARAMS parms go into naming of macro
module lsu_tgc_ctl_msff_ctl_macro__width_4 (
assign fdin[3:0] = din[3:0];
// any PARAMS parms go into naming of macro
module lsu_tgc_ctl_msff_ctl_macro__width_3 (
assign fdin[2:0] = din[2:0];
// any PARAMS parms go into naming of macro
module lsu_tgc_ctl_msff_ctl_macro__width_38 (
assign fdin[37:0] = din[37:0];
.so({so[36:0],scan_out}),
// Description: Spare gate macro for control blocks
// Param num controls the number of times the macro is added
// flops=0 can be used to use only combination spare logic
module lsu_tgc_ctl_spare_ctl_macro__num_1 (
wire spare0_buf_32x_unused;
wire spare0_nand3_8x_unused;
wire spare0_inv_8x_unused;
wire spare0_aoi22_4x_unused;
wire spare0_buf_8x_unused;
wire spare0_oai22_4x_unused;
wire spare0_inv_16x_unused;
wire spare0_nand2_16x_unused;
wire spare0_nor3_4x_unused;
wire spare0_nand2_8x_unused;
wire spare0_buf_16x_unused;
wire spare0_nor2_16x_unused;
wire spare0_inv_32x_unused;
cl_sc1_msff_8x spare0_flop (.l1clk(l1clk),
cl_u1_buf_32x spare0_buf_32x (.in(1'b1),
.out(spare0_buf_32x_unused));
cl_u1_nand3_8x spare0_nand3_8x (.in0(1'b1),
.out(spare0_nand3_8x_unused));
cl_u1_inv_8x spare0_inv_8x (.in(1'b1),
.out(spare0_inv_8x_unused));
cl_u1_aoi22_4x spare0_aoi22_4x (.in00(1'b1),
.out(spare0_aoi22_4x_unused));
cl_u1_buf_8x spare0_buf_8x (.in(1'b1),
.out(spare0_buf_8x_unused));
cl_u1_oai22_4x spare0_oai22_4x (.in00(1'b1),
.out(spare0_oai22_4x_unused));
cl_u1_inv_16x spare0_inv_16x (.in(1'b1),
.out(spare0_inv_16x_unused));
cl_u1_nand2_16x spare0_nand2_16x (.in0(1'b1),
.out(spare0_nand2_16x_unused));
cl_u1_nor3_4x spare0_nor3_4x (.in0(1'b0),
.out(spare0_nor3_4x_unused));
cl_u1_nand2_8x spare0_nand2_8x (.in0(1'b1),
.out(spare0_nand2_8x_unused));
cl_u1_buf_16x spare0_buf_16x (.in(1'b1),
.out(spare0_buf_16x_unused));
cl_u1_nor2_16x spare0_nor2_16x (.in0(1'b0),
.out(spare0_nor2_16x_unused));
cl_u1_inv_32x spare0_inv_32x (.in(1'b1),
.out(spare0_inv_32x_unused));