forked from smunaut/OpenSTA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRiseFallValues.cc
98 lines (85 loc) · 2.18 KB
/
RiseFallValues.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
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, 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 "Machine.hh"
#include "RiseFallValues.hh"
namespace sta {
RiseFallValues::RiseFallValues()
{
clear();
}
void
RiseFallValues::clear()
{
for (auto tr_index : TransRiseFall::rangeIndex())
exists_[tr_index] = false;
}
RiseFallValues::RiseFallValues(float init_value)
{
for (auto tr_index : TransRiseFall::rangeIndex()) {
values_[tr_index] = init_value;
exists_[tr_index] = true;
}
}
void
RiseFallValues::setValue(float value)
{
setValue(TransRiseFallBoth::riseFall(), value);
}
void
RiseFallValues::setValue(const TransRiseFallBoth *tr,
float value)
{
for (auto tr_index : tr->rangeIndex()) {
values_[tr_index] = value;
exists_[tr_index] = true;
}
}
void
RiseFallValues::setValue(const TransRiseFall *tr,
float value)
{
int tr_index = tr->index();
values_[tr_index] = value;
exists_[tr_index] = true;
}
void
RiseFallValues::setValues(RiseFallValues *values)
{
for (auto tr_index : TransRiseFall::rangeIndex()) {
values_[tr_index] = values->values_[tr_index];
exists_[tr_index] = values->exists_[tr_index];
}
}
void
RiseFallValues::value(const TransRiseFall *tr,
float &value, bool &exists) const
{
int tr_index = tr->index();
exists = exists_[tr_index];
if (exists)
value = values_[tr_index];
}
float
RiseFallValues::value(const TransRiseFall *tr) const
{
return values_[tr->index()];
}
bool
RiseFallValues::hasValue(const TransRiseFall *tr) const
{
return exists_[tr->index()];
}
} // namespace