-
Notifications
You must be signed in to change notification settings - Fork 2
/
Wire.cpp
791 lines (747 loc) · 26.4 KB
/
Wire.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
// This file contains code from NVSim, (c) 2012-2013, Pennsylvania State University
//and Hewlett-Packard Company. See LICENSE_NVSim file in the top-level directory.
//No part of DESTINY Project, including this file, may be copied,
//modified, propagated, or distributed except according to the terms
//contained in the LICENSE file.
#include "Wire.h"
#include "global.h"
#include "formula.h"
#include "constant.h"
#include <math.h>
Wire::Wire() {
// TODO Auto-generated constructor stub
initialized = false;
senseAmp = NULL;
}
Wire::~Wire() {
// TODO Auto-generated destructor stub
if (senseAmp)
delete senseAmp;
}
void Wire::Initialize(int _featureSizeInNano, WireType _wireType, WireRepeaterType _wireRepeaterType,
int _temperature, bool _isLowSwing) {
if (initialized) {
/* reload the new input, clear the previous setting */
initialized = false;
if (senseAmp)
delete senseAmp;
senseAmp = NULL;
}
featureSizeInNano = _featureSizeInNano;
featureSize = _featureSizeInNano * 1e-9;
wireType = _wireType;
wireRepeaterType = _wireRepeaterType;
temperature = _temperature;
isLowSwing = _isLowSwing;
if (wireRepeaterType != repeated_none && isLowSwing) {
cout << "[Wire] Error: Low Swing is not supported for repeated wires!" << endl;
exit(-1);
}
double copper_resistivity = COPPER_RESISTIVITY;
/* Initialize copper resistivity */
if (_featureSizeInNano <= 22) {
featureSize = 22e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.55;
wirePitch = 2 * featureSize;
aspectRatio = 1.9;
ildThickness = aspectRatio * featureSize;
copper_resistivity = 6.0e-8;
break;
case local_conservative:
barrierThickness = 0.0021e-6;
horizontalDielectric = 3;
wirePitch = 2 * featureSize;
aspectRatio = 1.9;
ildThickness = aspectRatio * featureSize;
copper_resistivity = 6.0e-8;
break;
case semi_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.55;
wirePitch = 4 * featureSize;
aspectRatio = 1.9;
ildThickness = 2 * aspectRatio * featureSize;
copper_resistivity = 6.0e-8;
break;
case semi_conservative:
barrierThickness = 0.0021e-6;
horizontalDielectric = 3;
wirePitch = 4 * featureSize;
aspectRatio = 1.9;
ildThickness = 2 * aspectRatio * featureSize;
copper_resistivity = 6.0e-8;
break;
case global_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.55;
wirePitch = 8 * featureSize;
aspectRatio = 2.34;
ildThickness = 0.42e-6 * 22 / 32;
copper_resistivity = 3.0e-8; /* TO-DO confusing data in ITRS */
break;
case global_conservative:
barrierThickness = 0.0063e-6; /* TO-DO No data in ITRS */
horizontalDielectric = 3;
wirePitch = 8 * featureSize;
aspectRatio = 2.34;
ildThickness = 0.385e-6 * 22 / 32;
copper_resistivity = 3.0e-8; /* TO-DO confusing data in ITRS */
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
} else if (_featureSizeInNano <= 32) {
featureSize = 32e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.82;
wirePitch = 2 * featureSize;
aspectRatio = 1.8;
ildThickness = aspectRatio * featureSize;
copper_resistivity = 5.0e-8;
break;
case local_conservative:
barrierThickness = 0.0026e-6;
horizontalDielectric = 3.16;
wirePitch = 2 * featureSize;
aspectRatio = 1.8;
ildThickness = aspectRatio * featureSize;
copper_resistivity = 5.0e-8;
break;
case semi_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.82;
wirePitch = 4 * featureSize;
aspectRatio = 1.9;
ildThickness = 2 * aspectRatio * featureSize;
copper_resistivity = 5.0e-8;
break;
case semi_conservative:
barrierThickness = 0.0026e-6;
horizontalDielectric = 3.16;
wirePitch = 4 * featureSize;
aspectRatio = 1.9;
ildThickness = 2 * aspectRatio * featureSize;
copper_resistivity = 5.0e-8;
break;
case global_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.82;
wirePitch = 8 * featureSize;
aspectRatio = 2.34;
ildThickness = 0.42e-6;
copper_resistivity = 2.5e-8; /* TO-DO confusing data in ITRS */
break;
case global_conservative:
barrierThickness = 0.0078e-6; /* TO-DO No data in ITRS */
horizontalDielectric = 3.16;
wirePitch = 8 * featureSize;
aspectRatio = 2.34;
ildThickness = 0.385e-6;
copper_resistivity = 2.5e-8; /* TO-DO confusing data in ITRS */
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
} else if (_featureSizeInNano <= 45) {
featureSize = 45e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.6;
wirePitch = 0.102e-6;
aspectRatio = 1.8;
ildThickness = 0.0918e-6;
copper_resistivity = 4.08e-8;
break;
case local_conservative:
barrierThickness = 0.0033e-6;
horizontalDielectric = 2.9;
wirePitch = 0.102e-6;
aspectRatio = 1.8;
ildThickness = 0.0918e-6;
copper_resistivity = 4.08e-8;
break;
case semi_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.6;
wirePitch = 4 * featureSize;
aspectRatio = 1.8;
ildThickness = 2 * aspectRatio * featureSize;
copper_resistivity = 4.08e-8;
break;
case semi_conservative:
barrierThickness = 0.0033e-6;
horizontalDielectric = 2.9;
wirePitch = 4 * featureSize;
aspectRatio = 1.8;
ildThickness = 2 * aspectRatio * featureSize;
copper_resistivity = 4.08e-8;
break;
case global_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.6;
wirePitch = 8 * featureSize;
aspectRatio = 2.34;
ildThickness = 0.63e-6;
copper_resistivity = 2.06e-8;
break;
case global_conservative:
barrierThickness = 0.01e-6;
horizontalDielectric = 2.9;
wirePitch = 8 * featureSize;
aspectRatio = 2.34;
ildThickness = 0.55e-6;
copper_resistivity = 2.06e-8;
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
} else if (_featureSizeInNano <= 65) {
featureSize = 65e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.303;
wirePitch = 2.5* featureSize;
aspectRatio = 2.7;
ildThickness = 0.405e-6;
break;
case local_conservative:
barrierThickness = 0.006e-6;
horizontalDielectric = 2.734;
wirePitch = 2.5* featureSize;
aspectRatio = 2.0;
ildThickness = 0.405e-6;
break;
case semi_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.303;
wirePitch = 4 * featureSize;
aspectRatio = 2.7;
ildThickness = 0.405e-6;
break;
case semi_conservative:
barrierThickness = 0.006e-6;
horizontalDielectric = 2.734;
wirePitch = 4 * featureSize;
aspectRatio = 2.0;
ildThickness = 0.405e-6;
break;
case global_aggressive:
barrierThickness = 0.00e-6;
horizontalDielectric = 2.303;
wirePitch = 8 * featureSize;
aspectRatio = 2.8;
ildThickness = 0.81e-6;
break;
case global_conservative:
barrierThickness = 0.006e-6;
horizontalDielectric = 2.734;
wirePitch = 8 * featureSize;
aspectRatio = 2.2;
ildThickness = 0.77e-6;
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
} else if (_featureSizeInNano <= 90) {
featureSize = 90e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.01e-6;
horizontalDielectric = 2.709;
wirePitch = 2.5* featureSize;
aspectRatio = 2.4;
ildThickness = 0.48e-6;
break;
case local_conservative:
barrierThickness = 0.008e-6;
horizontalDielectric = 3.038;
wirePitch = 2.5* featureSize;
aspectRatio = 2.0;
ildThickness = 0.48e-6;
break;
case semi_aggressive:
barrierThickness = 0.01e-6;
horizontalDielectric = 2.709;
wirePitch = 4 * featureSize;
aspectRatio = 2.4;
ildThickness = 0.48e-6;
break;
case semi_conservative:
barrierThickness = 0.008e-6;
horizontalDielectric = 3.038;
wirePitch = 4 * featureSize;
aspectRatio = 2.0;
ildThickness = 0.48e-6;
break;
case global_aggressive:
barrierThickness = 0.01e-6;
horizontalDielectric = 2.709;
wirePitch = 8 * featureSize;
aspectRatio = 2.7;
ildThickness = 0.96e-6;
break;
case global_conservative:
barrierThickness = 0.008e-6;
horizontalDielectric = 3.038;
wirePitch = 8 * featureSize;
aspectRatio = 2.2;
ildThickness = 1.1e-6;
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
} else if (_featureSizeInNano <= 120) {
featureSize = 120e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.012e-6;
horizontalDielectric = 3.3;
wirePitch = 240e-9;
aspectRatio = 1.6;
ildThickness = 0.48e-6;
break;
case local_conservative:
barrierThickness = 0.01e-6;
horizontalDielectric = 3.6;
wirePitch = 240e-9;
aspectRatio = 1.4;
ildThickness = 0.48e-6;
break;
case semi_aggressive:
barrierThickness = 0.012e-6;
horizontalDielectric = 3.3;
wirePitch = 320e-9;
aspectRatio = 1.7;
ildThickness = 0.48e-6;
break;
case semi_conservative:
barrierThickness = 0.01e-6;
horizontalDielectric = 3.6;
wirePitch = 320e-9;
aspectRatio = 1.5;
ildThickness = 0.48e-6;
break;
case global_aggressive:
barrierThickness = 0.012e-6;
horizontalDielectric = 3.3;
wirePitch = 475e-9;
aspectRatio = 2.1;
ildThickness = 0.96e-6;
break;
case global_conservative:
barrierThickness = 0.01e-6;
horizontalDielectric = 3.6;
wirePitch = 475e-9;
aspectRatio = 1.9;
ildThickness = 1.1e-6;
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
} else if (_featureSizeInNano <= 200) {
featureSize = 200e-9;
switch (wireType) {
case local_aggressive:
barrierThickness = 0.016e-6;
horizontalDielectric = 3.75;
wirePitch = 0.45e-6;
aspectRatio = 2.4;
ildThickness = 1e-6; /* TO-DO: for test */
break;
case local_conservative:
barrierThickness = 0.016e-6 * 0.8;
horizontalDielectric = 3.75 * 3.038 / 2.709;
wirePitch = 0.45e-6;
aspectRatio = 1.2;
ildThickness = 1e-6; /* TO-DO: for test */
break;
case semi_aggressive:
barrierThickness = 0.016e-6;
horizontalDielectric = 3.75;
wirePitch = 0.575e-6;
aspectRatio = 2.1;
ildThickness = 1e-6; /* TO-DO: for test */
break;
case semi_conservative:
barrierThickness = 0.016e-6 * 0.8;
horizontalDielectric = 3.75 * 3.038 / 2.709;
wirePitch = 0.575e-6;
aspectRatio = 2.1 * 2.0 / 2.4;
ildThickness = 1e-6; /* TO-DO: for test */
break;
case global_aggressive:
barrierThickness = 0.016e-6;
horizontalDielectric = 3.75;
wirePitch = 0.945e-6;
aspectRatio = 2.1;
ildThickness = 2e-6; /* TO-DO: for test */
break;
case global_conservative:
barrierThickness = 0.016e-6 * 0.8;
horizontalDielectric = 3.75 * 3.038 / 2.709;
wirePitch = 0.945e-6;
aspectRatio = 2.1 * 2.2 / 2.7;
ildThickness = 2.2e-6; /* TO-DO: for test */
break;
default: /* dram_wordline */
/* TO-DO CACTI does not have a detailed model for it */
barrierThickness = 0e-6;
horizontalDielectric = 0;
wirePitch = 2 * featureSize;
aspectRatio = 0;
ildThickness = 0e-6;
}
}
wireWidth = wirePitch / 2;
wireThickness = aspectRatio * wireWidth;
wireSpacing = wirePitch - wireWidth;
/* TO-DO: here we only support copper wire, aluminum is to be added */
copper_resistivity = copper_resistivity
* (1 + COPPER_RESISTIVITY_TEMPERATURE_COEFFICIENT * (temperature - 293));
resWirePerUnit = CalculateWireResistance(copper_resistivity, wireWidth, wireThickness, barrierThickness,
0 /* Dishing Thickness */, 1 /* Alpha Scatter */);
capWirePerUnit = CalculateWireCapacitance(PERMITTIVITY, wireWidth, wireThickness, wireSpacing,
ildThickness, 1.5 /* miller value */, horizontalDielectric, 3.9 /* Vertical Dielectric */,
1.15e-10 /* Fringe Capacitance (Unit: F/m), TO-DO: CACTI assumes a fixed number here */);
if (wireRepeaterType != repeated_none) {
/* If the repeaters are inserted in the wire */
findOptimalRepeater();
if (wireRepeaterType != repeated_opt) {
/* The repeated wire is not fully latency optimized */
double penalty;
switch (wireRepeaterType) {
case repeated_5:
penalty = 0.05;
break;
case repeated_10:
penalty = 0.10;
break;
case repeated_20:
penalty = 0.20;
break;
case repeated_30:
penalty = 0.30;
break;
case repeated_40:
penalty = 0.40;
break;
default: /* repeated_50 ? */
penalty = 0.50;
}
findPenalizedRepeater(penalty);
}
/* calculate repeated wire pitch */
CalculateGateArea(INV, 1, repeaterSize * MIN_NMOS_SIZE * tech->featureSize,
repeaterSize * MIN_NMOS_SIZE * tech->featureSize * tech->pnSizeRatio, 1e41, *tech,
&repeaterHeight, &repeaterWidth);
if (repeaterWidth < repeaterHeight) {
double temp = repeaterWidth;
repeaterWidth = repeaterHeight;
repeaterHeight = temp;
}
repeatedWirePitch = wirePitch + repeaterWidth;
}
initialized =true;
}
void Wire::CalculateLatencyAndPower(double _wireLength, double *delay, double *dynamicEnergy, double *leakagePower) {
if (!initialized) {
cout << "[Wire] Error: Require initialization first!" << endl;
} else {
if (isLowSwing) {
/* When it is low-swing */
if (wireRepeaterType == repeated_none) {
double widthNmos = MIN_NMOS_SIZE * tech->featureSize;
double widthPmos = widthNmos * tech->pnSizeRatio;
double capInput, capOutput;
double tr;
double gm;
double beta;
double resPullUp;
double resPullDown;
double capLoad;
double temp;
double riseTime, fallTime;
double rampInput;
/* Calculate rampInput */
CalculateGateCapacitance(INV, 1, widthNmos, widthPmos, tech->featureSize * MAX_TRANSISTOR_HEIGHT, *tech, &capInput, &capOutput);
capLoad = capInput + capOutput;
resPullUp = CalculateOnResistance(widthNmos, NMOS, inputParameter->temperature, *tech);
resPullUp = CalculateOnResistance(widthPmos, PMOS, inputParameter->temperature, *tech);
tr = resPullUp * capLoad;
gm = CalculateTransconductance(widthPmos, PMOS, *tech);
beta = 1 / (resPullUp * gm);
horowitz(tr, beta, 1e20, &riseTime);
resPullDown = CalculateOnResistance(widthNmos, NMOS, inputParameter->temperature, *tech);
tr = resPullDown * capLoad;
gm = CalculateTransconductance(widthNmos, NMOS, *tech);
beta = 1 / (resPullDown * gm);
horowitz(tr, beta, riseTime, &fallTime);
rampInput = fallTime;
/* Calculate FO4 delay */
double delayFO4;
capLoad = capOutput + 4 * capInput;
tr = resPullDown * capLoad;
delayFO4 = horowitz(tr, beta, 1e20, &temp);
/* Caluculate the size of driver */
double wireLength = _wireLength;
double capGateDriver;
double capWire = capWirePerUnit * wireLength;
double resWire = resWirePerUnit * wireLength;
double resDriver = ((-8) * delayFO4 / ( log(0.5) * capWire)) / RES_ADJ;
double widthNmosDriver = resPullDown * widthNmos / resDriver;
widthNmosDriver = MIN(widthNmosDriver, MAX_NMOS_SIZE * tech->featureSize);
widthNmosDriver = MAX(widthNmosDriver, MIN_NMOS_SIZE * tech->featureSize);
if(resWire * capWire > 8 * delayFO4)
{
widthNmosDriver = inputParameter->maxNmosSize * tech->featureSize;
}
// size the inverter appropriately to minimize the transmitter delay
// Note - In order to minimize leakage, we are not adding a set of inverters to
// bring down delay. Instead, we are sizing the single gate
// based on the logical effort.
CalculateGateCapacitance(INV, 1, widthNmosDriver, 0, tech->featureSize*40, *tech, &capGateDriver, &temp);
CalculateGateCapacitance(INV, 1, 2 * widthNmos, 2 * widthPmos, tech->featureSize*40, *tech, &capInput, &capOutput);
double stageEffort = sqrt(((2 + tech->pnSizeRatio) / (1 + tech->pnSizeRatio)) * capGateDriver / capInput);
double reqCin = (((2 + tech->pnSizeRatio) / (1 + tech->pnSizeRatio)) * capGateDriver) / stageEffort;
CalculateGateCapacitance(INV, 1, widthNmos, widthPmos, tech->featureSize*40, *tech, &capInput, &capOutput);
double sizeInverter = reqCin / capInput;
sizeInverter = MAX(sizeInverter, 1);
/* nand gate delay */
resPullDown *= 2;
beta = 1 / (resPullDown * gm);
double capNandInput, capNandOutput;
CalculateGateCapacitance(NAND, 2, 2 * widthNmos, widthPmos, tech->featureSize*40, *tech, &capNandInput, &capNandOutput);
CalculateGateCapacitance(INV, 1, sizeInverter * widthNmos, sizeInverter * widthPmos, tech->featureSize*40, *tech, &capInput, &capOutput);
capLoad = capNandOutput + capInput;
tr = resPullDown * capLoad;
*(delay) = horowitz(tr, beta, rampInput, &temp);
*(dynamicEnergy) = capLoad * tech->vdd * tech->vdd;
rampInput = temp; /* for the next stage */
/* Inverter *(delay):
* * The load capacitance of this inv depends on
* * the gate capacitance of the final stage nmos
* * transistor which in turn depends on nsize
* */
resPullDown = CalculateOnResistance(sizeInverter * widthNmos, NMOS, inputParameter->temperature, *tech);
gm = CalculateTransconductance(widthNmos, NMOS, *tech);
beta = 1 / (resPullDown * gm);
capLoad = capOutput + capGateDriver;
tr = resPullDown * capLoad;
*(delay) += horowitz(tr, beta, rampInput, &temp);
*(dynamicEnergy) += capLoad * tech->vdd * tech->vdd;
rampInput = temp; /* for the next stage */
*(leakagePower) = 2 * tech->vdd * CalculateGateLeakage(INV, 1, sizeInverter * widthNmos, sizeInverter * widthPmos, inputParameter->temperature, *tech);
*(leakagePower) += 2 * tech->vdd * CalculateGateLeakage(NAND, 2, 2 * widthNmos, widthPmos, inputParameter->temperature, *tech);
*(leakagePower) *= 2;
senseAmp = new SenseAmp;
senseAmp->Initialize(1, false, cell->minSenseVoltage, 1 /* for test */);
senseAmp->CalculateRC();
/* nmos *(delay) + wire *(delay) */
/*
* * NOTE: nmos is used as both pull up and pull down transistor
* * in the transmitter. This is because for low voltage swing, drive
* * resistance of nmos is less than pmos
* * (for a detailed graph ref: On-Chip Wires: Scaling and Efficiency)
*/
double drainCapDriver = CalculateDrainCap(widthNmosDriver, NMOS, tech->featureSize*40, *tech);
capLoad = capWire + drainCapDriver * 2 + senseAmp->capLoad;
resPullDown = CalculateOnResistance(widthNmosDriver, NMOS, inputParameter->temperature, *tech);
gm = CalculateTransconductance(widthNmosDriver, NMOS, *tech);
beta = 1 / (resPullDown * gm);
tr = resPullDown * RES_ADJ *(capWire + drainCapDriver * 2) + capWire * resWire / 2 + (resPullDown + resWire) * senseAmp->capLoad;
if (delay)
*(delay) += horowitz(tr, beta, rampInput, &temp); //TO-DO: inconsistent with Cacti 6.5
if (dynamicEnergy) {
*(dynamicEnergy) += capLoad * VOL_SWING * 0.4; /* .4v is the over drive voltage */
*(dynamicEnergy) *=2;
}
if (leakagePower)
*(leakagePower) += 4 * tech->vdd * CalculateGateLeakage(INV, 1, widthNmosDriver, 0, inputParameter->temperature, *tech);
/* SA *(delay) and power */
if (delay)
*(delay) += senseAmp->readLatency;
if (dynamicEnergy)
*(dynamicEnergy) += senseAmp->readDynamicEnergy;
if (leakagePower)
*(leakagePower) += senseAmp->leakage;
} else {
cout<<"Error: Low Swing Wires with Repeaters is not supported in this version!" <<endl;
exit(-1);
}
} else {
/* When it is not a low-swing */
if (wireRepeaterType == repeated_none) {
if (delay)
*(delay) = 2.3 * resWirePerUnit * capWirePerUnit * _wireLength * _wireLength / 2;
if (dynamicEnergy)
*(dynamicEnergy) = capWirePerUnit * _wireLength * tech->vdd * tech->vdd;
if (leakagePower)
*(leakagePower) = 0;
} else { /* with repeaters */
if (delay)
*(delay) = getRepeatedWireUnitDelay() * _wireLength;
if (dynamicEnergy)
*(dynamicEnergy) = getRepeatedWireUnitDynamicEnergy() * _wireLength;
if (leakagePower)
*(leakagePower) = getRepeatedWireUnitLeakage() * _wireLength;
}
}
}
}
void Wire::findOptimalRepeater() {
/* Use minimum sized inverter */
double nmosSize = MIN_NMOS_SIZE * tech->featureSize;
double pmosSize = nmosSize * tech->pnSizeRatio;
double inputCap = CalculateGateCap(nmosSize, *tech) + CalculateGateCap(pmosSize, *tech);
double outputCap = CalculateDrainCap(nmosSize, NMOS, 1 /*no limit*/, *tech)
+ CalculateDrainCap(pmosSize, PMOS, 1 /*no limit*/, *tech);
double outputRes = CalculateOnResistance(nmosSize, NMOS, inputParameter->temperature, *tech)
+ CalculateOnResistance(pmosSize, PMOS, inputParameter->temperature, *tech);
repeaterSize = sqrt(outputRes * capWirePerUnit / inputCap / resWirePerUnit);
repeaterSpacing = sqrt(2 * outputRes * (outputCap + inputCap) / (resWirePerUnit * capWirePerUnit));
//double tau = outputRes * (inputCap + outputCap) + outputRes * capWirePerUnit * repeaterSpacing
// + resWirePerUnit * repeaterSpacing * inputCap * repeaterSize
}
void Wire::findPenalizedRepeater(double _penalty) {
double targetDelay = getRepeatedWireUnitDelay() * (1 + _penalty);
double currentDynamicEnergy = getRepeatedWireUnitDynamicEnergy();
double currentLeakage = getRepeatedWireUnitLeakage();
double targetRepeaterSpacing = repeaterSpacing;
double targetRepeaterSize = repeaterSize;
double stepSpacing = 100e-6; /* 100um */
double endSpacing = 4 * repeaterSpacing;
double stepSize = 1; /* minimum buffer size */
double endSize = 1;
double thisDelay, thisDynamicEnergy, thisLeakage;
/* Start finding the target repeated wire */
for (; repeaterSpacing <= endSpacing; repeaterSpacing += stepSpacing) {
for (; repeaterSize >= endSize; repeaterSize -= stepSize) {
thisDelay = getRepeatedWireUnitDelay();
thisDynamicEnergy = getRepeatedWireUnitDynamicEnergy();
thisLeakage = getRepeatedWireUnitLeakage();
if (thisDelay <= targetDelay && thisDynamicEnergy / currentDynamicEnergy + thisLeakage / currentLeakage < 2) {
currentDynamicEnergy = thisDynamicEnergy;
currentLeakage = thisLeakage;
targetRepeaterSpacing = repeaterSpacing;
targetRepeaterSize = repeaterSize;
}
}
}
repeaterSpacing = targetRepeaterSpacing;
repeaterSize = targetRepeaterSize;
}
double Wire::getRepeatedWireUnitDelay() {
/* Use the scaled size of the repeater */
double nmosSize = MIN_NMOS_SIZE * tech->featureSize * repeaterSize;
double pmosSize = nmosSize * tech->pnSizeRatio;
double inputCap = CalculateGateCap(nmosSize, *tech) + CalculateGateCap(pmosSize, *tech);
double outputCap = CalculateDrainCap(nmosSize, NMOS, 1 /*no limit*/, *tech)
+ CalculateDrainCap(pmosSize, PMOS, 1 /*no limit*/, *tech);
double outputRes = CalculateOnResistance(nmosSize, NMOS, inputParameter->temperature, *tech)
+ CalculateOnResistance(pmosSize, PMOS, inputParameter->temperature, *tech);
double wireCap = capWirePerUnit * repeaterSpacing;
double wireRes = resWirePerUnit * repeaterSpacing;
double tau = outputRes * (inputCap + outputCap) + outputRes * wireCap + wireRes * outputCap
+ 0.5 * wireRes * wireCap;
/* Return as a unit value */
return 0.693 * tau / repeaterSpacing;
}
double Wire::getRepeatedWireUnitDynamicEnergy() {
/* Use the scaled size of the repeater */
double nmosSize = MIN_NMOS_SIZE * tech->featureSize * repeaterSize;
double pmosSize = nmosSize * tech->pnSizeRatio;
double inputCap = CalculateGateCap(nmosSize, *tech) + CalculateGateCap(pmosSize, *tech);
double outputCap = CalculateDrainCap(nmosSize, NMOS, 1 /*no limit*/, *tech)
+ CalculateDrainCap(pmosSize, PMOS, 1 /*no limit*/, *tech);
double wireCap = capWirePerUnit * repeaterSpacing;
double switchingEnergy = (inputCap + outputCap + wireCap) * tech->vdd * tech->vdd;
double shortCircuitEnergy = 0; /* TO-DO: no short circuit energy in this version */
return (switchingEnergy + shortCircuitEnergy) / repeaterSpacing;
}
double Wire::getRepeatedWireUnitLeakage() {
double nmosSize = MIN_NMOS_SIZE * tech->featureSize * repeaterSize;
double pmosSize = nmosSize * tech->pnSizeRatio;
double leakagePerRepeater = CalculateGateLeakage(INV, 1, nmosSize, pmosSize, inputParameter->temperature, *tech)
* tech->vdd;
return leakagePerRepeater / repeaterSpacing;
}
void Wire::PrintProperty() {
if (wireRepeaterType == repeated_none) {
cout << "Wire Type: passive (without repeaters)";
if (isLowSwing) {
cout << " Low Swing";
}
cout << endl;
cout << "Wire Resistance: " << resWirePerUnit / 1e6 << "ohm/um" << endl;
cout << "Wire Capacitance: " << capWirePerUnit / 1e6 << "F/um" << endl;
} else {
cout << "Wire type: active (with repeaters)" << endl;
cout << "Repeater Size: " << repeaterSize << endl;
cout << "Repeater Spacing: " << repeaterSpacing * 1e3 << "mm" <<endl;
cout << "Delay: " << getRepeatedWireUnitDelay() * 1e6 << "ns/mm" <<endl;
cout << "Dynamic Energy: " << getRepeatedWireUnitDynamicEnergy() * 1e6 << "nJ/mm" <<endl;
cout << "Subtheshold Leakage Power: " << getRepeatedWireUnitLeakage() << "mW/mm" << endl;
}
}
Wire & Wire::operator=(const Wire &rhs) {
initialized = rhs.initialized;
featureSizeInNano = rhs.featureSizeInNano;
featureSize = rhs.featureSize;
wireType = rhs.wireType;
wireRepeaterType = rhs.wireRepeaterType;
temperature = rhs.temperature;
isLowSwing = rhs.isLowSwing;
barrierThickness = rhs.barrierThickness;
horizontalDielectric = rhs.horizontalDielectric;
wirePitch = rhs.wirePitch;
aspectRatio = rhs.aspectRatio;
ildThickness = rhs.ildThickness;
wireWidth = rhs.wireWidth;
wireThickness = rhs.wireThickness;
wireSpacing = rhs.wireSpacing;
repeaterSize = rhs.repeaterSize;
repeaterSpacing = rhs.repeaterSpacing;
repeaterHeight = rhs.repeaterHeight;
repeaterWidth = rhs.repeaterWidth;
repeatedWirePitch = rhs.repeatedWirePitch;
resWirePerUnit = rhs.resWirePerUnit;
capWirePerUnit = rhs.capWirePerUnit;
return *this;
}