Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / spc / tlu / rtl / tlu_ecg_dp.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: tlu_ecg_dp.v
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35module tlu_ecg_dp (
36 data_in,
37 ecc_out);
38wire [67:0] d;
39wire [36:0] check0_bus;
40wire check0_4;
41wire check0_3;
42wire check0_2;
43wire check0_1;
44wire check0_0;
45wire c0;
46wire [36:0] check1_bus;
47wire check1_4;
48wire check1_3;
49wire check1_2;
50wire check1_1;
51wire check1_0;
52wire c1;
53wire [34:0] check2_bus;
54wire check2_3;
55wire check2_2;
56wire check2_1;
57wire check2_0;
58wire c2;
59wire [34:0] check3_bus;
60wire check3_3;
61wire check3_2;
62wire check3_1;
63wire check3_0;
64wire c3;
65wire [30:0] check4_bus;
66wire c4;
67wire [30:0] check5_bus;
68wire c5;
69wire [10:0] check6_bus;
70wire c6;
71wire [36:0] check7_bus;
72wire check7_4;
73wire check7_3;
74wire check7_2;
75wire check7_1;
76wire check7_0;
77wire c7;
78
79
80
81input [67:0] data_in; // Used for generation and checking
82
83output [7:0] ecc_out; // Used for generation and checking
84
85
86
87//////////////////////////////////////////////////////////////////////////////
88
89// Position Binary
90// 1 0000001 C0
91// 2 0000010 C1
92// 3 0000011 D0
93//
94// 4 0000100 C2
95// 5 0000101 D1
96// 6 0000110 D2
97// 7 0000111 D3
98//
99// 8 0001000 C3
100// 9 0001001 D4
101// 10 0001010 D5
102// 11 0001011 D6
103// 12 0001100 D7
104// ... ...
105// 15 0001111 D10
106//
107// 16 0010000 C4
108// 17 0010001 D11
109// ... ...
110// 20 0010100 D14
111// ... ...
112// 24 0011000 D18
113// ... ...
114// 28 0011100 D22
115// ... ...
116// 31 0011111 D25
117//
118// 32 0100000 C5
119// 33 0100001 D26
120// ... ...
121// 36 0100100 D29
122// ... ...
123// 40 0101000 D33
124// ... ...
125// 44 0101100 D37
126// ... ...
127// 48 0110000 D41
128// ... ...
129// 52 0110100 D45
130// ... ...
131// 56 0111000 D49
132// ... ...
133// 60 0111100 D53
134// ... ...
135// 63 0111111 D56
136//
137// 64 1000000 C6
138// 65 1000001 D57
139// ... ...
140// 68 1000100 D60
141// ... ...
142// 72 1001000 D64
143// 73 1001001 D65
144// 74 1001010 D66
145// 75 1001011 D67
146//
147// 76 1001100 C7
148
149assign d[67:0] =
150 data_in[67:0];
151
152
153
154// All odd positions (LSB of position set)
155assign check0_bus[36:0] =
156 {d[67], d[65], d[63], d[61], d[59], d[57],
157 d[56], d[54], d[52], d[50], d[48], d[46], d[44], d[42],
158 d[40], d[38], d[36], d[34], d[32], d[30], d[28], d[26],
159 d[25], d[23], d[21], d[19], d[17], d[15], d[13], d[11],
160 d[10], d[8], d[6], d[4],
161 d[3], d[1],
162 d[0]};
163
164tlu_ecg_dp_prty_macro__width_4 check0_4_pty (
165 .din (check0_bus [35:32] ),
166 .dout (check0_4 )
167);
168
169tlu_ecg_dp_prty_macro__width_8 check0_3_pty (
170 .din (check0_bus [31:24] ),
171 .dout (check0_3 )
172);
173
174tlu_ecg_dp_prty_macro__width_8 check0_2_pty (
175 .din (check0_bus [23:16] ),
176 .dout (check0_2 )
177);
178
179tlu_ecg_dp_prty_macro__width_8 check0_1_pty (
180 .din (check0_bus [15:8] ),
181 .dout (check0_1 )
182);
183
184tlu_ecg_dp_prty_macro__width_8 check0_0_pty (
185 .din (check0_bus [7:0] ),
186 .dout (check0_0 )
187);
188
189tlu_ecg_dp_prty_macro__width_8 check0_pty (
190 .din ({{2 {1'b0}} ,
191 check0_bus [36 ],
192 check0_4 ,
193 check0_3 ,
194 check0_2 ,
195 check0_1 ,
196 check0_0 }),
197 .dout (c0 )
198);
199
200
201
202// All positions with secondmost LSB set
203assign check1_bus[36:0] =
204 {d[67:66], d[63:62], d[59:58],
205 d[56:55], d[52:51], d[48:47], d[44:43],
206 d[40:39], d[36:35], d[32:31], d[28:27],
207 d[25:24], d[21:20], d[17:16], d[13:12],
208 d[10:9], d[6:5],
209 d[3:2],
210 d[0]};
211
212tlu_ecg_dp_prty_macro__width_4 check1_4_pty (
213 .din (check1_bus [35:32] ),
214 .dout (check1_4 )
215);
216
217tlu_ecg_dp_prty_macro__width_8 check1_3_pty (
218 .din (check1_bus [31:24] ),
219 .dout (check1_3 )
220);
221
222tlu_ecg_dp_prty_macro__width_8 check1_2_pty (
223 .din (check1_bus [23:16] ),
224 .dout (check1_2 )
225);
226
227tlu_ecg_dp_prty_macro__width_8 check1_1_pty (
228 .din (check1_bus [15:8] ),
229 .dout (check1_1 )
230);
231
232tlu_ecg_dp_prty_macro__width_8 check1_0_pty (
233 .din (check1_bus [7:0] ),
234 .dout (check1_0 )
235);
236
237tlu_ecg_dp_prty_macro__width_8 check1_pty (
238 .din ({{2 {1'b0}} ,
239 check1_bus [36 ],
240 check1_4 ,
241 check1_3 ,
242 check1_2 ,
243 check1_1 ,
244 check1_0 }),
245 .dout (c1 )
246);
247
248
249
250// All positions with thirdmost LSB set
251assign check2_bus[34:0] =
252 {d[63:60],
253 d[56:53], d[48:45], d[40:37], d[32:29],
254 d[25:22], d[17:14],
255 d[10:7],
256 d[3:1]};
257
258tlu_ecg_dp_prty_macro__width_8 check2_3_pty (
259 .din (check2_bus [31:24] ),
260 .dout (check2_3 )
261);
262
263tlu_ecg_dp_prty_macro__width_8 check2_2_pty (
264 .din (check2_bus [23:16] ),
265 .dout (check2_2 )
266);
267
268tlu_ecg_dp_prty_macro__width_8 check2_1_pty (
269 .din (check2_bus [15:8] ),
270 .dout (check2_1 )
271);
272
273tlu_ecg_dp_prty_macro__width_8 check2_0_pty (
274 .din (check2_bus [7:0] ),
275 .dout (check2_0 )
276);
277
278tlu_ecg_dp_prty_macro__width_8 check2_pty (
279 .din ({{1 {1'b0}} ,
280 check2_bus [34:32],
281 check2_3 ,
282 check2_2 ,
283 check2_1 ,
284 check2_0 }),
285 .dout (c2 )
286);
287
288
289
290// All positions with fourthmost LSB set
291assign check3_bus[34:0] =
292 {d[67:64],
293 d[56:49], d[40:33],
294 d[25:18],
295 d[10:4]};
296
297tlu_ecg_dp_prty_macro__width_8 check3_3_pty (
298 .din (check3_bus [31:24] ),
299 .dout (check3_3 )
300);
301
302tlu_ecg_dp_prty_macro__width_8 check3_2_pty (
303 .din (check3_bus [23:16] ),
304 .dout (check3_2 )
305);
306
307tlu_ecg_dp_prty_macro__width_8 check3_1_pty (
308 .din (check3_bus [15:8] ),
309 .dout (check3_1 )
310);
311
312tlu_ecg_dp_prty_macro__width_8 check3_0_pty (
313 .din (check3_bus [7:0] ),
314 .dout (check3_0 )
315);
316
317tlu_ecg_dp_prty_macro__width_8 check3_pty (
318 .din ({{1 {1'b0}} ,
319 check3_bus [34:32],
320 check3_3 ,
321 check3_2 ,
322 check3_1 ,
323 check3_0 }),
324 .dout (c3 )
325);
326
327
328// All positions with fifthmost LSB set
329assign check4_bus[30:0] =
330 {d[56:41],
331 d[25:11]};
332
333tlu_ecg_dp_prty_macro__width_32 check4_pty (
334 .din ({{1 {1'b0}} ,
335 check4_bus [30:0]}),
336 .dout (c4 )
337);
338
339
340
341// All positions with sixthmost LSB set
342assign check5_bus[30:0] =
343 {d[56:26]};
344
345tlu_ecg_dp_prty_macro__width_32 check5_pty (
346 .din ({{1 {1'b0}} ,
347 check5_bus [30:0]}),
348 .dout (c5 )
349);
350
351
352
353// All positions with seventhmost LSB set
354assign check6_bus[10:0] =
355 {d[67:57]};
356
357tlu_ecg_dp_prty_macro__width_16 check6_pty (
358 .din ({{5 {1'b0}} ,
359 check6_bus [10:0]}),
360 .dout (c6 )
361);
362
363
364
365// Parity of the whole word (including check bits)
366//assign check7_bus[74:00] =
367// {d[67:00], c0, c1, c2, c3, c4, c5, c6};
368// But in generation this simplifies to
369// (all d bits with even parity binary positions)
370
371assign check7_bus[36:0] =
372// 76
373 {d[67],
374// 72 71 68 66 65 63 60 58 57
375 d[64], d[63], d[60], d[58], d[57], d[56], d[53], d[51], d[50],
376// 54 53 51 48 46 45 43 40 39
377 d[47], d[46], d[44], d[41], d[39], d[38], d[36], d[33], d[32],
378// 36 34 33 30 29 27 24 23 20
379 d[29], d[27], d[26], d[24], d[23], d[21], d[18], d[17], d[14],
380// 18 17 15 12 10 9 6 5 3
381 d[12], d[11], d[10], d[7], d[5], d[4], d[2], d[1], d[0]};
382
383tlu_ecg_dp_prty_macro__width_4 check7_4_pty (
384 .din (check7_bus [35:32] ),
385 .dout (check7_4 )
386);
387
388tlu_ecg_dp_prty_macro__width_8 check7_3_pty (
389 .din (check7_bus [31:24] ),
390 .dout (check7_3 )
391);
392
393tlu_ecg_dp_prty_macro__width_8 check7_2_pty (
394 .din (check7_bus [23:16] ),
395 .dout (check7_2 )
396);
397
398tlu_ecg_dp_prty_macro__width_8 check7_1_pty (
399 .din (check7_bus [15:8] ),
400 .dout (check7_1 )
401);
402
403tlu_ecg_dp_prty_macro__width_8 check7_0_pty (
404 .din (check7_bus [7:0] ),
405 .dout (check7_0 )
406);
407
408tlu_ecg_dp_prty_macro__width_8 check7_pty (
409 .din ({{2 {1'b0}} ,
410 check7_bus [36 ],
411 check7_4 ,
412 check7_3 ,
413 check7_2 ,
414 check7_1 ,
415 check7_0 }),
416 .dout (c7 )
417);
418
419assign ecc_out[7:0] =
420 {c7, c6, c5, c4, c3, c2, c1, c0};
421
422
423
424
425supply0 vss; // <- port for ground
426supply1 vdd; // <- port for power
427
428endmodule
429
430
431
432//
433// parity macro (even parity)
434//
435//
436
437
438
439
440
441module tlu_ecg_dp_prty_macro__width_4 (
442 din,
443 dout);
444 input [3:0] din;
445 output dout;
446
447
448
449
450
451
452
453prty #(4) m0_0 (
454.in(din[3:0]),
455.out(dout)
456);
457
458
459
460
461
462
463
464
465
466
467endmodule
468
469
470
471
472
473//
474// parity macro (even parity)
475//
476//
477
478
479
480
481
482module tlu_ecg_dp_prty_macro__width_8 (
483 din,
484 dout);
485 input [7:0] din;
486 output dout;
487
488
489
490
491
492
493
494prty #(8) m0_0 (
495.in(din[7:0]),
496.out(dout)
497);
498
499
500
501
502
503
504
505
506
507
508endmodule
509
510
511
512
513
514//
515// parity macro (even parity)
516//
517//
518
519
520
521
522
523module tlu_ecg_dp_prty_macro__width_32 (
524 din,
525 dout);
526 input [31:0] din;
527 output dout;
528
529
530
531
532
533
534
535prty #(32) m0_0 (
536.in(din[31:0]),
537.out(dout)
538);
539
540
541
542
543
544
545
546
547
548
549endmodule
550
551
552
553
554
555//
556// parity macro (even parity)
557//
558//
559
560
561
562
563
564module tlu_ecg_dp_prty_macro__width_16 (
565 din,
566 dout);
567 input [15:0] din;
568 output dout;
569
570
571
572
573
574
575
576prty #(16) m0_0 (
577.in(din[15:0]),
578.out(dout)
579);
580
581
582
583
584
585
586
587
588
589
590endmodule
591
592
593
594