source: XOpenSparcT1/trunk/T1-common/common/test_stub_bist.v @ 6

Revision 6, 8.3 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
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
29module test_stub_bist (/*AUTOARG*/
30// Outputs
31mux_drive_disable, mem_write_disable, sehold, se, testmode_l, 
32mem_bypass, so_0, so_1, so_2, so, tst_ctu_mbist_done, 
33tst_ctu_mbist_fail, bist_ctl_reg_out, mbist_bisi_mode, 
34mbist_stop_on_next_fail, mbist_stop_on_fail, mbist_loop_mode, 
35mbist_loop_on_addr, mbist_data_mode, mbist_start, 
36// Inputs
37ctu_tst_pre_grst_l, arst_l, cluster_grst_l, global_shift_enable, 
38ctu_tst_scan_disable, ctu_tst_scanmode, ctu_tst_macrotest, 
39ctu_tst_short_chain, long_chain_so_0, short_chain_so_0, 
40long_chain_so_1, short_chain_so_1, long_chain_so_2, short_chain_so_2, 
41si, ctu_tst_mbist_enable, rclk, bist_ctl_reg_in, bist_ctl_reg_wr_en, 
42mbist_done, mbist_err
43);
44
45// Scan interface
46
47input          ctu_tst_pre_grst_l;
48input          arst_l;
49input          cluster_grst_l;
50input          global_shift_enable;
51input          ctu_tst_scan_disable;
52input          ctu_tst_scanmode;
53input          ctu_tst_macrotest;
54input          ctu_tst_short_chain;
55input          long_chain_so_0;
56input          short_chain_so_0;
57input          long_chain_so_1;
58input          short_chain_so_1;
59input          long_chain_so_2;
60input          short_chain_so_2;
61input          si;
62output         mux_drive_disable;
63output         mem_write_disable;
64output         sehold;
65output         se;
66output         testmode_l;
67output         mem_bypass;
68output         so_0;
69output         so_1;
70output         so_2;
71output         so;
72
73// Global BIST control interface
74
75input          ctu_tst_mbist_enable;
76output         tst_ctu_mbist_done;
77output         tst_ctu_mbist_fail;
78
79// CSR interface
80
81input          rclk;
82input  [6:0]   bist_ctl_reg_in;
83input          bist_ctl_reg_wr_en;
84output [10:0]  bist_ctl_reg_out;
85
86// BIST diagnostic interface
87
88input          mbist_done;
89input  [2:0]   mbist_err;
90output         mbist_bisi_mode;
91output         mbist_stop_on_next_fail;
92output         mbist_stop_on_fail;
93output         mbist_loop_mode;
94output         mbist_loop_on_addr;
95output         mbist_data_mode;
96output         mbist_start;
97
98// Internal wires
99
100wire           csr_write;               // write enable for bist_ctl_reg
101wire           mbist_enable_d1;         // delayed version of ctu_tst_mbist_enable
102wire           mbist_enable_d2;         // delayed version of mbist_enable_d1
103wire           mbist_stop_serial_in;    // delayed version of mbist_start
104wire [6:0]     bist_diag_mode;          // data written to bist_ctl_reg
105wire           mbist_done_delayed;      // flopped version of mbist_done
106wire           clr_mbist_ctl_l;         // flag to clear mbist control bits
107wire           mbist_fail_flag;         // summation of array error signals
108wire           serial_setup_mode;       // serial setup mode flag
109wire           serial_setup_mode_ctl;   // serial setup mode control
110wire           serial_setup_start;      // edge to enable serial setup mode
111wire           serial_setup_enable;     // kick off serial setup mode
112wire           serial_setup_stop;       // reset for serial setup mode
113wire           serial_setup_valid;      // bist start qualifier
114wire           si;                      // scanin place holder
115wire           so;                      // scanout place holder
116
117// Scan control
118
119test_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
146assign csr_write = bist_ctl_reg_wr_en | serial_setup_mode;
147assign mbist_done_delayed = bist_ctl_reg_out[10];
148assign clr_mbist_ctl_l = cluster_grst_l & ~serial_setup_start;
149assign {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
174dffrl_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
181dffrle_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                                               
189dffrle_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
197dffrle_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
207assign tst_ctu_mbist_done = mbist_done_delayed;
208assign mbist_fail_flag = |mbist_err[2:0];
209assign serial_setup_start = mbist_enable_d1 & ~mbist_enable_d2 & ~serial_setup_mode;
210assign serial_setup_stop = cluster_grst_l & ~serial_setup_valid;
211assign serial_setup_enable = serial_setup_start | serial_setup_mode;
212assign bist_diag_mode[5:1] = serial_setup_mode ? {mbist_enable_d2, bist_ctl_reg_out[5:2]} : bist_ctl_reg_in[5:1];
213assign bist_diag_mode[6]   = serial_setup_mode ? bist_ctl_reg_out[1] : bist_ctl_reg_in[6];
214assign bist_diag_mode[0]   = serial_setup_mode ? bist_ctl_reg_out[6] & serial_setup_valid : bist_ctl_reg_in[0];
215
216dff_ns #(1) tst_ctu_mbist_fail_reg (
217                                    .din(mbist_fail_flag),
218                                    .clk(rclk),
219                                    .q(tst_ctu_mbist_fail)
220                                    );
221
222dff_ns #(1) mbist_enable_d1_reg (
223                                      .din(ctu_tst_mbist_enable),
224                                      .clk(rclk),
225                                      .q(mbist_enable_d1)
226                                      );
227
228dff_ns #(1) mbist_enable_d2_reg (
229                                      .din(mbist_enable_d1),
230                                      .clk(rclk),
231                                      .q(mbist_enable_d2)
232                                      );
233
234dff_ns #(1) serial_setup_valid_reg (
235                                    .din(bist_ctl_reg_out[6]),
236                                    .clk(rclk),
237                                    .q(serial_setup_valid)
238                                    );
239
240dffrl_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
247endmodule // test_stub_bist
Note: See TracBrowser for help on using the repository browser.