2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2020-03-07 03:50:37 +01:00
|
|
|
// Copyright (c) 2020, Parallax Software, Inc.
|
2018-09-28 17:54:21 +02:00
|
|
|
//
|
|
|
|
|
// 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/>.
|
|
|
|
|
|
2020-04-05 20:35:51 +02:00
|
|
|
#include "graph/Delay.hh"
|
|
|
|
|
|
|
|
|
|
#include "util/StaConfig.hh"
|
|
|
|
|
#include "util/Fuzzy.hh"
|
|
|
|
|
#include "liberty/Units.hh"
|
|
|
|
|
#include "search/StaState.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2018-12-05 23:18:41 +01:00
|
|
|
// Non-SSTA compilation.
|
|
|
|
|
#if !SSTA
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
|
|
|
|
static Delay delay_init_values[MinMax::index_count];
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
initDelayConstants()
|
|
|
|
|
{
|
|
|
|
|
delay_init_values[MinMax::minIndex()] = MinMax::min()->initValue();
|
|
|
|
|
delay_init_values[MinMax::maxIndex()] = MinMax::max()->initValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Delay &
|
|
|
|
|
delayInitValue(const MinMax *min_max)
|
|
|
|
|
{
|
|
|
|
|
return delay_init_values[min_max->index()];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
delayIsInitValue(const Delay &delay,
|
|
|
|
|
const MinMax *min_max)
|
|
|
|
|
{
|
|
|
|
|
return fuzzyEqual(delay, min_max->initValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2019-03-13 01:25:53 +01:00
|
|
|
fuzzyGreater(const Delay &delay1,
|
|
|
|
|
const Delay &delay2,
|
|
|
|
|
const MinMax *min_max)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
if (min_max == MinMax::max())
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyGreater(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
else
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyLess(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2019-03-13 01:25:53 +01:00
|
|
|
fuzzyGreaterEqual(const Delay &delay1,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Delay &delay2,
|
|
|
|
|
const MinMax *min_max)
|
|
|
|
|
{
|
|
|
|
|
if (min_max == MinMax::max())
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyGreaterEqual(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
else
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyLessEqual(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2019-03-13 01:25:53 +01:00
|
|
|
fuzzyLess(const Delay &delay1,
|
|
|
|
|
const Delay &delay2,
|
|
|
|
|
const MinMax *min_max)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
if (min_max == MinMax::max())
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyLess(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
else
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyGreater(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2019-03-13 01:25:53 +01:00
|
|
|
fuzzyLessEqual(const Delay &delay1,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Delay &delay2,
|
|
|
|
|
const MinMax *min_max)
|
|
|
|
|
{
|
|
|
|
|
if (min_max == MinMax::max())
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyLessEqual(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
else
|
2019-03-13 01:25:53 +01:00
|
|
|
return fuzzyGreaterEqual(delay1, delay2);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float
|
|
|
|
|
delayRatio(const Delay &delay1,
|
|
|
|
|
const Delay &delay2)
|
|
|
|
|
{
|
|
|
|
|
return delay1 / delay2;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-04 02:50:56 +01:00
|
|
|
const char *
|
|
|
|
|
delayAsString(const Delay &delay,
|
|
|
|
|
const StaState *sta)
|
|
|
|
|
{
|
|
|
|
|
return delayAsString(delay, sta, sta->units()->timeUnit()->digits());
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
const char *
|
|
|
|
|
delayAsString(const Delay &delay,
|
2019-01-27 08:03:01 +01:00
|
|
|
const StaState *sta,
|
2018-11-26 18:15:52 +01:00
|
|
|
int digits)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2019-01-27 08:03:01 +01:00
|
|
|
return sta->units()->timeUnit()->asString(delay, digits);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *
|
2018-12-05 23:18:41 +01:00
|
|
|
delayAsString(const Delay &delay,
|
|
|
|
|
const EarlyLate *,
|
2019-01-27 08:03:01 +01:00
|
|
|
const StaState *sta,
|
2018-12-05 23:18:41 +01:00
|
|
|
int digits)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2019-01-27 08:03:01 +01:00
|
|
|
const Unit *unit = sta->units()->timeUnit();
|
2018-11-26 18:15:52 +01:00
|
|
|
return unit->asString(delay, digits);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-27 08:03:01 +01:00
|
|
|
float
|
|
|
|
|
delayAsFloat(const Delay &delay,
|
2019-03-13 01:25:53 +01:00
|
|
|
const EarlyLate *,
|
2019-06-01 17:07:38 +02:00
|
|
|
const StaState *)
|
2019-01-27 08:03:01 +01:00
|
|
|
{
|
|
|
|
|
return delay;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-11 19:47:04 +01:00
|
|
|
float
|
|
|
|
|
delaySigma2(const Delay &,
|
|
|
|
|
const EarlyLate *)
|
|
|
|
|
{
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
} // namespace
|
2020-02-16 01:13:16 +01:00
|
|
|
|
|
|
|
|
#endif // !SSTA
|