// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: dec_ded_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 icdf_perr_f_scanout;
input tcu_pce_ov; // scan signals
input tlu_cerer_icdp; // enable for icdp perr (0 then mask it)
input del_test_sel_p; // mux selects for IRF read port rs3
input del_twocycle_std_p;
input del_twocycle_rs2_p;
input [4:0] del_test_addr_p; // address to read for exu test access
input [32:0] ifu_buf0_inst0; // instructions for each of the threads at p stage
input [32:0] ifu_buf0_inst1;
input [32:0] ifu_buf0_inst2;
input [32:0] ifu_buf0_inst3;
input [4:0] ifu_buf0_excp0; // exception info for each of the threads at p stage
input [4:0] ifu_buf0_excp1;
input [4:0] ifu_buf0_excp2;
input [4:0] ifu_buf0_excp3;
input del_noshift_d; // dont shift anything into decode0 stage
input [3:0] pku_raw_pick_p; // raw pick signals to ifu to mux pc addresses
input [3:0] pku_isrc_rs1_p; // has rs1 source
input [3:0] pku_isrc_rs2_p; // has rs2 source
input [3:0] pku_isrc_rd_p; // has rd source
input [3:0] exu_oddwin_b; // whether window for current thread is odd or not
output ded_oddwin_d; // window is odd for decode0
output [32:0] dec_inst_d;
output [4:0] dec_inst_rs1_p;
output [4:0] dec_inst_rs2_p;
output [4:0] dec_inst_rs3_p;
output dec_inst_rs1_vld_p;
output dec_inst_rs2_vld_p;
output dec_inst_rs3_vld_p;
output ded_perr_p; // inst parity error at p stage; to del to squash predecodes
output ded_ferr_p; // inst ifetch error at p stage; to del to squash predecodes
output ded_perr_d; // inst parity error at d stage; to dcd to squash main decode
output ded_ferr_d; // inst ifetch error at d stage; to dcd to squash main decode
output ded_legal_p; // illegal instruction at p stage
dec_ded_ctl_l1clkhdr_ctl_macro clkgen (
dec_ded_ctl_spare_ctl_macro__num_2 spares (
.scan_out(spares_scanout),
dec_ded_ctl_msff_ctl_macro__width_1 icdf_perr_f (
.scan_in(icdf_perr_f_scanin),
.scan_out(icdf_perr_f_scanout),
assign pce_ov = tcu_pce_ov;
// 0in value -var pku_raw_pick_p[3:0] -val 0 1 2 4 8
dec_ded_ctl_msff_ctl_macro__width_4 oddwinf (
.scan_in(oddwinf_scanin),
.scan_out(oddwinf_scanout),
// generate correct pointers for rd, rs1 and rs2 for each thread
assign xor0[2:0] = {ifu_buf0_inst0[29],ifu_buf0_inst0[18],ifu_buf0_inst0[4]} ^ ({3{oddwin[0]}} & {ifu_buf0_inst0[28],ifu_buf0_inst0[17],ifu_buf0_inst0[3]});
assign xor1[2:0] = {ifu_buf0_inst1[29],ifu_buf0_inst1[18],ifu_buf0_inst1[4]} ^ ({3{oddwin[1]}} & {ifu_buf0_inst1[28],ifu_buf0_inst1[17],ifu_buf0_inst1[3]});
assign xor2[2:0] = {ifu_buf0_inst2[29],ifu_buf0_inst2[18],ifu_buf0_inst2[4]} ^ ({3{oddwin[2]}} & {ifu_buf0_inst2[28],ifu_buf0_inst2[17],ifu_buf0_inst2[3]});
assign xor3[2:0] = {ifu_buf0_inst3[29],ifu_buf0_inst3[18],ifu_buf0_inst3[4]} ^ ({3{oddwin[3]}} & {ifu_buf0_inst3[28],ifu_buf0_inst3[17],ifu_buf0_inst3[3]});
assign window_in[3:0] = ({4{del_noshift_d}} & {ded_oddwin_d,xor_d[2:0]}) |
({4{~del_noshift_d & pku_raw_pick_p[0]}} & {oddwin[0],xor0[2:0]}) |
({4{~del_noshift_d & pku_raw_pick_p[1]}} & {oddwin[1],xor1[2:0]}) |
({4{~del_noshift_d & pku_raw_pick_p[2]}} & {oddwin[2],xor2[2:0]}) |
({4{~del_noshift_d & pku_raw_pick_p[3]}} & {oddwin[3],xor3[2:0]});
dec_ded_ctl_msff_ctl_macro__width_4 windowf (
.scan_in(windowf_scanin),
.scan_out(windowf_scanout),
.dout({ded_oddwin_d,xor_d[2:0]}),
// twocycle operations use the rs3 port to the irf for the second read operation
dec_ded_ctl_msff_ctl_macro__width_9 twocyclef (
.scan_in(twocyclef_scanin),
.scan_out(twocyclef_scanout),
.din({dec_inst_rs2_p[4:0],dec_inst_rs3_p[4:1]}),
.dout({inst_rs2_d[4:0],inst_rs3_d[4:1]}),
assign {dec_inst_rs3_vld_p,dec_inst_rs3_p[4:0]} = ({6{del_test_sel_p}} & {1'b1,del_test_addr_p[4:0]}) |
({6{del_twocycle_std_p}} & {1'b1,inst_rs3_d[4:1],1'b1}) |
({6{del_twocycle_rs2_p}} & {1'b1,inst_rs2_d[4:0]}) |
({6{del_default_sel_p}} & {isrc_in[2],window_in[2],decode_mux[28:25]});
assign dec_inst_rs1_vld_p = isrc_in[1];
assign dec_inst_rs2_vld_p = isrc_in[0];
assign dec_inst_rs1_p[4:0] = {window_in[1],decode_mux[17:14]};
assign dec_inst_rs2_p[4:0] = {window_in[0],decode_mux[3:0]};
assign isrc0_in[2:0] = { pku_isrc_rd_p[0],pku_isrc_rs1_p[0],pku_isrc_rs2_p[0] };
assign isrc1_in[2:0] = { pku_isrc_rd_p[1],pku_isrc_rs1_p[1],pku_isrc_rs2_p[1] };
assign isrc2_in[2:0] = { pku_isrc_rd_p[2],pku_isrc_rs1_p[2],pku_isrc_rs2_p[2] };
assign isrc3_in[2:0] = { pku_isrc_rd_p[3],pku_isrc_rs1_p[3],pku_isrc_rs2_p[3] };
assign isrc_in[2:0] = ({3{del_noshift_d}} & isrc_d[2:0]) |
({3{~del_noshift_d & pku_raw_pick_p[0]}} & isrc0_in[2:0]) |
({3{~del_noshift_d & pku_raw_pick_p[1]}} & isrc1_in[2:0]) |
({3{~del_noshift_d & pku_raw_pick_p[2]}} & isrc2_in[2:0]) |
({3{~del_noshift_d & pku_raw_pick_p[3]}} & isrc3_in[2:0]);
dec_ded_ctl_msff_ctl_macro__width_3 isrcf (
.scan_out(isrcf_scanout),
assign exc_in[4:0] = ({5{del_noshift_d}} & ded_exc_d[4:0]) |
({5{~del_noshift_d & pku_raw_pick_p[0]}} & ifu_buf0_excp0[4:0]) |
({5{~del_noshift_d & pku_raw_pick_p[1]}} & ifu_buf0_excp1[4:0]) |
({5{~del_noshift_d & pku_raw_pick_p[2]}} & ifu_buf0_excp2[4:0]) |
({5{~del_noshift_d & pku_raw_pick_p[3]}} & ifu_buf0_excp3[4:0]);
dec_ded_ctl_msff_ctl_macro__width_5 excf (
assign decode_mux[32:0] = ({33{del_noshift_d}} & dec_inst_d[32:0]) |
({33{~del_noshift_d & pku_raw_pick_p[0]}} & ifu_buf0_inst0[32:0]) |
({33{~del_noshift_d & pku_raw_pick_p[1]}} & ifu_buf0_inst1[32:0]) |
({33{~del_noshift_d & pku_raw_pick_p[2]}} & ifu_buf0_inst2[32:0]) |
({33{~del_noshift_d & pku_raw_pick_p[3]}} & ifu_buf0_inst3[32:0]);
dec_ded_ctl_msff_ctl_macro__width_33 decodef (
.scan_in(decodef_scanin),
.scan_out(decodef_scanout),
// its only a parity error if its enabled
assign ded_perr_p = ( del_noshift_d & ded_perr_d) |
(~del_noshift_d & pku_raw_pick_p[0] & icdp_perr_en & (ifu_buf0_inst0[32] ^ (^ifu_buf0_inst0[31:0]))) |
(~del_noshift_d & pku_raw_pick_p[1] & icdp_perr_en & (ifu_buf0_inst1[32] ^ (^ifu_buf0_inst1[31:0]))) |
(~del_noshift_d & pku_raw_pick_p[2] & icdp_perr_en & (ifu_buf0_inst2[32] ^ (^ifu_buf0_inst2[31:0]))) |
(~del_noshift_d & pku_raw_pick_p[3] & icdp_perr_en & (ifu_buf0_inst3[32] ^ (^ifu_buf0_inst3[31:0])));
dec_ded_ctl_msff_ctl_macro__width_1 parityerrf (
.scan_in(parityerrf_scanin),
.scan_out(parityerrf_scanout),
assign ifetch_err_p[0] = (ifu_buf0_excp0[4:0] == 5'b00001) |
(ifu_buf0_excp0[4:0] == 5'b00010) |
(ifu_buf0_excp0[4:0] == 5'b00011) |
(ifu_buf0_excp0[4:0] == 5'b00100) |
(ifu_buf0_excp0[4:0] == 5'b00111) |
(ifu_buf0_excp0[4:0] == 5'b11111) |
(ifu_buf0_excp0[4:0] == 5'b01001) |
(ifu_buf0_excp0[4:0] == 5'b01010) |
(ifu_buf0_excp0[4:0] == 5'b01011) |
(ifu_buf0_excp0[4:0] == 5'b01100) |
(ifu_buf0_excp0[4:0] == 5'b01101) |
(ifu_buf0_excp0[4:0] == 5'b01111) |
(ifu_buf0_excp0[4:0] == 5'b10000) |
(ifu_buf0_excp0[4:0] == 5'b10001) |
(ifu_buf0_excp0[4:0] == 5'b10011) |
(ifu_buf0_excp0[4:0] == 5'b10111) |
(ifu_buf0_excp0[4:0] == 5'b11000);
assign ifetch_err_p[1] = (ifu_buf0_excp1[4:0] == 5'b00001) |
(ifu_buf0_excp1[4:0] == 5'b00010) |
(ifu_buf0_excp1[4:0] == 5'b00011) |
(ifu_buf0_excp1[4:0] == 5'b00100) |
(ifu_buf0_excp1[4:0] == 5'b00111) |
(ifu_buf0_excp1[4:0] == 5'b11111) |
(ifu_buf0_excp1[4:0] == 5'b01001) |
(ifu_buf0_excp1[4:0] == 5'b01010) |
(ifu_buf0_excp1[4:0] == 5'b01011) |
(ifu_buf0_excp1[4:0] == 5'b01100) |
(ifu_buf0_excp1[4:0] == 5'b01101) |
(ifu_buf0_excp1[4:0] == 5'b01111) |
(ifu_buf0_excp1[4:0] == 5'b10000) |
(ifu_buf0_excp1[4:0] == 5'b10001) |
(ifu_buf0_excp1[4:0] == 5'b10011) |
(ifu_buf0_excp1[4:0] == 5'b10111) |
(ifu_buf0_excp1[4:0] == 5'b11000);
assign ifetch_err_p[2] = (ifu_buf0_excp2[4:0] == 5'b00001) |
(ifu_buf0_excp2[4:0] == 5'b00010) |
(ifu_buf0_excp2[4:0] == 5'b00011) |
(ifu_buf0_excp2[4:0] == 5'b00100) |
(ifu_buf0_excp2[4:0] == 5'b00111) |
(ifu_buf0_excp2[4:0] == 5'b11111) |
(ifu_buf0_excp2[4:0] == 5'b01001) |
(ifu_buf0_excp2[4:0] == 5'b01010) |
(ifu_buf0_excp2[4:0] == 5'b01011) |
(ifu_buf0_excp2[4:0] == 5'b01100) |
(ifu_buf0_excp2[4:0] == 5'b01101) |
(ifu_buf0_excp2[4:0] == 5'b01111) |
(ifu_buf0_excp2[4:0] == 5'b10000) |
(ifu_buf0_excp2[4:0] == 5'b10001) |
(ifu_buf0_excp2[4:0] == 5'b10011) |
(ifu_buf0_excp2[4:0] == 5'b10111) |
(ifu_buf0_excp2[4:0] == 5'b11000);
assign ifetch_err_p[3] = (ifu_buf0_excp3[4:0] == 5'b00001) |
(ifu_buf0_excp3[4:0] == 5'b00010) |
(ifu_buf0_excp3[4:0] == 5'b00011) |
(ifu_buf0_excp3[4:0] == 5'b00100) |
(ifu_buf0_excp3[4:0] == 5'b00111) |
(ifu_buf0_excp3[4:0] == 5'b11111) |
(ifu_buf0_excp3[4:0] == 5'b01001) |
(ifu_buf0_excp3[4:0] == 5'b01010) |
(ifu_buf0_excp3[4:0] == 5'b01011) |
(ifu_buf0_excp3[4:0] == 5'b01100) |
(ifu_buf0_excp3[4:0] == 5'b01101) |
(ifu_buf0_excp3[4:0] == 5'b01111) |
(ifu_buf0_excp3[4:0] == 5'b10000) |
(ifu_buf0_excp3[4:0] == 5'b10001) |
(ifu_buf0_excp3[4:0] == 5'b10011) |
(ifu_buf0_excp3[4:0] == 5'b10111) |
(ifu_buf0_excp3[4:0] == 5'b11000);
assign ded_ferr_p = ( del_noshift_d & ded_ferr_d) |
(~del_noshift_d & pku_raw_pick_p[0] & ifetch_err_p[0]) |
(~del_noshift_d & pku_raw_pick_p[1] & ifetch_err_p[1] ) |
(~del_noshift_d & pku_raw_pick_p[2] & ifetch_err_p[2] ) |
(~del_noshift_d & pku_raw_pick_p[3] & ifetch_err_p[3] );
dec_ded_ctl_msff_ctl_macro__width_1 ifetcherrf (
.scan_in(ifetcherrf_scanin),
.scan_out(ifetcherrf_scanout),
assign illegal0_p = ~ifu_buf0_inst0[31] & ~ifu_buf0_inst0[30] & ~ifu_buf0_inst0[24] & ~ifu_buf0_inst0[23] & ~ifu_buf0_inst0[22];
assign illegal1_p = ~ifu_buf0_inst1[31] & ~ifu_buf0_inst1[30] & ~ifu_buf0_inst1[24] & ~ifu_buf0_inst1[23] & ~ifu_buf0_inst1[22];
assign illegal2_p = ~ifu_buf0_inst2[31] & ~ifu_buf0_inst2[30] & ~ifu_buf0_inst2[24] & ~ifu_buf0_inst2[23] & ~ifu_buf0_inst2[22];
assign illegal3_p = ~ifu_buf0_inst3[31] & ~ifu_buf0_inst3[30] & ~ifu_buf0_inst3[24] & ~ifu_buf0_inst3[23] & ~ifu_buf0_inst3[22];
assign ded_legal_p = ( del_noshift_d & legal_d) |
(~del_noshift_d & pku_raw_pick_p[0] & ~illegal0_p) |
(~del_noshift_d & pku_raw_pick_p[1] & ~illegal1_p) |
(~del_noshift_d & pku_raw_pick_p[2] & ~illegal2_p) |
(~del_noshift_d & pku_raw_pick_p[3] & ~illegal3_p);
dec_ded_ctl_msff_ctl_macro__width_1 legalf (
.scan_out(legalf_scanout),
assign spares_scanin = scan_in ;
assign icdf_perr_f_scanin = spares_scanout ;
assign oddwinf_scanin = icdf_perr_f_scanout ;
assign windowf_scanin = oddwinf_scanout ;
assign twocyclef_scanin = windowf_scanout ;
assign isrcf_scanin = twocyclef_scanout ;
assign excf_scanin = isrcf_scanout ;
assign decodef_scanin = excf_scanout ;
assign parityerrf_scanin = decodef_scanout ;
assign ifetcherrf_scanin = parityerrf_scanout ;
assign legalf_scanin = ifetcherrf_scanout ;
assign scan_out = legalf_scanout ;
// any PARAMS parms go into naming of macro
module dec_ded_ctl_l1clkhdr_ctl_macro (
// 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 dec_ded_ctl_spare_ctl_macro__num_2 (
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;
wire spare1_buf_32x_unused;
wire spare1_nand3_8x_unused;
wire spare1_inv_8x_unused;
wire spare1_aoi22_4x_unused;
wire spare1_buf_8x_unused;
wire spare1_oai22_4x_unused;
wire spare1_inv_16x_unused;
wire spare1_nand2_16x_unused;
wire spare1_nor3_4x_unused;
wire spare1_nand2_8x_unused;
wire spare1_buf_16x_unused;
wire spare1_nor2_16x_unused;
wire spare1_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));
cl_sc1_msff_8x spare1_flop (.l1clk(l1clk),
cl_u1_buf_32x spare1_buf_32x (.in(1'b1),
.out(spare1_buf_32x_unused));
cl_u1_nand3_8x spare1_nand3_8x (.in0(1'b1),
.out(spare1_nand3_8x_unused));
cl_u1_inv_8x spare1_inv_8x (.in(1'b1),
.out(spare1_inv_8x_unused));
cl_u1_aoi22_4x spare1_aoi22_4x (.in00(1'b1),
.out(spare1_aoi22_4x_unused));
cl_u1_buf_8x spare1_buf_8x (.in(1'b1),
.out(spare1_buf_8x_unused));
cl_u1_oai22_4x spare1_oai22_4x (.in00(1'b1),
.out(spare1_oai22_4x_unused));
cl_u1_inv_16x spare1_inv_16x (.in(1'b1),
.out(spare1_inv_16x_unused));
cl_u1_nand2_16x spare1_nand2_16x (.in0(1'b1),
.out(spare1_nand2_16x_unused));
cl_u1_nor3_4x spare1_nor3_4x (.in0(1'b0),
.out(spare1_nor3_4x_unused));
cl_u1_nand2_8x spare1_nand2_8x (.in0(1'b1),
.out(spare1_nand2_8x_unused));
cl_u1_buf_16x spare1_buf_16x (.in(1'b1),
.out(spare1_buf_16x_unused));
cl_u1_nor2_16x spare1_nor2_16x (.in0(1'b0),
.out(spare1_nor2_16x_unused));
cl_u1_inv_32x spare1_inv_32x (.in(1'b1),
.out(spare1_inv_32x_unused));
// any PARAMS parms go into naming of macro
module dec_ded_ctl_msff_ctl_macro__width_1 (
assign fdin[0:0] = din[0:0];
// any PARAMS parms go into naming of macro
module dec_ded_ctl_msff_ctl_macro__width_4 (
assign fdin[3:0] = din[3:0];
// any PARAMS parms go into naming of macro
module dec_ded_ctl_msff_ctl_macro__width_9 (
assign fdin[8:0] = din[8:0];
// any PARAMS parms go into naming of macro
module dec_ded_ctl_msff_ctl_macro__width_3 (
assign fdin[2:0] = din[2:0];
// any PARAMS parms go into naming of macro
module dec_ded_ctl_msff_ctl_macro__width_5 (
assign fdin[4:0] = din[4:0];
// any PARAMS parms go into naming of macro
module dec_ded_ctl_msff_ctl_macro__width_33 (
assign fdin[32:0] = din[32:0];
.so({so[31:0],scan_out}),