OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ifu_mbist.v] - Blame information for rev 113

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_ifu_mbist.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 113 albert.wat
`ifdef SIMPLY_RISC_TWEAKS
22
`define SIMPLY_RISC_SCANIN .si(0)
23
`else
24
`define SIMPLY_RISC_SCANIN .si()
25
`endif
26 95 fafa1971
///////////////////////////////////////////////////////////////////////////////
27
//
28
//    Description:        Memory BIST Controller for the L1 ICache and DCache
29
//    Block Type:         Control Block
30
//    Module:             mbist_engine
31
//
32
///////////////////////////////////////////////////////////////////////////////
33
 
34
 
35
module sparc_ifu_mbist(
36
  mbist_dcache_read,
37
  mbist_dcache_write,
38
  mbist_dcache_word,
39
  mbist_dcache_index,
40
  mbist_dcache_way,
41
  mbist_icache_read,
42
  mbist_icache_write,
43
  mbist_icache_index,
44
  mbist_icache_word,
45
  mbist_icache_way,
46
  mbist_icache_wdata,
47
  mbist_dcache_wdata,
48
  mbist_done,
49
  mbist_dcache_fail,
50
  mbist_icache_fail,
51
  rclk,
52
  mbist_start,
53
  mbist_ifq_run_bist,
54
  mbist_userdata_mode,
55
  mbist_bisi_mode,
56
  mbist_loop_mode,
57
  mbist_loop_on_address,
58
  mbist_stop_on_fail,
59
  mbist_stop_on_next_fail,
60
  mbist_dcache_data_in,
61
  mbist_icache_data_in,
62
  grst_l,
63
  arst_l,
64
  mbist_si,
65
  mbist_so,
66
  mbist_se
67
);
68
 
69
 
70
 
71
 
72
// /////////////////////////////////////////////////////////////////////////////
73
// Outputs
74
// /////////////////////////////////////////////////////////////////////////////
75
 
76
   output             mbist_dcache_read;
77
   output             mbist_dcache_write;
78
   output             mbist_dcache_word;
79
   output[6:0]        mbist_dcache_index;
80
   output[1:0]        mbist_dcache_way;
81
 
82
   output             mbist_icache_read;
83
   output             mbist_icache_write;
84
   output[7:0]        mbist_icache_index;
85
   output             mbist_icache_word;
86
   output[1:0]        mbist_icache_way;
87
   output             mbist_ifq_run_bist;
88
 
89
   output[7:0]        mbist_icache_wdata;
90
   output[7:0]        mbist_dcache_wdata;
91
 
92
   output             mbist_done;
93
   output             mbist_dcache_fail;
94
   output             mbist_icache_fail;
95
 
96
   output             mbist_so;
97
 
98
 
99
 
100
// /////////////////////////////////////////////////////////////////////////////
101
// Inputs
102
// /////////////////////////////////////////////////////////////////////////////
103
 
104
   input              rclk;
105
   input              mbist_si;
106
   input              mbist_se;
107
 
108
   input              grst_l;
109
   input              arst_l;
110
 
111
   input              mbist_start;
112
   input              mbist_userdata_mode;
113
   input              mbist_bisi_mode;
114
   input              mbist_loop_mode;
115
   input              mbist_loop_on_address;
116
   input              mbist_stop_on_fail;
117
   input              mbist_stop_on_next_fail;
118
 
119
   input[71:0]        mbist_dcache_data_in;
120
   input[67:0]        mbist_icache_data_in;
121
 
122
 
123
// /////////////////////////////////////////////////////////////////////////////
124
// Wires
125
// /////////////////////////////////////////////////////////////////////////////
126
 
127
  wire [7:0] config_in;
128
  wire [7:0] config_out;
129
  wire start_transition;
130
  wire reset_engine;
131
  wire loop;
132
  wire run;
133
  wire bisi;
134
  wire userdata_mode;
135
  wire stop_on_fail;
136
  wire stop_on_next_fail;
137
  wire loop_on_address;
138
  wire [7:0] userdata_in;
139
  wire [7:0] userdata_out;
140
  wire [6:0] useradd_in;
141
  wire [6:0] useradd_out;
142
  wire [20:0] control_in;
143
  wire [20:0] control_out;
144
  wire msb;
145
  wire array_sel;
146
  wire [1:0] data_control;
147
  wire address_mix;
148
  wire [2:0] march_element;
149
  wire [9:0] array_address;
150
  wire dcache_sel;
151
  wire [1:0] read_write_control;
152
  wire [20:0] qual_control_out;
153
  wire four_cycle_march;
154
  wire [9:0] add;
155
  wire upaddress_march;
156
  wire [10:0] mbist_address;
157
  wire array_write;
158
  wire array_read;
159
  wire initialize;
160
  wire fail;
161
  wire true_data;
162
  wire [7:0] data_pattern;
163
  wire second_time_through;
164
  wire icache_sel;
165
  wire dc_read_pipe_out1;
166
  wire dc_read_pipe_out2;
167
  wire dcache_piped_read;
168
  wire ic_read_pipe_out1;
169
  wire ic_read_pipe_out2;
170
  wire icache_piped_read;
171
  wire [7:0] data_pipe_out1;
172
  wire [7:0] data_pipe_out2;
173
  wire [10:0] add_pipe_out1;
174
  wire [10:0] add_pipe_out2;
175
  wire [9:0] dcache_piped_address;
176
  wire [10:0] icache_piped_address;
177
  wire [1:0] fail_reg_in;
178
  wire [1:0] fail_reg_out;
179
  wire qual_dcache_fail;
180
  wire qual_icache_fail;
181
  wire beyond_last_fail;
182
  wire dcache_fail;
183
  wire icache_fail;
184
  wire mismatch, mbist_word_sel;
185
  wire [71:0] expect_data;
186
  wire [71:0] compare_data;
187
  wire qual_fail, dcache_data_sel;
188
  wire [10:0] fail_add_reg_in;
189
  wire [10:0] fail_add_reg_out;
190
  wire [71:0] fail_data_reg_in;
191
  wire [71:0] fail_data_reg_out;
192
  wire [20:0] fail_control_reg_in;
193
  wire [20:0] fail_control_reg_out;
194
  wire mbist_icache_read_bf, mbist_icache_write_bf;
195
  wire [71:0] compare_data_bf;
196
  wire msb_rst, msb_d1_rst, msb_d2_rst, msb_d3_rst, mbist_done_int;
197
  wire msb_d1, msb_d2, msb_d3, msb_d4, mbist_reset_l, mbist_reset;
198
 
199
 
200
//// reset buffer ////
201
 
202
   dffrl_async rstff(.din (grst_l),
203
                     .q   (mbist_reset_l),
204 113 albert.wat
                     .clk (rclk), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so(),
205 95 fafa1971
                     .rst_l (arst_l));
206
 
207
   assign       mbist_reset = ~mbist_reset_l;
208
 
209
// /////////////////////////////////////////////////////////////////////////////
210
//
211
// MBIST Config Register
212
//
213
// /////////////////////////////////////////////////////////////////////////////
214
//
215
// A low to high transition on mbist_start will reset and start the engine.  
216
// mbist_start must remain active high for the duration of MBIST.  
217
// If mbist_start deasserts the engine will stop but not reset.
218
// Once MBIST has completed mbist_done will assert and the fail status
219
// signals will be valid.  
220
// To run MBIST again the mbist_start signal must transition low then high.
221
//
222
// Loop on Address will disable the address mix function.
223
//
224
// /////////////////////////////////////////////////////////////////////////////
225
 
226
 
227
 
228 113 albert.wat
  dff_s #(8) config_reg (
229 95 fafa1971
               .clk      ( rclk                  ),
230
               .din      ( config_in[7:0]       ),
231 113 albert.wat
               .q        ( config_out[7:0]      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
232 95 fafa1971
 
233
 
234
 
235
  assign config_in[0]        =    mbist_start;
236
  assign config_in[1]        =    config_out[0];
237
  assign start_transition    =    config_out[0]      &  ~config_out[1];
238
  assign reset_engine        =    mbist_reset | start_transition   |  ((loop | loop_on_address)  &  mbist_done);
239
  assign run                 =    config_out[1]      &  ~mbist_done_int;
240
  assign mbist_ifq_run_bist  =    run;
241
 
242
  assign config_in[2]        =    start_transition   ?   mbist_bisi_mode:      config_out[2];
243
  assign bisi                =    config_out[2];
244
 
245
  assign config_in[3]        =    start_transition   ?   mbist_userdata_mode:  config_out[3];
246
  assign userdata_mode       =    config_out[3];
247
 
248
  assign config_in[4]        =    start_transition   ?   mbist_loop_mode:  config_out[4];
249
  assign loop                =    config_out[4];
250
 
251
  assign config_in[5]        =    start_transition   ?   mbist_stop_on_fail:  config_out[5];
252
  assign stop_on_fail        =    config_out[5];
253
 
254
  assign config_in[6]        =    start_transition   ?   mbist_stop_on_next_fail:  config_out[6];
255
  assign stop_on_next_fail   =    config_out[6];
256
 
257
  assign config_in[7]        =    start_transition   ?   mbist_loop_on_address:  config_out[7];
258
  assign loop_on_address     =    config_out[7];
259
 
260
 
261 113 albert.wat
  dff_s #(8) userdata_reg (
262 95 fafa1971
                 .clk      ( rclk                    ),
263
                 .din      ( userdata_in[7:0]       ),
264 113 albert.wat
                 .q        ( userdata_out[7:0]      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
265 95 fafa1971
 
266
 
267
  assign userdata_in[7:0]    =    userdata_out[7:0];
268
 
269
 
270
 
271
 
272 113 albert.wat
  dff_s #(7) user_address_reg (
273 95 fafa1971
                 .clk      ( rclk                   ),
274
                 .din      ( useradd_in[6:0]       ),
275 113 albert.wat
                 .q        ( useradd_out[6:0]      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
276 95 fafa1971
 
277
  assign useradd_in[6:0]    =    useradd_out[6:0];
278
 
279
 
280
// /////////////////////////////////////////////////////////////////////////////
281
//
282
// MBIST Control Register
283
//
284
// /////////////////////////////////////////////////////////////////////////////
285
// Remove Address mix disable before delivery
286
// /////////////////////////////////////////////////////////////////////////////
287
 
288
 
289 113 albert.wat
   dff_s #(21) control_reg  (
290 95 fafa1971
                      .clk   ( rclk                        ),
291
                      .din   ( control_in[20:0]           ),
292 113 albert.wat
                      .q     ( control_out[20:0]          ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
293 95 fafa1971
 
294
  assign   msb                       =     control_out[20];
295
  assign   array_sel                 =     control_out[19];
296
  assign   data_control[1:0]         =     userdata_mode ? 2'b11 : control_out[18:17];
297
  assign   address_mix               =     loop_on_address    ?   1'b1:   control_out[16];
298
  assign   mbist_word_sel            =     loop_on_address ? 1'b1 : control_out[15];
299
  assign   march_element[2:0]        =     control_out[14:12];
300
  assign   array_address[9:0]       =      loop_on_address    ?   {6'h3f, control_out[5:2]}:
301
                                           (dcache_sel & ~bisi)     ?   {1'd1, control_out[10:2]}: control_out[11:2];
302
  assign   read_write_control[1:0]   =     control_out[1:0];
303
 
304
  assign   qual_control_out[20:0]    =     {msb, array_sel, data_control[1:0], address_mix, mbist_word_sel, march_element[2:0], array_address[9:0], read_write_control[1:0]};
305
 
306
// added by Chandra
307
 
308
  wire [1:0] add_data_int;
309
  wire [20:0] add_data;
310
  wire [9:0] mbist_address_bf;
311
 
312
  assign add_data_int[1:0] = four_cycle_march ? 2'b01: 2'b10;
313
  assign add_data[20:0] = qual_control_out[20:0] + {19'd0, add_data_int};
314
  assign control_in[20:0] = {21{~run & ~reset_engine}} & qual_control_out | {21{run & ~reset_engine}} & add_data;
315
 
316
  assign   add[9:0]                  =     upaddress_march     ?   array_address[9:0]:    ~array_address[9:0];
317
  assign   mbist_address_bf[9:0]     =     loop_on_address     ?  {useradd_out[5:0], add[3:0]}:
318
                                           address_mix         ?  (dcache_sel ? ({add[9:8], add[0], add[7:1]}) : ({add[9:8], add[6:0], add[7]})) :
319
                                                                    add[9:0];
320
 
321
 
322
 
323
  assign   array_write               =    ~run                 ?    1'b0:
324
                                           four_cycle_march    ?  (read_write_control[0] ^ read_write_control[1]):  read_write_control[1];
325
  assign   array_read                =    ~array_write        &&  run  &&  ~initialize;
326
 
327
  assign   mbist_done_int            =    (stop_on_fail  &&  fail)      ||  (stop_on_next_fail  &&  fail)         ||
328
                                          (bisi  &&  march_element[0])  ||  msb;
329
 
330
  assign   mbist_done                =    (stop_on_fail  &&  fail)      ||  (stop_on_next_fail  &&  fail)         ||
331
                                          (bisi  &&  march_element[0])  ||  msb_d4;
332
 
333
////////////
334
////////////
335
 
336
  wire [7:0] mbist_write_data_bf;
337
 
338
  assign   mbist_write_data_bf[7:0]     =     true_data           ?   data_pattern[7:0]:      ~data_pattern[7:0];
339
  assign   mbist_dcache_wdata[7:0]      =     mbist_write_data_bf[7:0];
340
 
341
  assign   second_time_through       =    ~loop_on_address    &&   address_mix;
342
  assign   initialize                =    (march_element[2:0] == 3'b000)  &&  ~second_time_through;
343
  assign   four_cycle_march          =    (march_element[2:0] == 3'h6)    ||  (march_element[2:0] == 3'h7);
344
  assign   upaddress_march           =    (march_element[2:0] == 3'h0)    ||  (march_element[2:0] == 3'h1) ||
345
                                          (march_element[2:0] == 3'h2)    ||  (march_element[2:0] == 3'h6);
346
 
347
  assign   true_data                 =     read_write_control[1] ^ ~march_element[0];
348
  assign   data_pattern[7:0]         =     userdata_mode                ?    userdata_out[7:0]:
349
                                           bisi                         ?    8'hFF:                    // true_data function will invert to 8'h00
350
                                          (data_control[1:0] == 2'h0)   ?    8'hAA:
351
                                          (data_control[1:0] == 2'h1)   ?    8'h99:
352
                                          (data_control[1:0] == 2'h2)   ?    8'hCC:
353
                                                                             8'h00;
354
  assign   dcache_sel                =    ~array_sel;
355
  assign   icache_sel                =     array_sel;
356
 
357
////////////
358
////////////
359
 
360
  assign   mbist_dcache_index[6:0]     =     mbist_address[6:0];
361
  assign   mbist_dcache_way[1:0]       =     (mbist_address[8:7] & {2{config_out[0]}});
362
  assign   mbist_dcache_word           =     mbist_address[10];
363
  assign   mbist_dcache_read           =     dcache_sel  &&  array_read;
364
  assign   mbist_dcache_write          =    (dcache_sel  ||  bisi) &&  array_write;
365
 
366
  assign   mbist_icache_index[7:0]     =     mbist_address[7:0];
367
  assign   mbist_icache_way[1:0]       =     (mbist_address[9:8] & {2{config_out[0]}});
368
  assign   mbist_icache_word           =     mbist_address[10];
369
  assign   mbist_icache_read_bf        =     icache_sel  &&  array_read;
370
  assign   mbist_icache_write_bf       =    (icache_sel  ||  bisi)  &&  array_write;
371
 
372
////////////////////////
373
////////////////////////
374
 
375
  assign msb_rst = msb & ~reset_engine;
376 113 albert.wat
  dff_s #(1) msb_d1_inst(
377 95 fafa1971
                   .clk      ( rclk                   ),
378
                   .din      ( msb_rst ),
379 113 albert.wat
                   .q        ( msb_d1 ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
380 95 fafa1971
  assign msb_d1_rst = msb_d1 & ~reset_engine;
381 113 albert.wat
  dff_s #(1) msb_d2_inst(
382 95 fafa1971
                   .clk      ( rclk                   ),
383
                   .din      ( msb_d1_rst ),
384 113 albert.wat
                   .q        ( msb_d2 ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
385 95 fafa1971
  assign msb_d2_rst = msb_d2 & ~reset_engine;
386 113 albert.wat
  dff_s #(1) msb_d3_inst(
387 95 fafa1971
                   .clk      ( rclk                   ),
388
                   .din      ( msb_d2_rst ),
389 113 albert.wat
                   .q        ( msb_d3 ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
390 95 fafa1971
  assign msb_d3_rst = msb_d3 & ~reset_engine;
391 113 albert.wat
  dff_s #(1) msb_d4_inst(
392 95 fafa1971
                   .clk      ( rclk                   ),
393
                   .din      ( msb_d3_rst ),
394 113 albert.wat
                   .q        ( msb_d4 ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
395 95 fafa1971
 
396
// /////////////////////////////////////////////////////////////////////////////
397
// Pipeline for Read, Data, and Address
398
// /////////////////////////////////////////////////////////////////////////////
399
 
400
  wire dc_read_pipe_out3, dc_read_pipe_out4, ic_read_pipe_out3, ic_read_pipe_out4;
401
  wire dc_read_pipe_out1_bf, dc_read_pipe_out2_bf, dc_read_pipe_out3_bf;
402
  wire ic_read_pipe_out1_bf, ic_read_pipe_out2_bf, ic_read_pipe_out3_bf;
403
 
404
  ////////////
405
  ////////////
406
 
407 113 albert.wat
  dff_s #(1) dc_read_pipe_reg1 (
408 95 fafa1971
                   .clk      ( rclk                   ),
409
                   .din      ( mbist_dcache_read      ),
410 113 albert.wat
                   .q        ( dc_read_pipe_out1      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
411 95 fafa1971
 
412
  assign dc_read_pipe_out1_bf = dc_read_pipe_out1 & ~reset_engine;
413
 
414 113 albert.wat
  dff_s #(1) dc_read_pipe_reg2 (
415 95 fafa1971
                   .clk      ( rclk                   ),
416
                   .din      ( dc_read_pipe_out1_bf   ),
417 113 albert.wat
                   .q        ( dc_read_pipe_out2      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
418 95 fafa1971
 
419
  assign dc_read_pipe_out2_bf = dc_read_pipe_out2 & ~reset_engine;
420
 
421 113 albert.wat
  dff_s #(1) dc_read_pipe_reg3 (
422 95 fafa1971
                   .clk      ( rclk                   ),
423
                   .din      ( dc_read_pipe_out2_bf   ),
424 113 albert.wat
                   .q        ( dc_read_pipe_out3      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
425 95 fafa1971
 
426
  assign dc_read_pipe_out3_bf = dc_read_pipe_out3 & ~reset_engine;
427
  assign dcache_data_sel       =  dc_read_pipe_out3_bf;
428
 
429 113 albert.wat
  dff_s #(1) dc_read_pipe_reg4 (
430 95 fafa1971
                   .clk      ( rclk                   ),
431
                   .din      ( dc_read_pipe_out3_bf   ),
432 113 albert.wat
                   .q        ( dc_read_pipe_out4      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
433 95 fafa1971
 
434
  assign dcache_piped_read       =  dc_read_pipe_out4 & ~reset_engine;
435
 
436
  ////////////
437
  ////////////
438
 
439 113 albert.wat
  dff_s #(1) ic_read_pipe_reg1 (
440 95 fafa1971
                   .clk      ( rclk                   ),
441
                   .din      ( mbist_icache_read_bf   ),
442 113 albert.wat
                   .q        ( ic_read_pipe_out1      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
443 95 fafa1971
 
444
  assign ic_read_pipe_out1_bf = ic_read_pipe_out1 & ~reset_engine;
445
  assign mbist_icache_read = ic_read_pipe_out1;
446
 
447 113 albert.wat
  dff_s #(1) ic_read_pipe_reg2 (
448 95 fafa1971
                   .clk      ( rclk                   ),
449
                   .din      ( ic_read_pipe_out1_bf   ),
450 113 albert.wat
                   .q        ( ic_read_pipe_out2      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
451 95 fafa1971
 
452
  assign ic_read_pipe_out2_bf = ic_read_pipe_out2 & ~reset_engine;
453
 
454 113 albert.wat
  dff_s #(1) ic_read_pipe_reg3 (
455 95 fafa1971
                   .clk      ( rclk                   ),
456
                   .din      ( ic_read_pipe_out2_bf   ),
457 113 albert.wat
                   .q        ( ic_read_pipe_out3      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
458 95 fafa1971
 
459
  assign ic_read_pipe_out3_bf = ic_read_pipe_out3 & ~reset_engine;
460
 
461 113 albert.wat
  dff_s #(1) ic_read_pipe_reg4 (
462 95 fafa1971
                   .clk      ( rclk                   ),
463
                   .din      ( ic_read_pipe_out3_bf   ),
464 113 albert.wat
                   .q        ( ic_read_pipe_out4      ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
465 95 fafa1971
 
466
 
467
  assign icache_piped_read       =  ic_read_pipe_out4 & ~reset_engine;
468
 
469
  ////////////
470
  ////////////
471
 
472 113 albert.wat
  dff_s #(1) ic_write_pipe_reg1 (
473 95 fafa1971
                   .clk      ( rclk                    ),
474
                   .din      ( mbist_icache_write_bf  ),
475 113 albert.wat
                   .q        ( mbist_icache_write     ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
476 95 fafa1971
 
477
  ////////////
478
  ////////////
479
 
480
  wire [7:0] data_pipe_out3, data_pipe_out4;
481
 
482 113 albert.wat
  dff_s #(8) data_pipe_reg1 (
483 95 fafa1971
                   .clk      ( rclk                    ),
484
                   .din      ( mbist_write_data_bf[7:0]  ),
485 113 albert.wat
                   .q        ( data_pipe_out1[7:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
486 95 fafa1971
 
487
  assign mbist_icache_wdata = data_pipe_out1;
488
 
489 113 albert.wat
  dff_s #(8) data_pipe_reg2 (
490 95 fafa1971
                   .clk      ( rclk                    ),
491
                   .din      ( data_pipe_out1[7:0]    ),
492 113 albert.wat
                   .q        ( data_pipe_out2[7:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
493 95 fafa1971
 
494 113 albert.wat
  dff_s #(8) data_pipe_reg3 (
495 95 fafa1971
                   .clk      ( rclk                    ),
496
                   .din      ( data_pipe_out2[7:0]    ),
497 113 albert.wat
                   .q        ( data_pipe_out3[7:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
498 95 fafa1971
 
499 113 albert.wat
  dff_s #(8) data_pipe_reg4 (
500 95 fafa1971
                   .clk      ( rclk                    ),
501
                   .din      ( data_pipe_out3[7:0]    ),
502 113 albert.wat
                   .q        ( data_pipe_out4[7:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
503 95 fafa1971
 
504
 
505
////////////
506
////////////
507
 
508
  wire [10:0] add_pipe_out3, add_pipe_out4;
509
  wire mbist_word_sel_bf;
510
 
511
  assign mbist_word_sel_bf = loop_on_address ? useradd_out[6] : mbist_word_sel;
512
 
513 113 albert.wat
  dff_s #(11) add_pipe_reg1 (
514 95 fafa1971
                   .clk      ( rclk                        ),
515
                   .din      ( {mbist_word_sel_bf, mbist_address_bf[9:0]}        ),
516 113 albert.wat
                   .q        ( add_pipe_out1[10:0]        ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
517 95 fafa1971
 
518
  assign mbist_address = add_pipe_out1;
519
 
520 113 albert.wat
  dff_s #(11) add_pipe_reg2 (
521 95 fafa1971
                   .clk      ( rclk                    ),
522
                   .din      ( add_pipe_out1[10:0]    ),
523 113 albert.wat
                   .q        ( add_pipe_out2[10:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
524 95 fafa1971
 
525 113 albert.wat
  dff_s #(11) add_pipe_reg3 (
526 95 fafa1971
                   .clk      ( rclk                    ),
527
                   .din      ( add_pipe_out2[10:0]    ),
528 113 albert.wat
                   .q        ( add_pipe_out3[10:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
529 95 fafa1971
 
530 113 albert.wat
  dff_s #(11) add_pipe_reg4 (
531 95 fafa1971
                   .clk      ( rclk                    ),
532
                   .din      ( add_pipe_out3[10:0]    ),
533 113 albert.wat
                   .q        ( add_pipe_out4[10:0]    ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
534 95 fafa1971
 
535
 
536
  assign dcache_piped_address[9:0]   =  {add_pipe_out4[10], add_pipe_out4[8:0]};
537
  assign icache_piped_address[10:0]  =  add_pipe_out4[10:0];
538
 
539
// /////////////////////////////////////////////////////////////////////////////
540
// Shared Fail Detection
541
// /////////////////////////////////////////////////////////////////////////////
542
 
543 113 albert.wat
  dff_s #(2) fail_reg       (
544 95 fafa1971
                   .clk      ( rclk                ),
545
                   .din      ( fail_reg_in[1:0]   ),
546 113 albert.wat
                   .q        ( fail_reg_out[1:0]  ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
547 95 fafa1971
 
548
 
549
  assign    fail_reg_in[1:0]      =    reset_engine      ?    2'b0: {qual_dcache_fail,qual_icache_fail}  |  fail_reg_out[1:0];
550
 
551
 
552
  assign    qual_dcache_fail      =  (!stop_on_next_fail  || (stop_on_next_fail &&  beyond_last_fail))  &&  dcache_fail;
553
  assign    qual_icache_fail      =  (!stop_on_next_fail  || (stop_on_next_fail &&  beyond_last_fail))  &&  icache_fail;
554
 
555
  assign    dcache_fail           =    dcache_piped_read  &&  mismatch;
556
  assign    icache_fail           =    icache_piped_read  &&  mismatch;
557
 
558
// added by Chandra
559
 
560
//  assign expect_data[71:0] = { ({4{dcache_piped_read}} & data_pipe_out4[7:4]), 
561
//                              (icache_piped_read ? {2{data_pipe_out4[1:0]}} : data_pipe_out4[3:0]), {8{data_pipe_out4[7:0]}}};
562
 
563
  assign expect_data[71:0] = { ({4{dcache_piped_read}} & data_pipe_out4[7:4]),
564
                                (icache_piped_read ? {2{data_pipe_out4[1:0]}} : data_pipe_out4[3:0]), {7{data_pipe_out4[7:0]}},
565
                                (icache_piped_read ? data_pipe_out4[7:4] : data_pipe_out4[3:0]), data_pipe_out4[3:0] };
566
 
567
  assign    compare_data_bf[71:0]    =    dcache_data_sel ?      mbist_dcache_data_in[71:0]:  {4'h0,mbist_icache_data_in[67:0]};
568
 
569 113 albert.wat
  dff_s #(72) compare_data_inst(
570 95 fafa1971
                   .clk      ( rclk                        ),
571
                   .din      ( compare_data_bf[71:0]   ),
572 113 albert.wat
                   .q        ( compare_data[71:0]  ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
573 95 fafa1971
 
574
  assign    mismatch              =    expect_data[71:0]   !=     compare_data[71:0];
575
 
576
 
577
  assign    mbist_dcache_fail     =    fail_reg_out[1];
578
  assign    mbist_icache_fail     =    fail_reg_out[0];
579
 
580
  assign    fail                  =   |fail_reg_out[1:0];
581
  assign    qual_fail             =    qual_dcache_fail  ||  qual_icache_fail;
582
 
583
 
584
// /////////////////////////////////////////////////////////////////////////////
585
// Fail Address and Data Capture and Control Reg Store
586
// /////////////////////////////////////////////////////////////////////////////
587
 
588
 
589
 
590 113 albert.wat
  dff_s #(11) fail_add_reg(
591 95 fafa1971
                   .clk      ( rclk                        ),
592
                   .din      ( fail_add_reg_in[10:0]   ),
593 113 albert.wat
                   .q        ( fail_add_reg_out[10:0]  ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
594 95 fafa1971
 
595
 
596
  assign fail_add_reg_in[10:0]     =  reset_engine              ?    11'b0:
597
                                      qual_dcache_fail          ?    {1'b0,dcache_piped_address[9:0]}:
598
                                      qual_icache_fail          ?    icache_piped_address[10:0]:
599
                                                                     fail_add_reg_out[10:0];
600
 
601
 
602 113 albert.wat
  dff_s #(72) fail_data_reg(
603 95 fafa1971
                   .clk      ( rclk                      ),
604
                   .din      ( fail_data_reg_in[71:0]   ),
605 113 albert.wat
                   .q        ( fail_data_reg_out[71:0]  ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
606 95 fafa1971
 
607
 
608
  assign fail_data_reg_in[71:0]     =  reset_engine     ?   72'b0:
609
                                       qual_fail        ?   compare_data[71:0]:
610
                                                            fail_data_reg_out[71:0];
611
 
612
 
613
  assign fail_control_reg_in[20:0]     = (reset_engine && !mbist_stop_on_next_fail)    ?   21'b0:
614
                                          qual_fail                                    ?   qual_control_out[20:0]:
615
                                                                                           fail_control_reg_out[20:0];
616
 
617 113 albert.wat
  dff_s #(21) fail_control_reg_inst(
618 95 fafa1971
                   .clk      ( rclk                         ),
619
                   .din      ( fail_control_reg_in[20:0]   ),
620 113 albert.wat
                   .q        ( fail_control_reg_out[20:0]  ), .se(mbist_se), `SIMPLY_RISC_SCANIN, .so());
621 95 fafa1971
 
622
////////
623
 
624
  assign  beyond_last_fail  =  qual_control_out[20:0]    >    fail_control_reg_out[20:0];
625
 
626
 
627
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.