// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: l2b_mb0_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 array_usr_reg_scanin;
wire array_usr_reg_scanout;
wire [3:0] user_array_sel_in;
wire [3:0] user_array_sel;
wire user_addr_mode_reg_scanin;
wire user_addr_mode_reg_scanout;
wire user_start_addr_reg_scanin;
wire user_start_addr_reg_scanout;
wire [2:0] user_start_addr_in;
wire [2:0] user_start_addr;
wire user_stop_addr_reg_scanin;
wire user_stop_addr_reg_scanout;
wire [2:0] user_stop_addr_in;
wire [2:0] user_stop_addr;
wire user_incr_addr_reg_scanin;
wire user_incr_addr_reg_scanout;
wire [2:0] user_incr_addr_in;
wire [2:0] user_incr_addr;
wire user_data_mode_reg_scanin;
wire user_data_mode_reg_scanout;
wire user_data_reg_scanin;
wire user_data_reg_scanout;
wire user_cmpsel_hold_reg_scanin;
wire user_cmpsel_hold_reg_scanout;
wire user_cmpsel_hold_in;
wire user_cmpsel_reg_scanin;
wire user_cmpsel_reg_scanout;
wire [3:0] user_cmpsel_in;
wire user_loop_mode_reg_scanin;
wire user_loop_mode_reg_scanout;
wire ten_n_mode_reg_scanin;
wire ten_n_mode_reg_scanout;
wire input_signals_reg_scanin;
wire input_signals_reg_scanout;
wire loop_again_reg_scanin;
wire loop_again_reg_scanout;
wire mbist_misc_output_reg_scanin;
wire mbist_misc_output_reg_scanout;
wire [15:0] fb_mux_sel_unreg;
wire [15:0] fb_mux_sel_unreg2;
wire [15:0] fb_mux_sel_unreg3;
wire sel_nextaddr_restart;
wire sel_nextaddr_incred;
wire mb_user_bisi_rw_mode;
wire [3:0] cntl_array_sel;
wire [1:0] cntl_data_sel;
wire [3:0] cntl_march_element;
wire [3:0] march_element_pre;
wire [3:0] march_element;
wire [3:0] array_sel_cntl_out;
wire array_sel_reg_scanin;
wire array_sel_reg_scanout;
wire [3:0] array_sel_out;
wire [3:0] cmp_sel_cntl_out;
wire cmp_sel_reg_scanout;
wire mb_user_cmpsel_hold;
wire [3:0] march_element_cntl_out;
wire marche_element_reg_scanin;
wire marche_element_reg_scanout;
wire [3:0] march_element_out;
wire mb_user_bisi_wr_mode;
wire mb_user_bisi_rd_mode;
wire user_bisi_wr_mode_reg_scanin;
wire user_bisi_wr_mode_reg_scanout;
wire user_bisi_wr_mode_in;
wire user_bisi_rd_mode_reg_scanin;
wire user_bisi_rd_mode_reg_scanout;
wire user_bisi_rd_mode_in;
wire [7:0] mb_write_data;
wire run3_transition_reg_scanin;
wire run3_transition_reg_scanout;
wire done_delay_reg_scanin;
wire done_delay_reg_scanout;
wire [4:0] done_delay_in;
wire mbist_fail_input_reg_scanin;
wire mbist_fail_input_reg_scanout;
wire out_mb_tcu_done_reg_scanin;
wire out_mb_tcu_done_reg_scanout;
wire out_mb_tcu_fail_reg_scanin;
wire out_mb_tcu_fail_reg_scanout;
wire out_cmp_sel_reg_scanin;
wire out_cmp_sel_reg_scanout;
wire [4:0] mb_cmpsel_out;
wire out_run_mb_arrays_reg_scanin;
wire out_run_mb_arrays_reg_scanout;
wire out_data_mb_arrays_delay1_reg_scanin;
wire out_data_mb_arrays_delay1_reg_scanout;
wire [7:0] mb_write_data_delay_out;
wire out_data_mb_arrays_delay2_reg_scanin;
wire out_data_mb_arrays_delay2_reg_scanout;
wire [7:0] mb_write_data_out;
wire out_data_mb_arrays_delay3_reg_scanin;
wire out_data_mb_arrays_delay3_reg_scanout;
wire [7:0] mb_write_data_out_d1;
wire out_addr_mb_arrays_reg_scanin;
wire out_addr_mb_arrays_reg_scanout;
wire out_wr_mb_arrays_reg_scanin;
wire out_wr_mb_arrays_reg_scanout;
wire out_rd_mb_arrays_reg_scanin;
wire out_rd_mb_arrays_reg_scanout;
wire [7:0] mbist_compare_read_sel_r;
// Please note that this is going to be used as a place holder.
// The inputs and outputs are defined based on the analysis of cluster memories.
// There are 16 instances of 16*160 rf arrays, where 156 bits of each is
// functionally used. The inputs of these memories are flopped and the outputs
// The plan is to test in this sequential order:
// The mbist will exercise the 4 arrays, 78 bits at a time.
// Functionally, the wb_array and rdma_array outputs get muxed into 78 bits
// and then get flopped. Mbist takes those 78 bits and compare.
// For fb_array, for now, the plan is to take the 624 bits to mbist controller
// and mux them down to 78 bits and then flop them. and finally, use the same
// comparators as for 78 bits from wb/rdma arrays.
// Very IMPORTANT NOTE: Since there are 624 lines coming in, in order to reduce
// hardware cost due to input muxes, so that memory provides writing 0's or 1's for
// each bit, using two mbist related inputs to the memories:
// mbist_run: indicating the memory bist and
// mbist_data0_or1: If 0, during mbist, holding a 0 at the memory inputs,
// If 1, during mbist, holding a 1 at the memory inputs.
// Then the write is decided based on mbist_byte_en and mbist_word_en bits.
// 06/10/05: (rdma,fb,wb)*_mbist_enable is disable when not in membist mode
// 06/10/05: added address mix logic
// 10/03/05: fb data needs to be 2 cycles compared to wr_en
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
output mbist_wb_array_wr_en;
output mbist_wb_array_rd_en;
output mbist_rdma_array_wr_en;
output mbist_rdma_array_rd_en;
output mbist_fb_array_rd_en;
output mbist_fb_array_wr_en;
///output [15:0] mbist_sel_78bits; // picks 1/16 of 623 bits
output mbist_sel_wb_arrays; // sel=1 for wb and sel=0 for rdma
output [4:0] mbist_cmpsel; // Encoded mux select for wb/rdma array 1/16
output [2:0] mbist_compare_read_sel; // One hot mux select for wb/rdma array compare data
output [15:0] fb_mux_sel; // picks 1/16 of 623 bits
input wb_or_rdma_rw_fail; // fb compare output
input fb_rw_fail; // fb compare output
//////////////////////////////////////////////////////////////////
//There are 3 different of arrays in l2b.filbuf, writeback buffer
//The following signals go to array directly.
//These are flopped inside the array.
//The enables are used as mux select to pick between functional
//////////////////////////////////////////////////////////////////
output rdma_mbist_enable;
output [7:0] rdma_mbist_data_in;
output [7:0] fb_mbist_data_in;
output [7:0] wb_mbist_data_in;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
input tcu_pce_ov; // scan signals
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
assign pce_ov = tcu_pce_ov;
assign stop = tcu_clk_stop;
////////////////////////////////////////////////////////////////////////////////
l2b_mb0_ctl_l1clkhdr_ctl_macro clkgen_freeclk (
assign clock_enable = start_in | mbist_done | mbist_run | mbist_fail ;
l2b_mb0_ctl_l1clkhdr_ctl_macro clkgen (
// /////////////////////////////////////////////////////////////////////////////
// MBIST PGM Control Register
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// user control registers
l2b_mb0_ctl_msff_ctl_macro__width_4 array_usr_reg (
.scan_in(array_usr_reg_scanin),
.scan_out(array_usr_reg_scanout),
.din ( user_array_sel_in[3:0] ),
.dout ( user_array_sel[3:0] ),
assign user_array_sel_in[3:0]=user_array_sel[3:0];
l2b_mb0_ctl_msff_ctl_macro__width_1 user_addr_mode_reg (
.scan_in(user_addr_mode_reg_scanin),
.scan_out(user_addr_mode_reg_scanout),
.din ( user_addr_mode_in ),
.dout ( user_addr_mode ),
assign user_addr_mode_in=user_addr_mode;
l2b_mb0_ctl_msff_ctl_macro__width_3 user_start_addr_reg (
.scan_in(user_start_addr_reg_scanin),
.scan_out(user_start_addr_reg_scanout),
.din ( user_start_addr_in[2:0] ),
.dout ( user_start_addr[2:0] ),
assign user_start_addr_in[2:0]=user_start_addr[2:0];
l2b_mb0_ctl_msff_ctl_macro__width_3 user_stop_addr_reg (
.scan_in(user_stop_addr_reg_scanin),
.scan_out(user_stop_addr_reg_scanout),
.din ( user_stop_addr_in[2:0] ),
.dout ( user_stop_addr[2:0] ),
assign user_stop_addr_in[2:0]=user_stop_addr[2:0];
// user increment address
l2b_mb0_ctl_msff_ctl_macro__width_3 user_incr_addr_reg (
.scan_in(user_incr_addr_reg_scanin),
.scan_out(user_incr_addr_reg_scanout),
.din ( user_incr_addr_in[2:0] ),
.dout ( user_incr_addr[2:0] ),
assign user_incr_addr_in[2:0]=user_incr_addr[2:0];
l2b_mb0_ctl_msff_ctl_macro__width_1 user_data_mode_reg (
.scan_in(user_data_mode_reg_scanin),
.scan_out(user_data_mode_reg_scanout),
.din ( user_data_mode_in ),
.dout ( user_data_mode ),
assign user_data_mode_in=user_data_mode;
l2b_mb0_ctl_msff_ctl_macro__width_8 user_data_reg (
.scan_in(user_data_reg_scanin),
.scan_out(user_data_reg_scanout),
.din ( user_data_in[7:0] ),
.dout ( user_data[7:0] ),
assign user_data_in[7:0] = user_data[7:0];
// if its one, user need to program the cmpselinc register
// otherwise it will loop all cmpsel
l2b_mb0_ctl_msff_ctl_macro__width_1 user_cmpsel_hold_reg (
.scan_in(user_cmpsel_hold_reg_scanin),
.scan_out(user_cmpsel_hold_reg_scanout),
.din ( user_cmpsel_hold_in ),
.dout ( user_cmpsel_hold ),
assign user_cmpsel_hold_in=user_cmpsel_hold;
l2b_mb0_ctl_msff_ctl_macro__width_4 user_cmpsel_reg (
.scan_in(user_cmpsel_reg_scanin),
.scan_out(user_cmpsel_reg_scanout),
.din ( user_cmpsel_in[3:0] ),
.dout ( user_cmpsel[3:0] ),
assign user_cmpsel_in[3:0]=user_cmpsel[3:0];
l2b_mb0_ctl_msff_ctl_macro__width_1 user_loop_mode_reg (
.scan_in(user_loop_mode_reg_scanin),
.scan_out(user_loop_mode_reg_scanout),
.din ( user_loop_mode_in ),
.dout ( user_loop_mode ),
assign user_loop_mode_in=user_loop_mode;
// 10N Algorithm for bit mapping
l2b_mb0_ctl_msff_ctl_macro__width_1 ten_n_mode_reg (
.scan_in(ten_n_mode_reg_scanin),
.scan_out(ten_n_mode_reg_scanout),
assign ten_n_mode_in=ten_n_mode;
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
// A low to high transition on mbist_start will reset and start the engine.
// mbist_start must remain active high for the duration of MBIST.
// If mbist_start deasserts the engine will stop but not reset.
// Once MBIST has completed mb0_done will assert and the fail status
// signals will be valid.
// To run MBIST again the mbist_start signal must transition low then high.
// Loop on Address will disable the address mix function.
// /////////////////////////////////////////////////////////////////////////////
// flop incoming signals:
l2b_mb0_ctl_msff_ctl_macro__width_3 input_signals_reg (
.scan_in(input_signals_reg_scanin),
.scan_out(input_signals_reg_scanout),
.din ( {mbist_start,mbist_bisi_mode,mbist_user_mode} ),
.dout ( {start,bisi_mode,user_mode} ),
// 3 cycle delay for the run signal
l2b_mb0_ctl_msff_ctl_macro__width_2 config_reg (
.scan_in(config_reg_scanin),
.scan_out(config_reg_scanout),
.dout ( config_out[1:0] ),
assign config_in[0] = start;
assign config_in[1] = config_out[0];
assign start_transition = config_out[0] & ~config_out[1];
assign end_transition = ~config_out[0] & config_out[1];
assign reset_engine = start_transition | loop_again | end_transition;
assign run = config_out[1] ;
l2b_mb0_ctl_msff_ctl_macro__width_1 loop_again_reg (
.scan_in(loop_again_reg_scanin),
.scan_out(loop_again_reg_scanout),
.dout ( stop_engine_l_q ),
assign loop_again=mb_user_loop_mode ? stop_engine_l & ~stop_engine_l_q: 1'b0;
///////////////////////////////////////////////
assign rdma_enable = array_1 & mb_run;
assign fb_enable = array_2 & mb_run;
assign wb_enable = array_0 & mb_run;
assign sel_wb_arrays=array_0;
assign cmp_sel_dec[0] = array_2 & (cmp_sel[3:0]==4'b0000);
assign cmp_sel_dec[1] = array_2 & (cmp_sel[3:0]==4'b0001);
assign cmp_sel_dec[2] = array_2 & (cmp_sel[3:0]==4'b0010);
assign cmp_sel_dec[3] = array_2 & (cmp_sel[3:0]==4'b0011);
assign cmp_sel_dec[4] = array_2 & (cmp_sel[3:0]==4'b0100);
assign cmp_sel_dec[5] = array_2 & (cmp_sel[3:0]==4'b0101);
assign cmp_sel_dec[6] = array_2 & (cmp_sel[3:0]==4'b0110);
assign cmp_sel_dec[7] = array_2 & (cmp_sel[3:0]==4'b0111);
assign cmp_sel_dec[8] = array_2 & (cmp_sel[3:0]==4'b1000);
assign cmp_sel_dec[9] = array_2 & (cmp_sel[3:0]==4'b1001);
assign cmp_sel_dec[10] = array_2 & (cmp_sel[3:0]==4'b1010);
assign cmp_sel_dec[11] = array_2 & (cmp_sel[3:0]==4'b1011);
assign cmp_sel_dec[12] = array_2 & (cmp_sel[3:0]==4'b1100);
assign cmp_sel_dec[13] = array_2 & (cmp_sel[3:0]==4'b1101);
assign cmp_sel_dec[14] = array_2 & (cmp_sel[3:0]==4'b1110);
assign cmp_sel_dec[15] = array_2 & (cmp_sel[3:0]==4'b1111);
l2b_mb0_ctl_msff_ctl_macro__width_73 mbist_misc_output_reg (
.scan_in(mbist_misc_output_reg_scanin),
.scan_out(mbist_misc_output_reg_scanout),
rdma_enable, rdma_enable_d1,
fb_enable, fb_enable_d1, fb_enable_d2,
wb_enable, wb_enable_d1, wb_enable_d2
fb_mux_sel[15:0], // staged 3 cycles instead of 2
rdma_enable_d1, rdma_mbist_enable, // requested to delay by one cycle
fb_enable_d1, fb_enable_d2, fb_mbist_enable,
wb_enable_d1, wb_enable_d2, wb_mbist_enable
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
l2b_mb0_ctl_msff_ctl_macro__width_36 cntl_reg (
.scan_in(cntl_reg_scanin),
.scan_out(cntl_reg_scanout),
.dout ( cntl_out[35:0] ),
assign cntl_in[35:19] = reset_engine ? {17'b000000_0000000000}:
// assign cntl_in[12:3] = reset_engine ? start_addr[7:0]:
// ~run3 ? cntl_addr[7:0]:
// reset_engine run3 overflow cout_rw output
// ---------------------------------------------------------
assign sel_nextaddr_reset = reset_engine;
assign sel_nextaddr_restart = ~reset_engine & run3 & overflow;
assign sel_nextaddr_incred = ~reset_engine & run3 & ~overflow & cout_rw;
assign sel_nextaddr_same = ~(sel_nextaddr_reset | sel_nextaddr_restart | sel_nextaddr_incred) ;
assign cntl_in[5:3] = ({3{sel_nextaddr_reset}} & start_addr[2:0]) |
({3{sel_nextaddr_restart}} & restart_addr[2:0]) |
({3{sel_nextaddr_incred}} & incred_addr[2:0]) |
({3{sel_nextaddr_same}} & cntl_addr[2:0]);
assign cntl_in[18:6] = 13'b0000000000000;
assign cntl_in[2:0] = reset_engine ? 3'b000 :
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign cntl_msb = start_in & cntl_out[ 35]; // done selection
assign cntl_bisi = mb_default_bisi | mb_user_bisi_rw_mode ? cntl_out[34] :
assign cntl_array_sel[3:0] = (user_mode | last_array) ? 4'b1111:
cntl_out[33:30]; // array selection
assign cntl_cmp_sel[3:0] = sel_cmp_pass ? {4'b1111} :
assign cntl_data_sel[1:0] = (bisi_mode | mb_user_data_mode) ? 2'b11 : cntl_out[25:24]; // data selection
assign cntl_addr_mix = (mb_user_addr_mode | bisi_mode) ? 1'b1 : cntl_out[ 23]; // address mix
assign cntl_march_element[3:0] = sel_march_1_pass ? 4'b1111:
cntl_out[22:19]; // march element
assign addr_mix = (bisi_mode | mb_user_addr_mode) ? 1'b0 :
assign cntl_algr[16:0] = {cntl_msb,
cntl_march_element[3:0]};
assign next_algr[16:0] = cout_addr ? cntl_algr[16:0] + 17'h1 : cntl_algr[16:0]; // mbist control
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
/////////////////////////
/////////////////////////
assign upaddr = march_0 | march_1 | march_2 | march_6 | march_7 | bisi_mode ;
assign march_element_pre[3:0]=next_algr[3:0];
assign march_pre_0 = march_element_pre[3:0]==4'h0;
assign march_pre_1 = march_element_pre[3:0]==4'h1;
assign march_pre_2 = march_element_pre[3:0]==4'h2;
assign march_pre_6 = march_element_pre[3:0]==4'h6;
assign march_pre_7 = march_element_pre[3:0]==4'h7;
assign upaddr_pre = march_pre_0 | march_pre_1 | march_pre_2 | march_pre_6 | march_pre_7;
assign incr_addr[2:0] = mb_user_addr_mode ? user_incr_addr[2:0] : 3'b001;
assign start_addr[2:0] = mb_user_addr_mode ? user_start_addr[2:0] : 3'b000;
// assign next_addr_out[8:0] = cout_rw ? cntl_addr[8:0] + incr_addr[8:0] : cntl_addr[8:0]; // next address
assign incred_addr[2:0] = cntl_addr[2:0] + incr_addr[2:0];
assign overflow = upaddr ? ( cntl_addr[2:0] == stop_addr[2:0]) & (cntl_rw[2:0]==3'b111):
(~cntl_addr[2:0] == start_addr[2:0]) & (cntl_rw[2:0]==3'b111);
// assign next_addr[4:0]= overflow ? restart_addr[4:0] : next_addr_out[4:0];
assign restart_addr[2:0] = upaddr_pre ? start_addr[2:0] : ~stop_addr[2:0];
assign cout_addr = overflow;
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign cntl_rw[2:0] = sel_rw_pass ? 3'b111:
cntl_out[ 2: 0]; // read write control
assign next_rw[2:0] = cntl_rw[2:0]+3'b001 ;
assign cout_rw = &cntl_rw[2:0]; // carry over for rw
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign one_cycle_march = march_0 | march_5 | march_7;
assign five_cycle_march = march_6 | march_8;
assign two_cycle_march = ~(one_cycle_march | five_cycle_march);
/////////////////////////
/////////////////////////
assign mem_wr_pbi = run3 & (
((march_1 | march_2 | march_3 | march_4 ) & rw_1) |
(march_6 & (rw_0 | rw_1 | rw_4)) |
(march_8 & (rw_0 | rw_1 | rw_4))
assign mem_wr = bisi_wr_mode ? 1'b1 :
/////////////////////////
/////////////////////////
assign mem_rd_pbi = run3 & ~mem_wr;
assign mem_rd= bisi_rd_mode ? 1'b1 : mem_rd_pbi;
assign cntl_addr[2:0] = cntl_out[5:3];
assign adj_addr = (five_cycle_march & (rw_1 | rw_3)) ? {cntl_addr[2:1],~cntl_addr[0]}:
assign mem_addr1[2:0] = upaddr ? adj_addr[2:0]: ~adj_addr[2:0];
assign true_data_l = bisi_mode |
(march_6 & (rw_1 | rw_3 | rw_4)) |
(march_8 & (rw_0 | rw_2));
assign true_data=~true_data_l;
assign data_pat_sel[7:0] = (mb_user_data_mode & bisi_mode) ? ~user_data[7:0]:
(mb_user_data_mode) ? user_data[7:0]:
(cntl_data_sel[1:0] == 2'h0) ? 8'hAA:
(cntl_data_sel[1:0] == 2'h1) ? 8'h99:
(cntl_data_sel[1:0] == 2'h2) ? 8'hCC:
assign mem_data[7:0] = true_data ? data_pat_sel[7:0] : ~data_pat_sel[7:0];
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign stop_addr[2:0] = user_mode & user_addr_mode ? user_stop_addr[2:0] :
(array_0 | array_2) ? 3'b111: // wb
(array_1) ? 3'b011: // rdma
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign mem_addr[2:0] = (addr_mix & (array_0 | array_2)) ? { mem_addr1[0],mem_addr1[2],mem_addr1[1] } :
(addr_mix & array_1) ? { mem_addr1[2],mem_addr1[0],mem_addr1[1] } :
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign array_0 = array_sel[3:0]==4'h0;
assign array_1 = array_sel[3:0]==4'h1;
assign array_2 = array_sel[3:0]==4'h2;
assign last_array= array_2;
// assign cmp_0 = cmp_sel[4:0]==5'b00000;
// assign cmp_1 = cmp_sel[4:0]==5'b00001;
// assign cmp_2 = cmp_sel[4:0]==5'b00010;
// assign cmp_3 = cmp_sel[4:0]==5'b00011;
// assign cmp_4 = cmp_sel[4:0]==5'b00100;
// assign cmp_5 = cmp_sel[4:0]==5'b00101;
// assign cmp_6 = cmp_sel[4:0]==5'b00110;
assign cmp_7 = cmp_sel[3:0]==4'b0111;
assign cmp_15 = cmp_sel[3:0]==4'b1111;
assign march_0 = (march_element[3:0]==4'h0);
assign march_1 = (march_element[3:0]==4'h1);
assign march_2 = (march_element[3:0]==4'h2);
assign march_3 = (march_element[3:0]==4'h3);
assign march_4 = (march_element[3:0]==4'h4);
assign march_5 = (march_element[3:0]==4'h5);
assign march_6 = (march_element[3:0]==4'h6);
assign march_7 = (march_element[3:0]==4'h7);
assign march_8 = (march_element[3:0]==4'h8);
assign rw_0 = (rw[2:0]==3'b000);
assign rw_1 = (rw[2:0]==3'b001);
assign rw_2 = (rw[2:0]==3'b010);
assign rw_3 = (rw[2:0]==3'b011);
assign rw_4 = (rw[2:0]==3'b100);
// assign rw_5 = (rw[2:0]==3'b101);
// assign rw_6 = (rw[2:0]==3'b110);
// assign rw_7 = (rw[2:0]==3'b111);
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
assign array_sel_cntl_out[3:0]=cntl_out[33:30];
l2b_mb0_ctl_msff_ctl_macro__width_4 array_sel_reg (
.scan_in(array_sel_reg_scanin),
.scan_out(array_sel_reg_scanout),
.dout ( array_sel_out[3:0] ),
assign array_sel[3:0]=(&array_sel_cntl_out[3:0]) ? array_sel_out[3:0] :
user_mode ? user_array_sel[3:0] :
assign cmp_sel_cntl_out[3:0] = cntl_out[29:26];
l2b_mb0_ctl_msff_ctl_macro__width_4 cmp_sel_reg (
.scan_in(cmp_sel_reg_scanin),
.scan_out(cmp_sel_reg_scanout),
.dout ( cmp_sel_out[3:0] ),
assign cmp_sel[3:0]= (&cmp_sel_cntl_out[3:0] & ~array_2) ? cmp_sel_out[3:0] :
mb_user_cmpsel_hold ? user_cmpsel[3:0] :
assign march_element_cntl_out[3:0]=cntl_out[22:19];
l2b_mb0_ctl_msff_ctl_macro__width_4 marche_element_reg (
.scan_in(marche_element_reg_scanin),
.scan_out(marche_element_reg_scanout),
.din ( march_element[3:0] ),
.dout ( march_element_out ),
assign march_element[3:0]=(&march_element_cntl_out[3:0]) ? march_element_out[3:0] :
march_element_cntl_out[3:0];
assign rw[2:0]=cntl_out[2:0];
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
assign sel_march_1_pass = bisi_mode | (ten_n_mode & march_5) | march_8 ;
assign bisi_wr_mode = mb_default_bisi | mb_user_bisi_rw_mode ? ~cntl_bisi & run3 :
mb_user_bisi_wr_mode & run3;
assign bisi_rd_mode =mb_default_bisi | mb_user_bisi_rw_mode ? cntl_bisi & run3 :
mb_user_bisi_rd_mode & run3;
assign sel_cmp_pass= (mb_user_cmpsel_hold) |
assign sel_rw_1_pass = bisi_mode | one_cycle_march ;
assign sel_rw_2_pass = two_cycle_march;
assign sel_rw_5_pass = five_cycle_march;
assign sel_rw_pass = (run3 & sel_rw_1_pass & rw_0) |
(run3 & sel_rw_2_pass & rw_1) |
(run3 & sel_rw_5_pass & rw_4) ;
l2b_mb0_ctl_msff_ctl_macro__width_1 user_bisi_wr_mode_reg (
.scan_in(user_bisi_wr_mode_reg_scanin),
.scan_out(user_bisi_wr_mode_reg_scanout),
.din ( user_bisi_wr_mode_in ),
.dout ( user_bisi_wr_mode ),
assign user_bisi_wr_mode_in=user_bisi_wr_mode;
l2b_mb0_ctl_msff_ctl_macro__width_1 user_bisi_rd_mode_reg (
.scan_in(user_bisi_rd_mode_reg_scanin),
.scan_out(user_bisi_rd_mode_reg_scanout),
.din ( user_bisi_rd_mode_in ),
.dout ( user_bisi_rd_mode ),
assign user_bisi_rd_mode_in=user_bisi_rd_mode;
assign mb_user_data_mode = user_mode & user_data_mode;
assign mb_user_addr_mode = user_mode & user_addr_mode;
assign mb_user_cmpsel_hold = user_mode & user_cmpsel_hold;
assign mb_user_loop_mode = user_mode & user_loop_mode;
assign mb_user_bisi_wr_mode = user_mode & user_bisi_wr_mode & bisi_mode;
assign mb_user_bisi_rd_mode = user_mode & user_bisi_rd_mode & bisi_mode;
assign mb_user_bisi_rw_mode = ((~user_bisi_wr_mode & ~user_bisi_rd_mode) | (user_bisi_wr_mode & user_bisi_rd_mode)) & bisi_mode;
assign mb_default_bisi = bisi_mode & ~user_mode;
//////////////////////////////////// ////////////////////////////////////
// membist control assignment
//////////////////////////////////// ////////////////////////////////////
assign mb_cmp_sel[0] = (array_0 | array_1) & ((cmp_sel[3:0]==4'b0100) | (cmp_sel[3:0]==4'b0000));
assign mb_cmp_sel[1] = (array_0 | array_1) & ((cmp_sel[3:0]==4'b0101) | (cmp_sel[3:0]==4'b0001));
assign mb_cmp_sel[2] = (array_0 | array_1) & ((cmp_sel[3:0]==4'b0110) | (cmp_sel[3:0]==4'b0010));
assign mb_cmp_sel[3] = (array_0 | array_1) & ((cmp_sel[3:0]==4'b0111) | (cmp_sel[3:0]==4'b0011));
assign mb_cmp_sel[4] = (array_0 | array_1) & (cmp_sel[2]);
assign mb_addr[2:0]=mem_addr[2:0];
assign mb_write_data[7:0]=mem_data[7:0];
// only one array read signal should be active
assign mb_array_0_rd = array_0 & mem_rd;
assign mb_array_1_rd = array_1 & mem_rd;
assign mb_array_2_rd = array_2 & mem_rd;
// only one array write signal should be active
assign mb_array_0_wr = array_0 & mem_wr;
assign mb_array_1_wr = array_1 & mem_wr;
assign mb_array_2_wr = array_2 & mem_wr;
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
l2b_mb0_ctl_msff_ctl_macro__width_1 msb_latch (
.scan_in(msb_latch_scanin),
.scan_out(msb_latch_scanout),
assign msb_in= (~start_in ) | (mb_user_loop_mode & mb_done) ? 1'b0 :
assign stop_engine_l = start_in & cntl_msb;
assign mb_done=msb_out & (done_delay[4:0]==5'b11110);
assign run3 = &done_delay[4:1] & ~stop_engine_l & start_in;
l2b_mb0_ctl_msff_ctl_macro__width_1 run3_transition_reg (
.scan_in(run3_transition_reg_scanin),
.scan_out(run3_transition_reg_scanout),
assign run3_transition = run3 & ~run3_out;
l2b_mb0_ctl_msff_ctl_macro__width_5 done_delay_reg (
.scan_in(done_delay_reg_scanin),
.scan_out(done_delay_reg_scanout),
.din ( done_delay_in[4:0] ),
.dout ( done_delay[4:0] ),
assign done_delay_in[4:0] = run3 ? 5'b11111 :
(run & ~run3) ? done_delay[4:0] + 5'b00001 :
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
// mb_*_fail are the true fail signals
assign mb_rdma_rw_fail = (~sel_wb_arrays & ~wb_or_rdma_rw_fail);
assign mb_wb_rw_fail = ( sel_wb_arrays & ~wb_or_rdma_rw_fail);
assign mb_fb_rw_fail = ~fb_rw_fail;
assign rdma_fail_d=run3_transition ? 1'b0 : mb_rdma_rw_fail | rdma_fail_sticky;
assign wb_fail_d =run3_transition ? 1'b0 : mb_wb_rw_fail | wb_fail_sticky;
assign fb_fail_d =run3_transition ? 1'b0 : mb_fb_rw_fail | fb_fail_sticky;
l2b_mb0_ctl_msff_ctl_macro__width_3 mbist_fail_input_reg (
.scan_in(mbist_fail_input_reg_scanin),
.scan_out(mbist_fail_input_reg_scanout),
.dout ({rdma_fail_sticky,
assign mbist_fail_sticky = rdma_fail_sticky |
assign mbist_fail_array = mb_rdma_rw_fail |
assign valid_fail=run3 | (stop_engine_l & ~mb_done);
assign mb_fail = mb_done ? mbist_fail_sticky : mbist_fail_array & valid_fail;
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
l2b_mb0_ctl_msff_ctl_macro__width_1 out_mb_tcu_done_reg (
.scan_in(out_mb_tcu_done_reg_scanin),
.scan_out(out_mb_tcu_done_reg_scanout),
l2b_mb0_ctl_msff_ctl_macro__width_1 out_mb_tcu_fail_reg (
.scan_in(out_mb_tcu_fail_reg_scanin),
.scan_out(out_mb_tcu_fail_reg_scanout),
l2b_mb0_ctl_msff_ctl_macro__width_5 out_cmp_sel_reg (
.scan_in(out_cmp_sel_reg_scanin),
.scan_out(out_cmp_sel_reg_scanout),
// thes are all the output flops to arrays
// for the following signals:
l2b_mb0_ctl_msff_ctl_macro__width_1 out_run_mb_arrays_reg (
.scan_in(out_run_mb_arrays_reg_scanin),
.scan_out(out_run_mb_arrays_reg_scanout),
l2b_mb0_ctl_msff_ctl_macro__width_8 out_data_mb_arrays_delay1_reg (
.scan_in(out_data_mb_arrays_delay1_reg_scanin),
.scan_out(out_data_mb_arrays_delay1_reg_scanout),
.din ( mb_write_data[7:0]),
.dout ( mb_write_data_delay_out[7:0]),
l2b_mb0_ctl_msff_ctl_macro__width_8 out_data_mb_arrays_delay2_reg (
.scan_in(out_data_mb_arrays_delay2_reg_scanin),
.scan_out(out_data_mb_arrays_delay2_reg_scanout),
.din ( mb_write_data_delay_out[7:0]),
.dout ( mb_write_data_out[7:0]),
// data 8 bits delay 3 only for fb
l2b_mb0_ctl_msff_ctl_macro__width_8 out_data_mb_arrays_delay3_reg (
.scan_in(out_data_mb_arrays_delay3_reg_scanin),
.scan_out(out_data_mb_arrays_delay3_reg_scanout),
.din ( mb_write_data_out[7:0]),
.dout ( mb_write_data_out_d1[7:0]),
l2b_mb0_ctl_msff_ctl_macro__width_3 out_addr_mb_arrays_reg (
.scan_in(out_addr_mb_arrays_reg_scanin),
.scan_out(out_addr_mb_arrays_reg_scanout),
.dout ( mb_addr_out[2:0]),
l2b_mb0_ctl_msff_ctl_macro__width_3 out_wr_mb_arrays_reg (
.scan_in(out_wr_mb_arrays_reg_scanin),
.scan_out(out_wr_mb_arrays_reg_scanout),
l2b_mb0_ctl_msff_ctl_macro__width_3 out_rd_mb_arrays_reg (
.scan_in(out_rd_mb_arrays_reg_scanin),
.scan_out(out_rd_mb_arrays_reg_scanout),
// port name re-assignment
assign mbist_run =mb_run_out;
assign rdma_mbist_data_in[7:0] =mb_write_data_out[7:0];
assign wb_mbist_data_in[7:0] =mb_write_data_out[7:0];
assign fb_mbist_data_in[7:0] =mb_write_data_out_d1[7:0];
assign mbist_addr[2:0] =mb_addr_out[2:0];
assign mbist_cmpsel[4:0] =mb_cmpsel_out[4:0];
assign mbist_fail =mb_fail_out;
assign mbist_done =mb_done_out;
assign mbist_wb_array_wr_en =mb_array_0_wr_out;
assign mbist_rdma_array_wr_en =mb_array_1_wr_out;
assign mbist_fb_array_wr_en =mb_array_2_wr_out;
assign mbist_wb_array_rd_en =mb_array_0_rd_out;
assign mbist_rdma_array_rd_en =mb_array_1_rd_out;
assign mbist_fb_array_rd_en =mb_array_2_rd_out;
assign mbist_compare_read_sel_r[0] = ~mbist_cmpsel[4] & mbist_cmpsel[0];
assign mbist_compare_read_sel_r[1] = ~mbist_cmpsel[4] & mbist_cmpsel[1];
assign mbist_compare_read_sel_r[2] = ~mbist_cmpsel[4] & mbist_cmpsel[2];
assign mbist_compare_read_sel_r[3] = ~mbist_cmpsel[4] & mbist_cmpsel[3];
assign mbist_compare_read_sel_r[4] = mbist_cmpsel[4] & mbist_cmpsel[0];
assign mbist_compare_read_sel_r[5] = mbist_cmpsel[4] & mbist_cmpsel[1];
assign mbist_compare_read_sel_r[6] = mbist_cmpsel[4] & mbist_cmpsel[2];
assign mbist_compare_read_sel_r[7] = mbist_cmpsel[4] & mbist_cmpsel[3];
assign mbist_compare_read_sel[2] = mbist_compare_read_sel_r[4] | mbist_compare_read_sel_r[5] | mbist_compare_read_sel_r[6] | mbist_compare_read_sel_r[7];
assign mbist_compare_read_sel[1] = mbist_compare_read_sel_r[2] | mbist_compare_read_sel_r[3] | mbist_compare_read_sel_r[6] | mbist_compare_read_sel_r[7];
assign mbist_compare_read_sel[0] = mbist_compare_read_sel_r[1] | mbist_compare_read_sel_r[3] | mbist_compare_read_sel_r[5] | mbist_compare_read_sel_r[7];
l2b_mb0_ctl_spare_ctl_macro__num_2 spares (
.scan_out(spares_scanout),
supply0 vss; // <- port for ground
supply1 vdd; // <- port for power
// /////////////////////////////////////////////////////////////////////////////
assign array_usr_reg_scanin = scan_in ;
assign user_addr_mode_reg_scanin = array_usr_reg_scanout ;
assign user_start_addr_reg_scanin = user_addr_mode_reg_scanout;
assign user_stop_addr_reg_scanin = user_start_addr_reg_scanout;
assign user_incr_addr_reg_scanin = user_stop_addr_reg_scanout;
assign user_data_mode_reg_scanin = user_incr_addr_reg_scanout;
assign user_data_reg_scanin = user_data_mode_reg_scanout;
assign user_cmpsel_hold_reg_scanin = user_data_reg_scanout ;
assign user_cmpsel_reg_scanin = user_cmpsel_hold_reg_scanout;
assign user_loop_mode_reg_scanin = user_cmpsel_reg_scanout ;
assign ten_n_mode_reg_scanin = user_loop_mode_reg_scanout;
assign input_signals_reg_scanin = ten_n_mode_reg_scanout ;
assign config_reg_scanin = input_signals_reg_scanout;
assign loop_again_reg_scanin = config_reg_scanout ;
assign mbist_misc_output_reg_scanin = loop_again_reg_scanout ;
assign cntl_reg_scanin = mbist_misc_output_reg_scanout;
assign array_sel_reg_scanin = cntl_reg_scanout ;
assign cmp_sel_reg_scanin = array_sel_reg_scanout ;
assign marche_element_reg_scanin = cmp_sel_reg_scanout ;
assign user_bisi_wr_mode_reg_scanin = marche_element_reg_scanout;
assign user_bisi_rd_mode_reg_scanin = user_bisi_wr_mode_reg_scanout;
assign msb_latch_scanin = user_bisi_rd_mode_reg_scanout;
assign run3_transition_reg_scanin = msb_latch_scanout ;
assign done_delay_reg_scanin = run3_transition_reg_scanout;
assign mbist_fail_input_reg_scanin = done_delay_reg_scanout ;
assign out_mb_tcu_done_reg_scanin = mbist_fail_input_reg_scanout;
assign out_mb_tcu_fail_reg_scanin = out_mb_tcu_done_reg_scanout;
assign out_cmp_sel_reg_scanin = out_mb_tcu_fail_reg_scanout;
assign out_run_mb_arrays_reg_scanin = out_cmp_sel_reg_scanout ;
assign out_data_mb_arrays_delay1_reg_scanin = out_run_mb_arrays_reg_scanout;
assign out_data_mb_arrays_delay2_reg_scanin = out_data_mb_arrays_delay1_reg_scanout;
assign out_data_mb_arrays_delay3_reg_scanin = out_data_mb_arrays_delay2_reg_scanout;
assign out_addr_mb_arrays_reg_scanin = out_data_mb_arrays_delay3_reg_scanout;
assign out_wr_mb_arrays_reg_scanin = out_addr_mb_arrays_reg_scanout;
assign out_rd_mb_arrays_reg_scanin = out_wr_mb_arrays_reg_scanout;
assign spares_scanin = out_rd_mb_arrays_reg_scanout;
assign scan_out = spares_scanout ;
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_l1clkhdr_ctl_macro (
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_4 (
assign fdin[3:0] = din[3:0];
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_1 (
assign fdin[0:0] = din[0:0];
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_3 (
assign fdin[2:0] = din[2:0];
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_8 (
assign fdin[7:0] = din[7:0];
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_2 (
assign fdin[1:0] = din[1:0];
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_73 (
assign fdin[72:0] = din[72:0];
.so({so[71:0],scan_out}),
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_36 (
assign fdin[35:0] = din[35:0];
.so({so[34:0],scan_out}),
// any PARAMS parms go into naming of macro
module l2b_mb0_ctl_msff_ctl_macro__width_5 (
assign fdin[4:0] = din[4:0];
// 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 l2b_mb0_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));