[6] | 1 | // ========== Copyright Header Begin ========================================== |
---|
| 2 | // |
---|
| 3 | // OpenSPARC T1 Processor File: test_stub_bist.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 | // test_stub_bist - Test Stub with BIST Support |
---|
| 24 | // ____________________________________________________________________________ |
---|
| 25 | // |
---|
| 26 | // Description: DBB interface for test signal generation and BIST execution |
---|
| 27 | // ____________________________________________________________________________ |
---|
| 28 | |
---|
| 29 | module test_stub_bist (/*AUTOARG*/ |
---|
| 30 | // Outputs |
---|
| 31 | mux_drive_disable, mem_write_disable, sehold, se, testmode_l, |
---|
| 32 | mem_bypass, so_0, so_1, so_2, so, tst_ctu_mbist_done, |
---|
| 33 | tst_ctu_mbist_fail, bist_ctl_reg_out, mbist_bisi_mode, |
---|
| 34 | mbist_stop_on_next_fail, mbist_stop_on_fail, mbist_loop_mode, |
---|
| 35 | mbist_loop_on_addr, mbist_data_mode, mbist_start, |
---|
| 36 | // Inputs |
---|
| 37 | ctu_tst_pre_grst_l, arst_l, cluster_grst_l, global_shift_enable, |
---|
| 38 | ctu_tst_scan_disable, ctu_tst_scanmode, ctu_tst_macrotest, |
---|
| 39 | ctu_tst_short_chain, long_chain_so_0, short_chain_so_0, |
---|
| 40 | long_chain_so_1, short_chain_so_1, long_chain_so_2, short_chain_so_2, |
---|
| 41 | si, ctu_tst_mbist_enable, rclk, bist_ctl_reg_in, bist_ctl_reg_wr_en, |
---|
| 42 | mbist_done, mbist_err |
---|
| 43 | ); |
---|
| 44 | |
---|
| 45 | // Scan interface |
---|
| 46 | |
---|
| 47 | input ctu_tst_pre_grst_l; |
---|
| 48 | input arst_l; |
---|
| 49 | input cluster_grst_l; |
---|
| 50 | input global_shift_enable; |
---|
| 51 | input ctu_tst_scan_disable; |
---|
| 52 | input ctu_tst_scanmode; |
---|
| 53 | input ctu_tst_macrotest; |
---|
| 54 | input ctu_tst_short_chain; |
---|
| 55 | input long_chain_so_0; |
---|
| 56 | input short_chain_so_0; |
---|
| 57 | input long_chain_so_1; |
---|
| 58 | input short_chain_so_1; |
---|
| 59 | input long_chain_so_2; |
---|
| 60 | input short_chain_so_2; |
---|
| 61 | input si; |
---|
| 62 | output mux_drive_disable; |
---|
| 63 | output mem_write_disable; |
---|
| 64 | output sehold; |
---|
| 65 | output se; |
---|
| 66 | output testmode_l; |
---|
| 67 | output mem_bypass; |
---|
| 68 | output so_0; |
---|
| 69 | output so_1; |
---|
| 70 | output so_2; |
---|
| 71 | output so; |
---|
| 72 | |
---|
| 73 | // Global BIST control interface |
---|
| 74 | |
---|
| 75 | input ctu_tst_mbist_enable; |
---|
| 76 | output tst_ctu_mbist_done; |
---|
| 77 | output tst_ctu_mbist_fail; |
---|
| 78 | |
---|
| 79 | // CSR interface |
---|
| 80 | |
---|
| 81 | input rclk; |
---|
| 82 | input [6:0] bist_ctl_reg_in; |
---|
| 83 | input bist_ctl_reg_wr_en; |
---|
| 84 | output [10:0] bist_ctl_reg_out; |
---|
| 85 | |
---|
| 86 | // BIST diagnostic interface |
---|
| 87 | |
---|
| 88 | input mbist_done; |
---|
| 89 | input [2:0] mbist_err; |
---|
| 90 | output mbist_bisi_mode; |
---|
| 91 | output mbist_stop_on_next_fail; |
---|
| 92 | output mbist_stop_on_fail; |
---|
| 93 | output mbist_loop_mode; |
---|
| 94 | output mbist_loop_on_addr; |
---|
| 95 | output mbist_data_mode; |
---|
| 96 | output mbist_start; |
---|
| 97 | |
---|
| 98 | // Internal wires |
---|
| 99 | |
---|
| 100 | wire csr_write; // write enable for bist_ctl_reg |
---|
| 101 | wire mbist_enable_d1; // delayed version of ctu_tst_mbist_enable |
---|
| 102 | wire mbist_enable_d2; // delayed version of mbist_enable_d1 |
---|
| 103 | wire mbist_stop_serial_in; // delayed version of mbist_start |
---|
| 104 | wire [6:0] bist_diag_mode; // data written to bist_ctl_reg |
---|
| 105 | wire mbist_done_delayed; // flopped version of mbist_done |
---|
| 106 | wire clr_mbist_ctl_l; // flag to clear mbist control bits |
---|
| 107 | wire mbist_fail_flag; // summation of array error signals |
---|
| 108 | wire serial_setup_mode; // serial setup mode flag |
---|
| 109 | wire serial_setup_mode_ctl; // serial setup mode control |
---|
| 110 | wire serial_setup_start; // edge to enable serial setup mode |
---|
| 111 | wire serial_setup_enable; // kick off serial setup mode |
---|
| 112 | wire serial_setup_stop; // reset for serial setup mode |
---|
| 113 | wire serial_setup_valid; // bist start qualifier |
---|
| 114 | wire si; // scanin place holder |
---|
| 115 | wire so; // scanout place holder |
---|
| 116 | |
---|
| 117 | // Scan control |
---|
| 118 | |
---|
| 119 | test_stub_scan scan_ctls ( |
---|
| 120 | .ctu_tst_pre_grst_l(ctu_tst_pre_grst_l), |
---|
| 121 | .arst_l(arst_l), |
---|
| 122 | .global_shift_enable(global_shift_enable), |
---|
| 123 | .ctu_tst_scan_disable(ctu_tst_scan_disable), |
---|
| 124 | .ctu_tst_scanmode(ctu_tst_scanmode), |
---|
| 125 | .ctu_tst_macrotest(ctu_tst_macrotest), |
---|
| 126 | .ctu_tst_short_chain(ctu_tst_short_chain), |
---|
| 127 | .long_chain_so_0(long_chain_so_0), |
---|
| 128 | .short_chain_so_0(short_chain_so_0), |
---|
| 129 | .long_chain_so_1(long_chain_so_1), |
---|
| 130 | .short_chain_so_1(short_chain_so_1), |
---|
| 131 | .long_chain_so_2(long_chain_so_2), |
---|
| 132 | .short_chain_so_2(short_chain_so_2), |
---|
| 133 | .mux_drive_disable(mux_drive_disable), |
---|
| 134 | .mem_write_disable(mem_write_disable), |
---|
| 135 | .sehold(sehold), |
---|
| 136 | .se(se), |
---|
| 137 | .testmode_l(testmode_l), |
---|
| 138 | .mem_bypass(mem_bypass), |
---|
| 139 | .so_0(so_0), |
---|
| 140 | .so_1(so_1), |
---|
| 141 | .so_2(so_2) |
---|
| 142 | ); |
---|
| 143 | |
---|
| 144 | // BIST control |
---|
| 145 | |
---|
| 146 | assign csr_write = bist_ctl_reg_wr_en | serial_setup_mode; |
---|
| 147 | assign mbist_done_delayed = bist_ctl_reg_out[10]; |
---|
| 148 | assign clr_mbist_ctl_l = cluster_grst_l & ~serial_setup_start; |
---|
| 149 | assign {mbist_bisi_mode, |
---|
| 150 | mbist_stop_on_next_fail, |
---|
| 151 | mbist_stop_on_fail, |
---|
| 152 | mbist_loop_mode, |
---|
| 153 | mbist_loop_on_addr, |
---|
| 154 | mbist_data_mode, |
---|
| 155 | mbist_start |
---|
| 156 | } = bist_ctl_reg_out[6:0]; |
---|
| 157 | |
---|
| 158 | // Software accessible CSR (parallel interface) |
---|
| 159 | // |
---|
| 160 | // Bit Type Function |
---|
| 161 | // --- ____ ----------------- |
---|
| 162 | // 10 S Done flag |
---|
| 163 | // 9 S Array 2 fail flag |
---|
| 164 | // 8 S Array 1 fail flag |
---|
| 165 | // 7 S Array 0 fail flag |
---|
| 166 | // 6 C Bisi mode |
---|
| 167 | // 5 C Stop on next fail |
---|
| 168 | // 4 C Stop on fail |
---|
| 169 | // 3 C Loop |
---|
| 170 | // 2 C Loop on address |
---|
| 171 | // 1 C User data mode |
---|
| 172 | // 0 C Start |
---|
| 173 | |
---|
| 174 | dffrl_ns #(4) bist_ctl_reg_10_7 ( |
---|
| 175 | .din({mbist_done,mbist_err[2:0]}), |
---|
| 176 | .clk(rclk), |
---|
| 177 | .rst_l(cluster_grst_l), |
---|
| 178 | .q(bist_ctl_reg_out[10:7]) |
---|
| 179 | ); |
---|
| 180 | |
---|
| 181 | dffrle_ns #(1) bist_ctl_reg_6 ( |
---|
| 182 | .din(bist_diag_mode[6]), |
---|
| 183 | .clk(rclk), |
---|
| 184 | .rst_l(clr_mbist_ctl_l), |
---|
| 185 | .en(csr_write), |
---|
| 186 | .q(bist_ctl_reg_out[6]) |
---|
| 187 | ); |
---|
| 188 | |
---|
| 189 | dffrle_ns #(5) bist_ctl_reg_5_1 ( |
---|
| 190 | .din(bist_diag_mode[5:1]), |
---|
| 191 | .clk(rclk), |
---|
| 192 | .rst_l(clr_mbist_ctl_l), |
---|
| 193 | .en(csr_write), |
---|
| 194 | .q(bist_ctl_reg_out[5:1]) |
---|
| 195 | ); |
---|
| 196 | |
---|
| 197 | dffrle_ns #(1) bist_ctl_reg_0 ( |
---|
| 198 | .din(bist_diag_mode[0]), |
---|
| 199 | .clk(rclk), |
---|
| 200 | .rst_l(clr_mbist_ctl_l), |
---|
| 201 | .en(csr_write), |
---|
| 202 | .q(bist_ctl_reg_out[0]) |
---|
| 203 | ); |
---|
| 204 | |
---|
| 205 | // CTU serial BIST interface. Bit ordering is 5,4,3,2,1,6,0. |
---|
| 206 | |
---|
| 207 | assign tst_ctu_mbist_done = mbist_done_delayed; |
---|
| 208 | assign mbist_fail_flag = |mbist_err[2:0]; |
---|
| 209 | assign serial_setup_start = mbist_enable_d1 & ~mbist_enable_d2 & ~serial_setup_mode; |
---|
| 210 | assign serial_setup_stop = cluster_grst_l & ~serial_setup_valid; |
---|
| 211 | assign serial_setup_enable = serial_setup_start | serial_setup_mode; |
---|
| 212 | assign bist_diag_mode[5:1] = serial_setup_mode ? {mbist_enable_d2, bist_ctl_reg_out[5:2]} : bist_ctl_reg_in[5:1]; |
---|
| 213 | assign bist_diag_mode[6] = serial_setup_mode ? bist_ctl_reg_out[1] : bist_ctl_reg_in[6]; |
---|
| 214 | assign bist_diag_mode[0] = serial_setup_mode ? bist_ctl_reg_out[6] & serial_setup_valid : bist_ctl_reg_in[0]; |
---|
| 215 | |
---|
| 216 | dff_ns #(1) tst_ctu_mbist_fail_reg ( |
---|
| 217 | .din(mbist_fail_flag), |
---|
| 218 | .clk(rclk), |
---|
| 219 | .q(tst_ctu_mbist_fail) |
---|
| 220 | ); |
---|
| 221 | |
---|
| 222 | dff_ns #(1) mbist_enable_d1_reg ( |
---|
| 223 | .din(ctu_tst_mbist_enable), |
---|
| 224 | .clk(rclk), |
---|
| 225 | .q(mbist_enable_d1) |
---|
| 226 | ); |
---|
| 227 | |
---|
| 228 | dff_ns #(1) mbist_enable_d2_reg ( |
---|
| 229 | .din(mbist_enable_d1), |
---|
| 230 | .clk(rclk), |
---|
| 231 | .q(mbist_enable_d2) |
---|
| 232 | ); |
---|
| 233 | |
---|
| 234 | dff_ns #(1) serial_setup_valid_reg ( |
---|
| 235 | .din(bist_ctl_reg_out[6]), |
---|
| 236 | .clk(rclk), |
---|
| 237 | .q(serial_setup_valid) |
---|
| 238 | ); |
---|
| 239 | |
---|
| 240 | dffrl_ns #(1) serial_setup_mode_reg ( |
---|
| 241 | .din (serial_setup_enable), |
---|
| 242 | .clk(rclk), |
---|
| 243 | .rst_l(serial_setup_stop), |
---|
| 244 | .q(serial_setup_mode) |
---|
| 245 | ); |
---|
| 246 | |
---|
| 247 | endmodule // test_stub_bist |
---|