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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-common/] [srams/] [bw_r_dcm.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: bw_r_dcm.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
// Local header file includes / local defines
24
////////////////////////////////////////////////////////////////////////
25
 
26
// The Four panels correspond to addr<10:9> decoded.
27
 
28
module bw_r_dcm(  /*AUTOARG*/
29
   // Outputs
30
   row_hit, rd_data0, rd_data1, rd_data2, rd_data3, so_0, so_1,
31
   // Inputs
32
   cam_en, inv_mask0, inv_mask1, inv_mask2, inv_mask3, si_0, se_0,
33
   si_1, se_1, sehold_0, sehold_1, rclk,  rd_en, rw_addr0,
34
   rw_addr1, rw_addr2, rw_addr3, rst_l_0, rst_l_1, rst_warm_0,
35
   rst_warm_1, wr_en, rst_tri_en_0, rst_tri_en_1, wr_data0, wr_data1,
36
   wr_data2, wr_data3
37
   );
38
 
39
output  [31:0]   row_hit;
40
 
41
output [31:0]         rd_data0;               // From panel0 of dcm_panel.v
42
output [31:0]         rd_data1;               // From panel1 of dcm_panel.v
43
output [31:0]         rd_data2;               // From panel2 of dcm_panel.v
44
output [31:0]         rd_data3;               // From panel3 of dcm_panel.v
45
 
46
input   [3:0]         cam_en;
47
 
48
input [7:0]           inv_mask0;              // To panel0 of dcm_panel.v
49
input [7:0]           inv_mask1;              // To panel1 of dcm_panel.v
50
input [7:0]           inv_mask2;              // To panel2 of dcm_panel.v
51
input [7:0]           inv_mask3;              // To panel3 of dcm_panel.v
52
 
53
input                 si_0, se_0;
54
output                so_0;
55
input                 si_1, se_1;
56
output                so_1;
57
input                 sehold_0;
58
input                 sehold_1;
59
 
60
input                 rclk;                   // To panel0 of dcm_panel.v, ...
61
 
62
input  [3:0]          rd_en ;           // To panel0 of dcm_panel.v
63
 
64
input [5:0]           rw_addr0;      // To panel0 of dcm_panel.v
65
input [5:0]           rw_addr1;      // To panel1 of dcm_panel.v
66
input [5:0]           rw_addr2;      // To panel2 of dcm_panel.v
67
input [5:0]           rw_addr3;      // To panel3 of dcm_panel.v
68
 
69
input                 rst_l_0;                  // To panel0 of dcm_panel.v, ...
70
input                 rst_l_1;                  // To panel0 of dcm_panel.v, ...
71
input                 rst_warm_0;
72
input                 rst_warm_1;
73
 
74
input   [3:0]         wr_en;            // To panel0 of dcm_panel.v
75
input                 rst_tri_en_0; // used to disable writes during SCAN.
76
input                 rst_tri_en_1; // used to disable writes during SCAN.
77
 
78
input [32:0]          wr_data0;         // To panel0 of dcm_panel.v
79
input [32:0]          wr_data1;         // To panel1 of dcm_panel.v
80
input [32:0]          wr_data2;         // To panel2 of dcm_panel.v
81
input [32:0]          wr_data3;         // To panel3 of dcm_panel.v
82
 
83
 
84
wire    [31:0]   bank1_hit;
85
wire    [31:0]   bank0_hit;
86
 
87
/*      dcm_panel_pair  AUTO_TEMPLATE (
88
 
89
                                  .bank_hit(bank0_hit[31:0]),
90
                                  .rd_data0(rd_data0[31:0]),
91
                                  .rd_data1(rd_data1[31:0]),
92
                                  // Inputs
93
                                  .cam_en(cam_en[1:0]),
94
                                  .inv_mask0(inv_mask0[7:0]),
95
                                  .inv_mask1(inv_mask1[7:0]),
96
                                  .rclk (rclk),
97
                                  .rd_en(rd_en[1:0]),
98
                                  .rst_l(rst_l_0),
99
                                  .rst_tri_en(rst_tri_en_0),
100
                                  .rst_warm(rst_warm_0),
101
                                  .rw_addr0(rw_addr0[5:0]),
102
                                  .rw_addr1(rw_addr1[5:0]),
103
                                  .sehold(sehold_0),
104
                                  .wr_data0(wr_data0[32:0]),
105
                                  .wr_data1(wr_data1[32:0]),
106
                                  .wr_en(wr_en[1:0]));
107
 
108
*/
109
 
110
      dcm_panel_pair    panel_pair0(
111
                                  .so   (),
112
                                  .si   (),
113
                                  .se   (se_0),
114
                                        /*AUTOINST*/
115
                                  // Outputs
116
                                  .bank_hit(bank0_hit[31:0]),    // Templated
117
                                  .rd_data0(rd_data0[31:0]),     // Templated
118
                                  .rd_data1(rd_data1[31:0]),     // Templated
119
                                  // Inputs
120
                                  .cam_en(cam_en[1:0]),          // Templated
121
                                  .inv_mask0(inv_mask0[7:0]),    // Templated
122
                                  .inv_mask1(inv_mask1[7:0]),    // Templated
123
                                  .rclk (rclk),                  // Templated
124
                                  .rd_en(rd_en[1:0]),            // Templated
125
                                  .rst_l(rst_l_0),               // Templated
126
                                  .rst_tri_en(rst_tri_en_0),     // Templated
127
                                  .rst_warm(rst_warm_0),         // Templated
128
                                  .rw_addr0(rw_addr0[5:0]),      // Templated
129
                                  .rw_addr1(rw_addr1[5:0]),      // Templated
130
                                  .sehold(sehold_0),             // Templated
131
                                  .wr_data0(wr_data0[32:0]),     // Templated
132
                                  .wr_data1(wr_data1[32:0]),     // Templated
133
                                  .wr_en(wr_en[1:0]));            // Templated
134
 
135
        assign   row_hit =  bank1_hit | bank0_hit ;
136
 
137
/*      dcm_panel_pair  AUTO_TEMPLATE (
138
 
139
                                  .bank_hit(bank1_hit[31:0]),
140
                                  .rd_data0(rd_data2[31:0]),
141
                                  .rd_data1(rd_data3[31:0]),
142
                                  // Inputs
143
                                  .cam_en(cam_en[3:2]),
144
                                  .inv_mask0(inv_mask2[7:0]),
145
                                  .inv_mask1(inv_mask3[7:0]),
146
                                  .rclk (rclk),
147
                                  .rd_en(rd_en[3:2]),
148
                                  .rst_l(rst_l_1),
149
                                  .rst_tri_en(rst_tri_en_1),
150
                                  .rst_warm(rst_warm_1),
151
                                  .rw_addr0(rw_addr2[5:0]),
152
                                  .rw_addr1(rw_addr3[5:0]),
153
                                  .sehold(sehold_1),
154
                                  .wr_data0(wr_data2[32:0]),
155
                                  .wr_data1(wr_data3[32:0]),
156
                                  .wr_en(wr_en[3:2]));
157
 
158
*/
159
 
160
      dcm_panel_pair    panel_pair1(
161
                                  .so   (),
162
                                  .si   (),
163
                                  .se   (se_1),
164
                                        /*AUTOINST*/
165
                                    // Outputs
166
                                    .bank_hit(bank1_hit[31:0]),  // Templated
167
                                    .rd_data0(rd_data2[31:0]),   // Templated
168
                                    .rd_data1(rd_data3[31:0]),   // Templated
169
                                    // Inputs
170
                                    .cam_en(cam_en[3:2]),        // Templated
171
                                    .inv_mask0(inv_mask2[7:0]),  // Templated
172
                                    .inv_mask1(inv_mask3[7:0]),  // Templated
173
                                    .rclk(rclk),                 // Templated
174
                                    .rd_en(rd_en[3:2]),          // Templated
175
                                    .rst_l(rst_l_1),             // Templated
176
                                    .rst_tri_en(rst_tri_en_1),   // Templated
177
                                    .rst_warm(rst_warm_1),       // Templated
178
                                    .rw_addr0(rw_addr2[5:0]),    // Templated
179
                                    .rw_addr1(rw_addr3[5:0]),    // Templated
180
                                    .sehold(sehold_1),           // Templated
181
                                    .wr_data0(wr_data2[32:0]),   // Templated
182
                                    .wr_data1(wr_data3[32:0]),   // Templated
183
                                    .wr_en(wr_en[3:2]));          // Templated
184
 
185
 
186
endmodule
187
 
188
 
189
 
190
module dcm_panel_pair(  /*AUTOARG*/
191
   // Outputs
192
   so, bank_hit, rd_data0, rd_data1,
193
   // Inputs
194
   cam_en, inv_mask0, inv_mask1, rclk, rd_en, rst_l, rst_tri_en,
195
   rst_warm, rw_addr0, rw_addr1, sehold, wr_data0, wr_data1, wr_en,
196
   si, se
197
   );
198
 
199
input [1:0]             cam_en;
200
input [7:0]             inv_mask0;
201
input [7:0]             inv_mask1;
202
input                   rclk;
203
input [1:0]             rd_en;
204
input                   rst_l;
205
input                   rst_tri_en;
206
input                   rst_warm;
207
input [5:0]             rw_addr0;
208
input [5:0]             rw_addr1;
209
input                   sehold;
210
input [32:0]            wr_data0;
211
input [32:0]            wr_data1;
212
input [1:0]             wr_en;
213
input                   si,se ;
214
 
215
output                  so;
216
output [31:0]           bank_hit;
217
output [31:0]           rd_data0;
218
output [31:0]           rd_data1;
219
 
220
wire    [31:0]   lkup_hit0, lkup_hit1;
221
reg     rst_warm_d;
222
 
223
 
224
always  @(posedge rclk)
225
begin
226
        rst_warm_d <= ( sehold)? rst_warm_d : rst_warm;
227
end
228
 
229
/*      dcm_panel       AUTO_TEMPLATE (
230
                   .lkup_hit            (lkup_hit@[31:0]),
231
                   .rd_data            (rd_data@[31:0]),
232
                   .rd_en          (rd_en[@]),
233
                   .wr_en          (wr_en[@]),
234
                   .cam_en              (cam_en[@]),
235
                   .wr_data             (wr_data@[32:0]),
236
                   .rw_addr             (rw_addr@[5:0]),
237
                   .rst_l               (rst_l),
238
                   .rst_warm               (rst_warm_d),
239
                   .rst_tri_en               (rst_tri_en),
240
                   .sehold               (sehold),
241
                   .inv_mask            (inv_mask@[7:0]));
242
*/
243
 
244
        dcm_panel       panel0(.si(),
245
                               .so(),
246
                               .se(se),
247
                                /*AUTOINST*/
248
                               // Outputs
249
                               .lkup_hit(lkup_hit0[31:0]),       // Templated
250
                               .rd_data (rd_data0[31:0]),        // Templated
251
                               // Inputs
252
                               .rd_en   (rd_en[0]),              // Templated
253
                               .wr_en   (wr_en[0]),              // Templated
254
                               .cam_en  (cam_en[0]),             // Templated
255
                               .wr_data (wr_data0[32:0]),        // Templated
256
                               .rw_addr (rw_addr0[5:0]),         // Templated
257
                               .inv_mask(inv_mask0[7:0]),        // Templated
258
                               .rst_l   (rst_l),                 // Templated
259
                               .rclk    (rclk),
260
                               .rst_warm(rst_warm_d),            // Templated
261
                               .rst_tri_en(rst_tri_en),          // Templated
262
                               .sehold  (sehold));                // Templated
263
 
264
        assign   bank_hit      =    lkup_hit0 | lkup_hit1 ;
265
 
266
        dcm_panel       panel1(.si(),
267
                               .so(),
268
                               .se(se),
269
                                /*AUTOINST*/
270
                               // Outputs
271
                               .lkup_hit(lkup_hit1[31:0]),       // Templated
272
                               .rd_data (rd_data1[31:0]),        // Templated
273
                               // Inputs
274
                               .rd_en   (rd_en[1]),              // Templated
275
                               .wr_en   (wr_en[1]),              // Templated
276
                               .cam_en  (cam_en[1]),             // Templated
277
                               .wr_data (wr_data1[32:0]),        // Templated
278
                               .rw_addr (rw_addr1[5:0]),         // Templated
279
                               .inv_mask(inv_mask1[7:0]),        // Templated
280
                               .rst_l   (rst_l),                 // Templated
281
                               .rclk    (rclk),
282
                               .rst_warm(rst_warm_d),            // Templated
283
                               .rst_tri_en(rst_tri_en),          // Templated
284
                               .sehold  (sehold));                // Templated
285
 
286
 
287
endmodule
288
 
289
 
290
////////////////////////////////////////////////////////////////////////
291
// Local header file includes / local defines
292
// A directory panel is 32 bits wide and 64 entries deep.
293
// The lkup_hit combines the match lines for an even and odd entry pair
294
// and hence is only 32 bits wide.
295
////////////////////////////////////////////////////////////////////////
296
 
297
 
298
module dcm_panel(  /*AUTOARG*/
299
   // Outputs
300
   lkup_hit, rd_data, so,
301
   // Inputs
302
   rd_en, wr_en, cam_en, wr_data, rw_addr, inv_mask, rst_l, rclk,
303
   rst_warm, si, se, rst_tri_en, sehold
304
   );
305
 
306
 
307
// Read inputs
308
input           rd_en;
309
input           wr_en;
310
input           cam_en;
311
input   [32:0]   wr_data; // { addr<39:10>, addr<8>, parity, valid  }
312
 
313
 
314
// shared inputs 
315
input   [5:0]    rw_addr; // even entries will have wr_data<0> == 0
316
input   [7:0]    inv_mask;
317
 
318
 
319
output  [31:0]   lkup_hit;
320
output  [31:0]   rd_data; // { addr<39:10>, parity, valid } 
321
 
322
input           rst_l;
323
input           rclk;
324
input           rst_warm;
325
 
326
input           si, se;
327
output          so;
328
input           rst_tri_en;
329
input           sehold;
330
 
331
 
332
reg     [29:0]   addr_array[63:0] ;
333
reg     [63:0]   valid   ;
334
reg     [63:0]   parity  ;
335
reg     [29:0]   temp_addr0 ;
336
reg     [29:0]   temp_addr1 ;
337
reg     [31:0]   rd_data;
338
reg     [31:0]   lkup_hit;
339
reg     [63:0]   cam_hit;
340
 
341
 
342
reg     [63:0]   reset_valid;
343
reg     [63:0]   valid_bit;
344
 
345
reg             rd_en_d, wr_en_d;
346
reg             cam_en_d ;
347
reg     [7:0]   inval_mask_d;
348
reg     [5:0]   rw_addr_d;
349
//reg   wr_en_off_d1;
350
reg     rst_tri_en_d1;
351
 
352
 
353
wire    [7:0]    inval_mask;
354
integer i,j;
355
 
356
always  @(posedge rclk)
357
begin
358
        rd_en_d <= (sehold)? rd_en_d: rd_en ;
359
        wr_en_d <= (sehold)? wr_en_d: wr_en;
360
        rw_addr_d <= (sehold)? rw_addr_d : rw_addr  ;
361
        cam_en_d <= ( sehold)? cam_en_d: cam_en ;
362
        inval_mask_d <= ( sehold)? inval_mask_d : inv_mask ;
363
 
364
        rst_tri_en_d1 <= rst_tri_en ; // this is a dummy flop only used as a trigger
365
end
366
 
367
 
368
 
369
//--------\/-------------
370
// VALID flop logic
371
//--------\/-------------
372
always  @(posedge rclk) begin
373
                valid_bit <= valid;
374
end
375
 
376
 
377
reg     cam_out;
378
 
379
 
380
// CAM OPERATION and reset_valid generation
381
// the following always block ensures that lkup_hit will be 
382
// a ph1 signal.
383
 
384
always  @( /*AUTOSENSE*/ /*memory or*/ cam_en_d or inval_mask_d or rst_tri_en or
385
           rst_tri_en_d1 or valid_bit or wr_data or rst_warm or rst_l)
386
 
387
 begin
388
 
389
 
390
                cam_out = cam_en_d & ~(rst_tri_en | rst_tri_en_d1)  ;
391
 
392
 
393
 
394
                cam_hit[0] = ( wr_data[32:3] == addr_array[0] )  &
395
                                 cam_out &   ~wr_data[2] & valid_bit[0]  ;
396
                reset_valid[0] = (cam_hit[0] & inval_mask_d[0]) ;
397
                cam_hit[1] = ( wr_data[32:3] == addr_array[1] )  &
398
                                  cam_out &  wr_data[2]  & valid_bit[1];
399
                reset_valid[1] = (cam_hit[1] & inval_mask_d[0]) ;
400
 
401
                lkup_hit[0] = ( cam_hit[0]  |  cam_hit[1] ) ;
402
 
403
 
404
 
405
                cam_hit[2] = ( wr_data[32:3] == addr_array[2] )  &
406
                                   cam_out & ~wr_data[2] & valid_bit[2]  ;
407
                reset_valid[2] = (cam_hit[2] & inval_mask_d[0]) ;
408
                cam_hit[3] = ( wr_data[32:3] == addr_array[3] )  &
409
                                   cam_out & wr_data[2]  & valid_bit[3];
410
                reset_valid[3] = (cam_hit[3] & inval_mask_d[0]) ;
411
 
412
                lkup_hit[1] = ( cam_hit[2]  |  cam_hit[3] );
413
 
414
 
415
 
416
                cam_hit[4] = ( wr_data[32:3] == addr_array[4] )  &
417
                                   cam_out & ~wr_data[2] & valid_bit[4]  ;
418
                reset_valid[4] = (cam_hit[4] & inval_mask_d[0]) ;
419
                cam_hit[5] = ( wr_data[32:3] == addr_array[5] )  &
420
                                   cam_out & wr_data[2]  & valid_bit[5];
421
                reset_valid[5] = (cam_hit[5] & inval_mask_d[0]) ;
422
 
423
                lkup_hit[2] = ( cam_hit[4]  |  cam_hit[5] );
424
 
425
 
426
 
427
                cam_hit[6] = ( wr_data[32:3] == addr_array[6] )  &
428
                                   cam_out & ~wr_data[2] & valid_bit[6]  ;
429
                reset_valid[6] = (cam_hit[6] & inval_mask_d[0]) ;
430
                cam_hit[7] = ( wr_data[32:3] == addr_array[7] )  &
431
                                   cam_out & wr_data[2]  & valid_bit[7];
432
                reset_valid[7] = (cam_hit[7] & inval_mask_d[0]) ;
433
 
434
                lkup_hit[3] = ( cam_hit[6]  |  cam_hit[7] );
435
 
436
 
437
 
438
                cam_hit[8] = ( wr_data[32:3] == addr_array[8] )  &
439
                                   cam_out & ~wr_data[2] & valid_bit[8]  ;
440
                reset_valid[8] = (cam_hit[8] & inval_mask_d[1]) ;
441
                cam_hit[9] = ( wr_data[32:3] == addr_array[9] )  &
442
                                   cam_out & wr_data[2]  & valid_bit[9];
443
                reset_valid[9] = (cam_hit[9] & inval_mask_d[1]) ;
444
 
445
                lkup_hit[4] = ( cam_hit[8]  |  cam_hit[9] );
446
 
447
 
448
 
449
                cam_hit[10] = ( wr_data[32:3] == addr_array[10] )  &
450
                                   cam_out & ~wr_data[2] & valid_bit[10]  ;
451
                reset_valid[10] = (cam_hit[10] & inval_mask_d[1]) ;
452
                cam_hit[11] = ( wr_data[32:3] == addr_array[11] )  &
453
                                   cam_out & wr_data[2]  & valid_bit[11];
454
                reset_valid[11] = (cam_hit[11] & inval_mask_d[1]) ;
455
 
456
                lkup_hit[5] = ( cam_hit[10]  |  cam_hit[11] );
457
 
458
 
459
 
460
                cam_hit[12] = ( wr_data[32:3] == addr_array[12] )  &
461
                                   cam_out & ~wr_data[2] & valid_bit[12]  ;
462
                reset_valid[12] = (cam_hit[12] & inval_mask_d[1]) ;
463
                cam_hit[13] = ( wr_data[32:3] == addr_array[13] )  &
464
                                   cam_out & wr_data[2]  & valid_bit[13];
465
                reset_valid[13] = (cam_hit[13] & inval_mask_d[1]) ;
466
 
467
                lkup_hit[6] = ( cam_hit[12]  |  cam_hit[13] );
468
 
469
 
470
 
471
                cam_hit[14] = ( wr_data[32:3] == addr_array[14] )  &
472
                                  cam_out &  ~wr_data[2] & valid_bit[14]  ;
473
                reset_valid[14] = (cam_hit[14] & inval_mask_d[1]) ;
474
                cam_hit[15] = ( wr_data[32:3] == addr_array[15] )  &
475
                                  cam_out &  wr_data[2]  & valid_bit[15];
476
                reset_valid[15] = (cam_hit[15] & inval_mask_d[1]) ;
477
 
478
                lkup_hit[7] = ( cam_hit[14]  |  cam_hit[15] );
479
 
480
 
481
 
482
                cam_hit[16] = ( wr_data[32:3] == addr_array[16] )  &
483
                                 cam_out &   ~wr_data[2] & valid_bit[16]  ;
484
                reset_valid[16] = (cam_hit[16] & inval_mask_d[2]) ;
485
                cam_hit[17] = ( wr_data[32:3] == addr_array[17] )  &
486
                                  cam_out &  wr_data[2]  & valid_bit[17];
487
                reset_valid[17] = (cam_hit[17] & inval_mask_d[2]) ;
488
 
489
                lkup_hit[8] = ( cam_hit[16]  |  cam_hit[17] );
490
 
491
 
492
 
493
                cam_hit[18] = ( wr_data[32:3] == addr_array[18] )  &
494
                                  cam_out &  ~wr_data[2] & valid_bit[18]  ;
495
                reset_valid[18] = (cam_hit[18] & inval_mask_d[2]) ;
496
                cam_hit[19] = ( wr_data[32:3] == addr_array[19] )  &
497
                                  cam_out &  wr_data[2]  & valid_bit[19];
498
                reset_valid[19] = (cam_hit[19] & inval_mask_d[2]) ;
499
 
500
                lkup_hit[9] = ( cam_hit[18]  |  cam_hit[19] );
501
 
502
 
503
 
504
                cam_hit[20] = ( wr_data[32:3] == addr_array[20] )  &
505
                                 cam_out &   ~wr_data[2] & valid_bit[20]  ;
506
                reset_valid[20] = (cam_hit[20] & inval_mask_d[2]) ;
507
                cam_hit[21] = ( wr_data[32:3] == addr_array[21] )  &
508
                                 cam_out &   wr_data[2]  & valid_bit[21];
509
                reset_valid[21] = (cam_hit[21] & inval_mask_d[2]) ;
510
 
511
                lkup_hit[10] = ( cam_hit[20]  |  cam_hit[21] );
512
 
513
 
514
 
515
                cam_hit[22] = ( wr_data[32:3] == addr_array[22] )  &
516
                                  cam_out &  ~wr_data[2] & valid_bit[22]  ;
517
                reset_valid[22] = (cam_hit[22] & inval_mask_d[2]) ;
518
                cam_hit[23] = ( wr_data[32:3] == addr_array[23] )  &
519
                                  cam_out &  wr_data[2]  & valid_bit[23];
520
                reset_valid[23] = (cam_hit[23] & inval_mask_d[2]) ;
521
 
522
                lkup_hit[11] = ( cam_hit[22]  |  cam_hit[23] );
523
 
524
 
525
 
526
                cam_hit[24] = ( wr_data[32:3] == addr_array[24] )  &
527
                                cam_out &    ~wr_data[2] & valid_bit[24]  ;
528
                reset_valid[24] = (cam_hit[24] & inval_mask_d[3]) ;
529
                cam_hit[25] = ( wr_data[32:3] == addr_array[25] )  &
530
                                cam_out &    wr_data[2]  & valid_bit[25];
531
                reset_valid[25] = (cam_hit[25] & inval_mask_d[3]) ;
532
 
533
                lkup_hit[12] = ( cam_hit[24]  |  cam_hit[25] );
534
 
535
 
536
 
537
                cam_hit[26] = ( wr_data[32:3] == addr_array[26] )  &
538
                                cam_out &    ~wr_data[2] & valid_bit[26]  ;
539
                reset_valid[26] = (cam_hit[26] & inval_mask_d[3]) ;
540
                cam_hit[27] = ( wr_data[32:3] == addr_array[27] )  &
541
                                cam_out &    wr_data[2]  & valid_bit[27];
542
                reset_valid[27] = (cam_hit[27] & inval_mask_d[3]) ;
543
 
544
                lkup_hit[13] = ( cam_hit[26]  |  cam_hit[27] );
545
 
546
 
547
 
548
                cam_hit[28] = ( wr_data[32:3] == addr_array[28] )  &
549
                                cam_out &    ~wr_data[2] & valid_bit[28]  ;
550
                reset_valid[28] = (cam_hit[28] & inval_mask_d[3]) ;
551
                cam_hit[29] = ( wr_data[32:3] == addr_array[29] )  &
552
                                cam_out &    wr_data[2]  & valid_bit[29];
553
                reset_valid[29] = (cam_hit[29] & inval_mask_d[3]) ;
554
 
555
                lkup_hit[14] = ( cam_hit[28]  |  cam_hit[29] );
556
 
557
 
558
 
559
                cam_hit[30] = ( wr_data[32:3] == addr_array[30] )  &
560
                                 cam_out &   ~wr_data[2] & valid_bit[30]  ;
561
                reset_valid[30] = (cam_hit[30] & inval_mask_d[3]) ;
562
                cam_hit[31] = ( wr_data[32:3] == addr_array[31] )  &
563
                                 cam_out &   wr_data[2]  & valid_bit[31];
564
                reset_valid[31] = (cam_hit[31] & inval_mask_d[3]) ;
565
 
566
                lkup_hit[15] = ( cam_hit[30]  |  cam_hit[31] );
567
 
568
 
569
 
570
                cam_hit[32] = ( wr_data[32:3] == addr_array[32] )  &
571
                              cam_out &      ~wr_data[2] & valid_bit[32]  ;
572
                reset_valid[32] = (cam_hit[32] & inval_mask_d[4]) ;
573
                cam_hit[33] = ( wr_data[32:3] == addr_array[33] )  &
574
                              cam_out &      wr_data[2]  & valid_bit[33];
575
                reset_valid[33] = (cam_hit[33] & inval_mask_d[4]) ;
576
 
577
                lkup_hit[16] = ( cam_hit[32]  |  cam_hit[33] );
578
 
579
 
580
 
581
                cam_hit[34] = ( wr_data[32:3] == addr_array[34] )  &
582
                               cam_out &     ~wr_data[2] & valid_bit[34]  ;
583
                reset_valid[34] = (cam_hit[34] & inval_mask_d[4]) ;
584
                cam_hit[35] = ( wr_data[32:3] == addr_array[35] )  &
585
                                cam_out &    wr_data[2]  & valid_bit[35];
586
                reset_valid[35] = (cam_hit[35] & inval_mask_d[4]) ;
587
 
588
                lkup_hit[17] = ( cam_hit[34]  |  cam_hit[35] );
589
 
590
 
591
 
592
                cam_hit[36] = ( wr_data[32:3] == addr_array[36] )  &
593
                                cam_out &    ~wr_data[2] & valid_bit[36]  ;
594
                reset_valid[36] = (cam_hit[36] & inval_mask_d[4]) ;
595
                cam_hit[37] = ( wr_data[32:3] == addr_array[37] )  &
596
                                cam_out &    wr_data[2]  & valid_bit[37];
597
                reset_valid[37] = (cam_hit[37] & inval_mask_d[4]) ;
598
 
599
                lkup_hit[18] = ( cam_hit[36]  |  cam_hit[37] );
600
 
601
 
602
 
603
                cam_hit[38] = ( wr_data[32:3] == addr_array[38] )  &
604
                               cam_out &     ~wr_data[2] & valid_bit[38]  ;
605
                reset_valid[38] = (cam_hit[38] & inval_mask_d[4]) ;
606
                cam_hit[39] = ( wr_data[32:3] == addr_array[39] )  &
607
                               cam_out &     wr_data[2]  & valid_bit[39];
608
                reset_valid[39] = (cam_hit[39] & inval_mask_d[4]) ;
609
 
610
                lkup_hit[19] = ( cam_hit[38]  |  cam_hit[39] );
611
 
612
 
613
 
614
                cam_hit[40] = ( wr_data[32:3] == addr_array[40] )  &
615
                               cam_out &     ~wr_data[2] & valid_bit[40]  ;
616
                reset_valid[40] = (cam_hit[40] & inval_mask_d[5]) ;
617
                cam_hit[41] = ( wr_data[32:3] == addr_array[41] )  &
618
                               cam_out &     wr_data[2]  & valid_bit[41];
619
                reset_valid[41] = (cam_hit[41] & inval_mask_d[5]) ;
620
 
621
                lkup_hit[20] = ( cam_hit[40]  |  cam_hit[41] );
622
 
623
 
624
 
625
                cam_hit[42] = ( wr_data[32:3] == addr_array[42] )  &
626
                              cam_out &      ~wr_data[2] & valid_bit[42]  ;
627
                reset_valid[42] = (cam_hit[42] & inval_mask_d[5]) ;
628
                cam_hit[43] = ( wr_data[32:3] == addr_array[43] )  &
629
                              cam_out &      wr_data[2]  & valid_bit[43];
630
                reset_valid[43] = (cam_hit[43] & inval_mask_d[5]) ;
631
 
632
                lkup_hit[21] = ( cam_hit[42]  |  cam_hit[43] );
633
 
634
 
635
 
636
                cam_hit[44] = ( wr_data[32:3] == addr_array[44] )  &
637
                              cam_out &      ~wr_data[2] & valid_bit[44]  ;
638
                reset_valid[44] = (cam_hit[44] & inval_mask_d[5]) ;
639
                cam_hit[45] = ( wr_data[32:3] == addr_array[45] )  &
640
                              cam_out &      wr_data[2]  & valid_bit[45];
641
                reset_valid[45] = (cam_hit[45] & inval_mask_d[5]) ;
642
 
643
                lkup_hit[22] = ( cam_hit[44]  |  cam_hit[45] );
644
 
645
 
646
 
647
                cam_hit[46] = ( wr_data[32:3] == addr_array[46] )  &
648
                             cam_out & ~wr_data[2] & valid_bit[46]  ;
649
                reset_valid[46] = (cam_hit[46] & inval_mask_d[5]) ;
650
                cam_hit[47] = ( wr_data[32:3] == addr_array[47] )  &
651
                             cam_out & wr_data[2]  & valid_bit[47];
652
                reset_valid[47] = (cam_hit[47] & inval_mask_d[5]) ;
653
 
654
                lkup_hit[23] = ( cam_hit[46]  |  cam_hit[47] );
655
 
656
 
657
 
658
                cam_hit[48] = ( wr_data[32:3] == addr_array[48] )  &
659
                           cam_out &  ~wr_data[2] & valid_bit[48]  ;
660
                reset_valid[48] = (cam_hit[48] & inval_mask_d[6]) ;
661
                cam_hit[49] = ( wr_data[32:3] == addr_array[49] )  &
662
                           cam_out &  wr_data[2]  & valid_bit[49];
663
                reset_valid[49] = (cam_hit[49] & inval_mask_d[6]) ;
664
 
665
                lkup_hit[24] = ( cam_hit[48]  |  cam_hit[49] );
666
 
667
 
668
 
669
                cam_hit[50] = ( wr_data[32:3] == addr_array[50] )  &
670
                           cam_out &  ~wr_data[2] & valid_bit[50]  ;
671
                reset_valid[50] = (cam_hit[50] & inval_mask_d[6]) ;
672
                cam_hit[51] = ( wr_data[32:3] == addr_array[51] )  &
673
                           cam_out &  wr_data[2]  & valid_bit[51];
674
                reset_valid[51] = (cam_hit[51] & inval_mask_d[6]) ;
675
 
676
                lkup_hit[25] = ( cam_hit[50]  |  cam_hit[51] );
677
 
678
 
679
 
680
                cam_hit[52] = ( wr_data[32:3] == addr_array[52] )  &
681
                            cam_out &  ~wr_data[2] & valid_bit[52]  ;
682
                reset_valid[52] = (cam_hit[52] & inval_mask_d[6]) ;
683
                cam_hit[53] = ( wr_data[32:3] == addr_array[53] )  &
684
                             cam_out &  wr_data[2]  & valid_bit[53];
685
                reset_valid[53] = (cam_hit[53] & inval_mask_d[6]) ;
686
 
687
                lkup_hit[26] = ( cam_hit[52]  |  cam_hit[53] );
688
 
689
 
690
 
691
                cam_hit[54] = ( wr_data[32:3] == addr_array[54] )  &
692
                             cam_out & ~wr_data[2] & valid_bit[54]  ;
693
                reset_valid[54] = (cam_hit[54] & inval_mask_d[6]) ;
694
                cam_hit[55] = ( wr_data[32:3] == addr_array[55] )  &
695
                             cam_out &  wr_data[2]  & valid_bit[55];
696
                reset_valid[55] = (cam_hit[55] & inval_mask_d[6]) ;
697
 
698
                lkup_hit[27] = ( cam_hit[54]  |  cam_hit[55] );
699
 
700
 
701
 
702
                cam_hit[56] = ( wr_data[32:3] == addr_array[56] )  &
703
                         cam_out & ~wr_data[2] & valid_bit[56]  ;
704
                reset_valid[56] = (cam_hit[56] & inval_mask_d[7]) ;
705
                cam_hit[57] = ( wr_data[32:3] == addr_array[57] )  &
706
                         cam_out &  wr_data[2]  & valid_bit[57];
707
                reset_valid[57] = (cam_hit[57] & inval_mask_d[7]) ;
708
 
709
                lkup_hit[28] = ( cam_hit[56]  |  cam_hit[57] );
710
 
711
 
712
 
713
                cam_hit[58] = ( wr_data[32:3] == addr_array[58] )  &
714
                         cam_out & ~wr_data[2] & valid_bit[58]  ;
715
                reset_valid[58] = (cam_hit[58] & inval_mask_d[7]) ;
716
                cam_hit[59] = ( wr_data[32:3] == addr_array[59] )  &
717
                         cam_out &  wr_data[2]  & valid_bit[59];
718
                reset_valid[59] = (cam_hit[59] & inval_mask_d[7]) ;
719
 
720
                lkup_hit[29] = ( cam_hit[58]  |  cam_hit[59] );
721
 
722
 
723
 
724
                cam_hit[60] = ( wr_data[32:3] == addr_array[60] )  &
725
                         cam_out & ~wr_data[2] & valid_bit[60]  ;
726
                reset_valid[60] = (cam_hit[60] & inval_mask_d[7]) ;
727
                cam_hit[61] = ( wr_data[32:3] == addr_array[61] )  &
728
                         cam_out &  wr_data[2]  & valid_bit[61];
729
                reset_valid[61] = (cam_hit[61] & inval_mask_d[7]) ;
730
 
731
                lkup_hit[30] = ( cam_hit[60]  |  cam_hit[61] );
732
 
733
 
734
 
735
                cam_hit[62] = ( wr_data[32:3] == addr_array[62] )  &
736
                        cam_out & ~wr_data[2] & valid_bit[62]  ;
737
                reset_valid[62] = (cam_hit[62] & inval_mask_d[7]) ;
738
                cam_hit[63] = ( wr_data[32:3] == addr_array[63] )  &
739
                        cam_out & wr_data[2]  & valid_bit[63];
740
                reset_valid[63] = (cam_hit[63] & inval_mask_d[7]) ;
741
 
742
                lkup_hit[31] = ( cam_hit[62]  |  cam_hit[63] );
743
 
744
                if( !rst_l | (rst_warm & ~(rst_tri_en | rst_tri_en_d1)) )  begin
745
                        valid = 64'b0;
746
                end
747
 
748
                else if(cam_out) begin
749
                        valid = valid_bit & ~reset_valid;
750
                end
751
 
752
                // else valid = valid ( implicit latch )
753
 
754
 
755
end
756
 
757
 
758
////////////////////////////////////////////////////////////
759
// READ/WRITE  OPERATION
760
// Phase 1 RD
761
////////////////////////////////////////////////////////////
762
 
763
always @(negedge rclk) begin
764
 
765
        if(rd_en_d & ~rst_tri_en) begin
766
                rd_data = {     addr_array[rw_addr_d],
767
                                parity[rw_addr_d] ,
768
                                valid_bit[rw_addr_d]
769
                         };
770
`ifdef  INNO_MUXEX
771
`else
772
`ifdef DEFINE_0IN
773
`else
774
                if(wr_en_d) begin
775
                `ifdef MODELSIM
776
                   $display("L2_DIR_ERR"," rd/wr conflict");
777
                `else
778
                   $error("L2_DIR_ERR"," rd/wr conflict");
779
                `endif
780
                end
781
`endif
782
`endif
783
 
784
        end // of if rd_en_d
785
 
786
  // WR
787
`ifdef DEFINE_0IN
788
`else
789
        if(wr_en_d & ~rst_tri_en ) begin
790
                // ---- \/ modelling write though behaviour \/-------
791
                rd_data = {     wr_data[32:3],
792
                                wr_data[1] ,
793
                                wr_data[0]
794
                         };
795
 
796
                parity[rw_addr_d]  =  wr_data[1] ;
797
                valid[rw_addr_d]  =  wr_data[0] ;
798
                addr_array[rw_addr_d] =  wr_data[32:3] ;
799
 
800
`ifdef  INNO_MUXEX
801
`else
802
                if(cam_en_d) begin
803
                `ifdef MODELSIM
804
                   $display("L2_DIR_ERR"," cam/wr conflict");
805
                `else
806
                   $error("L2_DIR_ERR"," cam/wr conflict");
807
                `endif
808
                end
809
`endif
810
 
811
        end
812
`endif
813
 
814
 
815
        //if( !rst_l | (rst_warm & ~rst_tri_en) ) valid = 64'b0;
816
        //else  valid = valid & ~reset_valid;
817
 
818
end
819
 
820
 
821
 
822
 
823
`ifdef DEFINE_0IN
824
always  @(posedge rclk)
825
begin
826
        if(!rst_l) begin        // rst_l all valid bits
827
                valid_bit = 64'b0 ;
828
        end else if(~rd_en_d & wr_en_d) begin
829
                addr_array[rw_addr_d] =  wr_data[32:3] ;
830
                parity[rw_addr_d]  =  wr_data[1] ;
831
                valid_bit[rw_addr_d]  =  wr_data[0] ;
832
        end
833
end
834
`endif
835
 
836
 
837
 
838
 
839
 
840
 
841
endmodule

powered by: WebSVN 2.1.0

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