forked from The-OpenROAD-Project/OpenSTA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimingRole.cc
263 lines (243 loc) · 7.62 KB
/
TimingRole.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
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
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2023, 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/>.
#include "TimingRole.hh"
namespace sta {
TimingRole *TimingRole::wire_;
TimingRole *TimingRole::combinational_;
TimingRole *TimingRole::tristate_enable_;
TimingRole *TimingRole::tristate_disable_;
TimingRole *TimingRole::reg_clk_q_;
TimingRole *TimingRole::reg_set_clr_;
TimingRole *TimingRole::latch_en_q_;
TimingRole *TimingRole::latch_d_q_;
TimingRole *TimingRole::sdf_iopath_;
TimingRole *TimingRole::setup_;
TimingRole *TimingRole::hold_;
TimingRole *TimingRole::recovery_;
TimingRole *TimingRole::removal_;
TimingRole *TimingRole::width_;
TimingRole *TimingRole::period_;
TimingRole *TimingRole::skew_;
TimingRole *TimingRole::nochange_;
TimingRole *TimingRole::output_setup_;
TimingRole *TimingRole::output_hold_;
TimingRole *TimingRole::gated_clk_setup_;
TimingRole *TimingRole::gated_clk_hold_;
TimingRole *TimingRole::latch_setup_;
TimingRole *TimingRole::latch_hold_;
TimingRole *TimingRole::data_check_setup_;
TimingRole *TimingRole::data_check_hold_;
TimingRole *TimingRole::non_seq_setup_;
TimingRole *TimingRole::non_seq_hold_;
TimingRole *TimingRole::clock_tree_path_min_;
TimingRole *TimingRole::clock_tree_path_max_;
TimingRoleMap TimingRole::timing_roles_;
void
TimingRole::init()
{
wire_ = new TimingRole("wire", false, false, false, nullptr, nullptr, 0);
combinational_ = new TimingRole("combinational", true, false, false,
nullptr, nullptr, 1);
tristate_enable_ = new TimingRole("tristate enable",
true, false, false,
nullptr, nullptr, 2);
tristate_disable_ = new TimingRole("tristate disable",
true, false, false,
nullptr, nullptr, 3);
reg_clk_q_ = new TimingRole("Reg Clk to Q", true, false, false,
nullptr, nullptr, 4);
reg_set_clr_ = new TimingRole("Reg Set/Clr", true, false, false,
nullptr, nullptr, 5);
latch_en_q_ = new TimingRole("Latch En to Q", true, false, false,
nullptr, TimingRole::regClkToQ(), 6);
latch_d_q_ = new TimingRole("Latch D to Q", true, false, false,
nullptr, nullptr, 7);
sdf_iopath_ = new TimingRole("sdf IOPATH", true, false, false,
nullptr, nullptr, 8);
setup_ = new TimingRole("setup", false, true, false,
MinMax::max(), nullptr, 9);
hold_ = new TimingRole("hold", false, true, false,
MinMax::min(), nullptr, 10);
recovery_ = new TimingRole("recovery", false, true, false,
MinMax::max(), TimingRole::setup(), 11);
removal_ = new TimingRole("removal", false, true, false,
MinMax::min(), TimingRole::hold(), 12);
width_ = new TimingRole("width", false, true, false,
nullptr, nullptr, 13);
period_ = new TimingRole("period", false, true, false,
nullptr, nullptr, 14);
skew_ = new TimingRole("skew", false, true, false,
nullptr, nullptr, 15);
nochange_ = new TimingRole("nochange", true, false, false,
nullptr, nullptr, 16);
output_setup_ = new TimingRole("output setup", false, true, false,
MinMax::max(), TimingRole::setup(), 17);
output_hold_ = new TimingRole("output hold", false, true, false,
MinMax::min(), TimingRole::hold(), 18);
gated_clk_setup_ = new TimingRole("clock gating setup",
false, true, false,
MinMax::max(), TimingRole::setup(),19);
gated_clk_hold_ = new TimingRole("clock gating hold", false, true, false,
MinMax::min(), TimingRole::hold(),20);
latch_setup_ = new TimingRole("latch setup", false, true, false,
MinMax::max(), TimingRole::setup(),21);
latch_hold_ = new TimingRole("latch hold", false, true, false,
MinMax::min(), TimingRole::hold(),22);
data_check_setup_ = new TimingRole("data check setup",
false, true, false,
MinMax::max(),TimingRole::setup(),23);
data_check_hold_ = new TimingRole("data check hold", false, true, false,
MinMax::min(), TimingRole::hold(), 24);
non_seq_setup_ = new TimingRole("non-sequential setup", false, true, true,
MinMax::max(), TimingRole::setup(), 25);
non_seq_hold_ = new TimingRole("non-sequential hold", false, true, true,
MinMax::min(), TimingRole::hold(), 26);
clock_tree_path_min_ = new TimingRole("min clock tree path", false, false, false,
MinMax::min(), nullptr, 27);
clock_tree_path_max_ = new TimingRole("max clock tree path", false, false, false,
MinMax::max(), nullptr, 28);
}
void
TimingRole::destroy()
{
delete wire_;
wire_ = nullptr;
delete combinational_;
combinational_ = nullptr;
delete tristate_enable_;
tristate_enable_ = nullptr;
delete tristate_disable_;
tristate_disable_ = nullptr;
delete reg_clk_q_;
reg_clk_q_ = nullptr;
delete reg_set_clr_;
reg_set_clr_ = nullptr;
delete latch_en_q_;
latch_en_q_ = nullptr;
delete latch_d_q_;
latch_d_q_ = nullptr;
delete sdf_iopath_;
sdf_iopath_ = nullptr;
delete setup_;
setup_ = nullptr;
delete hold_;
hold_ = nullptr;
delete recovery_;
recovery_ = nullptr;
delete removal_;
removal_ = nullptr;
delete width_;
width_ = nullptr;
delete period_;
period_ = nullptr;
delete skew_;
skew_ = nullptr;
delete nochange_;
nochange_ = nullptr;
delete output_setup_;
output_setup_ = nullptr;
delete output_hold_;
output_hold_ = nullptr;
delete gated_clk_setup_;
gated_clk_setup_ = nullptr;
delete gated_clk_hold_;
gated_clk_hold_ = nullptr;
delete latch_setup_;
latch_setup_ = nullptr;
delete latch_hold_;
latch_hold_ = nullptr;
delete data_check_setup_;
data_check_setup_ = nullptr;
delete data_check_hold_;
data_check_hold_ = nullptr;
delete non_seq_setup_;
non_seq_setup_ = nullptr;
delete non_seq_hold_;
non_seq_hold_ = nullptr;
timing_roles_.clear();
}
TimingRole::TimingRole(const char *name,
bool is_sdf_iopath,
bool is_timing_check,
bool is_non_seq_check,
MinMax *path_min_max,
TimingRole *generic_role,
int index) :
name_(name),
is_timing_check_(is_timing_check),
is_sdf_iopath_(is_sdf_iopath),
is_non_seq_check_(is_non_seq_check),
generic_role_(generic_role),
index_(index),
path_min_max_(path_min_max)
{
timing_roles_[name] = this;
}
TimingRole *
TimingRole::find(const char *name)
{
return timing_roles_[name];
}
const TimingRole *
TimingRole::sdfRole() const
{
if (is_sdf_iopath_)
return sdf_iopath_;
else
return this;
}
const TimingRole *
TimingRole::genericRole() const
{
if (generic_role_ == nullptr)
return this;
else
return generic_role_;
}
const EarlyLate *
TimingRole::tgtClkEarlyLate() const
{
return path_min_max_->opposite();
}
bool
TimingRole::isWire() const
{
return this == wire_;
}
bool
TimingRole::isAsyncTimingCheck() const
{
return this == recovery_
|| this == removal_;
}
bool
TimingRole::isDataCheck() const
{
return this == data_check_setup_
|| this == data_check_hold_;
}
bool
TimingRole::isLatchDtoQ() const
{
return this == latch_d_q_;
}
bool
TimingRole::less(const TimingRole *role1,
const TimingRole *role2)
{
return role1->index() < role2->index();
}
} // namespace