forked from parallaxsw/OpenSTA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeratingFactors.cc
220 lines (192 loc) · 5.23 KB
/
DeratingFactors.cc
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
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2025, Parallax Software, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software.
//
// Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// This notice may not be removed or altered from any source distribution.
#include "DeratingFactors.hh"
namespace sta {
inline int
index(TimingDerateType type)
{
return int(type);
}
inline int
index(TimingDerateCellType type)
{
return int(type);
}
DeratingFactors::DeratingFactors()
{
clear();
}
void
DeratingFactors::setFactor(PathClkOrData clk_data,
const RiseFallBoth *rf,
const EarlyLate *early_late,
float factor)
{
for (auto rf1 : rf->range())
factors_[int(clk_data)].setValue(rf1, early_late, factor);
}
void
DeratingFactors::factor(PathClkOrData clk_data,
const RiseFall *rf,
const EarlyLate *early_late,
float &factor,
bool &exists) const
{
factors_[int(clk_data)].value(rf, early_late, factor, exists);
}
void
DeratingFactors::clear()
{
for (int clk_data = 0; clk_data < path_clk_or_data_count;clk_data++)
factors_[int(clk_data)].clear();
}
void
DeratingFactors::isOneValue(const EarlyLate *early_late,
bool &is_one_value,
float &value) const
{
bool is_one_value0, is_one_value1;
float value0, value1;
is_one_value0 = factors_[0].isOneValue(early_late, value0);
is_one_value1 = factors_[1].isOneValue(early_late, value1);
is_one_value = is_one_value0
&& is_one_value1
&& value0 == value1;
value = value1;
}
void
DeratingFactors::isOneValue(PathClkOrData clk_data,
const EarlyLate *early_late,
bool &is_one_value,
float &value) const
{
is_one_value = factors_[int(clk_data)].isOneValue(early_late, value);
}
bool
DeratingFactors::hasValue() const
{
return factors_[0].hasValue()
|| factors_[1].hasValue();
}
////////////////////////////////////////////////////////////////
DeratingFactorsGlobal::DeratingFactorsGlobal()
{
clear();
}
void
DeratingFactorsGlobal::setFactor(TimingDerateType type,
PathClkOrData clk_data,
const RiseFallBoth *rf,
const EarlyLate *early_late,
float factor)
{
factors_[index(type)].setFactor(clk_data, rf, early_late, factor);
}
void
DeratingFactorsGlobal::factor(TimingDerateType type,
PathClkOrData clk_data,
const RiseFall *rf,
const EarlyLate *early_late,
float &factor,
bool &exists) const
{
factors_[index(type)].factor(clk_data, rf, early_late, factor, exists);
}
void
DeratingFactorsGlobal::factor(TimingDerateCellType type,
PathClkOrData clk_data,
const RiseFall *rf,
const EarlyLate *early_late,
float &factor,
bool &exists) const
{
factors_[index(type)].factor(clk_data, rf, early_late, factor, exists);
}
void
DeratingFactorsGlobal::clear()
{
for (int type = 0; type < timing_derate_type_count; type++)
factors_[type].clear();
}
DeratingFactors *
DeratingFactorsGlobal::factors(TimingDerateType type)
{
return &factors_[index(type)];
}
////////////////////////////////////////////////////////////////
DeratingFactorsCell::DeratingFactorsCell()
{
clear();
}
void
DeratingFactorsCell::setFactor(TimingDerateCellType type,
PathClkOrData clk_data,
const RiseFallBoth *rf,
const EarlyLate *early_late,
float factor)
{
factors_[index(type)].setFactor(clk_data, rf, early_late, factor);
}
void
DeratingFactorsCell::factor(TimingDerateCellType type,
PathClkOrData clk_data,
const RiseFall *rf,
const EarlyLate *early_late,
float &factor,
bool &exists) const
{
factors_[index(type)].factor(clk_data, rf, early_late, factor, exists);
}
void
DeratingFactorsCell::clear()
{
for (int type = 0; type < timing_derate_cell_type_count; type++)
factors_[type].clear();
}
DeratingFactors *
DeratingFactorsCell::factors(TimingDerateCellType type)
{
return &factors_[index(type)];
}
void
DeratingFactorsCell::isOneValue(const EarlyLate *early_late,
bool &is_one_value,
float &value) const
{
bool is_one_value1, is_one_value2;
float value1, value2;
factors_[index(TimingDerateType::cell_delay)]
.isOneValue(early_late, is_one_value1, value1);
factors_[index(TimingDerateType::cell_check)]
.isOneValue(early_late, is_one_value2, value2);
is_one_value = is_one_value1
&& is_one_value2
&& value1 == value2;
value = value1;
}
////////////////////////////////////////////////////////////////
DeratingFactorsNet::DeratingFactorsNet()
{
}
} // namespace