OpenSTA/include/sta/DelayNormal2.hh

177 lines
4.2 KiB
C++
Raw Normal View History

2018-11-26 18:15:52 +01:00
// OpenSTA, Static Timing Analyzer
2020-03-07 03:50:37 +01:00
// Copyright (c) 2020, Parallax Software, Inc.
2018-11-26 18:15:52 +01: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-02-16 01:13:16 +01:00
#pragma once
2018-11-26 18:15:52 +01:00
2020-04-05 23:53:44 +02:00
#include "MinMax.hh"
2018-11-26 18:15:52 +01:00
namespace sta {
class Delay;
class StaState;
2018-11-26 18:15:52 +01:00
// Normal distribution with early(left)/late(right) std deviations.
class Delay
{
public:
Delay();
Delay(float mean);
Delay(float mean,
2018-12-11 19:47:04 +01:00
float sigma2_early,
float sigma2_late);
2018-11-26 18:15:52 +01:00
float mean() const { return mean_; }
float sigma(const EarlyLate *early_late) const;
2018-12-11 19:47:04 +01:00
// sigma^2
float sigma2(const EarlyLate *early_late) const;
float sigma2Early() const;
float sigma2Late() const;
2018-11-26 18:15:52 +01:00
void operator=(const Delay &delay);
void operator=(float delay);
void operator+=(const Delay &delay);
void operator+=(float delay);
Delay operator+(const Delay &delay) const;
Delay operator+(float delay) const;
Delay operator-(const Delay &delay) const;
Delay operator-(float delay) const;
Delay operator-() const;
void operator-=(float delay);
2019-01-27 08:03:01 +01:00
void operator-=(const Delay &delay);
2018-11-26 18:15:52 +01:00
bool operator==(const Delay &delay) const;
protected:
static const int early_index = 0;
static const int late_index = 1;
private:
float mean_;
2018-12-11 19:47:04 +01:00
// Sigma^2
float sigma2_[EarlyLate::index_count];
2018-11-26 18:15:52 +01:00
};
const Delay delay_zero(0.0);
void
initDelayConstants();
2020-07-12 02:43:30 +02:00
const char *
delayAsString(const Delay &delay,
const StaState *sta);
const char *
delayAsString(const Delay &delay,
const StaState *sta,
int digits);
const char *
delayAsString(const Delay &delay,
const EarlyLate *early_late,
const StaState *sta,
int digits);
2018-12-11 19:47:04 +01:00
Delay
2018-11-26 18:15:52 +01:00
makeDelay(float delay,
float sigma_early,
2018-12-11 19:47:04 +01:00
float sigma_late);
Delay
makeDelay2(float delay,
// sigma^2
float sigma_early,
float sigma_late);
2018-11-26 18:15:52 +01:00
inline float
2020-07-12 02:43:30 +02:00
delayAsFloat(const Delay &delay)
{
return delay.mean();
}
2018-11-26 18:15:52 +01:00
// mean late+/early- sigma
float
delayAsFloat(const Delay &delay,
2019-03-13 01:25:53 +01:00
const EarlyLate *early_late,
2019-06-01 17:07:38 +02:00
const StaState *sta);
float
delaySigma2(const Delay &delay,
const EarlyLate *early_late);
const Delay &
delayInitValue(const MinMax *min_max);
bool
delayIsInitValue(const Delay &delay,
const MinMax *min_max);
bool
2020-07-12 01:24:48 +02:00
delayZero(const Delay &delay);
bool
2020-07-12 01:24:48 +02:00
delayInf(const Delay &delay);
2020-03-30 00:47:31 +02:00
bool
2020-07-12 01:24:48 +02:00
delayEqual(const Delay &delay1,
2019-03-13 01:25:53 +01:00
const Delay &delay2);
bool
2020-07-12 01:24:48 +02:00
delayLess(const Delay &delay1,
2020-07-12 02:43:30 +02:00
const Delay &delay2,
const StaState *sta);
bool
2020-07-12 01:24:48 +02:00
delayLess(const Delay &delay1,
2019-03-13 01:25:53 +01:00
const Delay &delay2,
2020-07-12 02:43:30 +02:00
const MinMax *min_max,
const StaState *sta);
2019-03-13 01:25:53 +01:00
bool
2020-07-12 01:24:48 +02:00
delayLessEqual(const Delay &delay1,
2020-07-12 02:43:30 +02:00
const Delay &delay2,
const StaState *sta);
bool
2020-07-12 01:24:48 +02:00
delayLessEqual(const Delay &delay1,
const Delay &delay2,
2020-07-12 02:43:30 +02:00
const MinMax *min_max,
const StaState *sta);
bool
2020-07-12 01:24:48 +02:00
delayGreater(const Delay &delay1,
2020-07-12 02:43:30 +02:00
const Delay &delay2,
const StaState *sta);
bool
2020-07-12 01:24:48 +02:00
delayGreaterEqual(const Delay &delay1,
2020-07-12 02:43:30 +02:00
const Delay &delay2,
const StaState *sta);
bool
2020-07-12 01:24:48 +02:00
delayGreaterEqual(const Delay &delay1,
const Delay &delay2,
2020-07-12 02:43:30 +02:00
const MinMax *min_max,
const StaState *sta);
2019-03-13 01:25:53 +01:00
bool
2020-07-12 01:24:48 +02:00
delayGreater(const Delay &delay1,
2019-03-13 01:25:53 +01:00
const Delay &delay2,
2020-07-12 02:43:30 +02:00
const MinMax *min_max,
const StaState *sta);
2020-05-31 03:09:14 +02:00
// delay1-delay2 subtracting sigma instead of addiing.
Delay delayRemove(const Delay &delay1,
const Delay &delay2);
float
delayRatio(const Delay &delay1,
const Delay &delay2);
2020-05-31 03:09:14 +02:00
// Most non-operator functions on Delay are not defined as member
// functions so they can be defined on floats, where there is no class
// to define them.
Delay operator+(float delay1,
const Delay &delay2);
// Used for parallel gate delay calc.
Delay operator/(float delay1,
const Delay &delay2);
// Used for parallel gate delay calc.
Delay operator*(const Delay &delay1,
float delay2);
2018-11-26 18:15:52 +01:00
} // namespace