-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatistics.c
More file actions
89 lines (62 loc) · 2.1 KB
/
statistics.c
File metadata and controls
89 lines (62 loc) · 2.1 KB
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
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
//Definitions. They should be changes according to model to use
#define A (long double)1.6328
#define B (long double)0.07377
#define C (long double)0.01
#define D (long double)0.06852 // Should it be minus or plus????
#define k (long double)8.6173324e-5 // It is in eV/K
#define a (long double)78
#define b (long double)-0.081
#define X (long double)0.759
#define Y (long double)-66.8
#define Z (long double)-8.37e-4
#define betap (long double)0.3
/* long double Final_MTTF_Approach(block *first, block *end) {
block *aux;
return 0;
} */
void Start_Seeder() {
// Initializes the random number generator with the system time
srand((unsigned)time(NULL));
return;
}
long double Calculate_Alpha(long double MTTF, long double beta) {
// Calculates alpha with a known beta and MTTF
return(MTTF/exp(lgammal(1+(1/beta))));
}
long double Gen_Weibull_Sample(long double alpha, long double beta) {
// Generates random samples of according to a Weibull
// of parameters alpha (scale) and beta (shape) using
// the inverse CDF method (view paper in README for
// more details
return(alpha*pow((-log(1-((long double)rand()/(long double)RAND_MAX))), 1/beta));
}
long double Calculate_NBTI_MTTF(long double temp) {
long double aux;
// Since it is a very long function and you
// can get lost easily, I've broken it down
// so it's easier to understand and/or
// modify
// It will end up increasing computational
// burden.
aux = (long double)log(A/(1+2*exp(B/(k*temp))));
aux -= (long double)log(A/(1+2*exp(B/(k*temp)))-C);
aux *= (temp/exp((-D)/(k*temp)));
return((long double)pow(aux, (1/betap)));
}
long double Calculate_TDDB_MTTF(long double temp, long double voltage) {
long double aux;
// Since it is a very long function and you
// can get lost easily, I've broken it down
// so it's easier to understand and/or
// modify
// It will end up increasing computational
// burden.
aux = (long double)1/voltage;
aux = (long double)pow(aux, (a-b*temp));
aux *= (long double)exp((X+(Y/temp)+(Z*temp))/(k*temp));
return(aux);
}