2020-07-31 18:42:24 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2025-01-22 02:54:33 +01:00
|
|
|
// Copyright (c) 2025, Parallax Software, Inc.
|
2020-07-31 18:42:24 +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
|
2022-01-04 18:17:08 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2020-07-31 18:42:24 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2022-01-04 18:17:08 +01:00
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2025-01-22 02:54:33 +01:00
|
|
|
//
|
|
|
|
|
// 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.
|
2020-07-31 18:42:24 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
2024-02-27 18:00:48 +01:00
|
|
|
class Power;
|
|
|
|
|
|
2020-07-31 18:42:24 +02:00
|
|
|
enum class PwrActivityOrigin
|
|
|
|
|
{
|
|
|
|
|
global,
|
|
|
|
|
input,
|
|
|
|
|
user,
|
2023-10-22 02:16:39 +02:00
|
|
|
vcd,
|
2024-09-24 03:04:26 +02:00
|
|
|
saif,
|
2020-07-31 18:42:24 +02:00
|
|
|
propagated,
|
|
|
|
|
clock,
|
|
|
|
|
constant,
|
|
|
|
|
defaulted,
|
|
|
|
|
unknown
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PwrActivity
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
PwrActivity();
|
2025-01-17 21:02:13 +01:00
|
|
|
PwrActivity(float density,
|
2020-11-03 00:12:13 +01:00
|
|
|
float duty,
|
|
|
|
|
PwrActivityOrigin origin);
|
2025-06-25 16:56:26 +02:00
|
|
|
void init();
|
2025-01-17 21:02:13 +01:00
|
|
|
float density() const { return density_; }
|
|
|
|
|
void setDensity(float density);
|
2020-07-31 18:42:24 +02:00
|
|
|
float duty() const { return duty_; }
|
2022-11-24 07:17:07 +01:00
|
|
|
void setDuty(float duty);
|
2025-01-16 00:20:21 +01:00
|
|
|
PwrActivityOrigin origin() const { return origin_; }
|
2023-11-10 17:59:50 +01:00
|
|
|
void setOrigin(PwrActivityOrigin origin);
|
2020-07-31 18:42:24 +02:00
|
|
|
const char *originName() const;
|
2025-01-17 21:02:13 +01:00
|
|
|
void set(float density,
|
2020-07-31 18:42:24 +02:00
|
|
|
float duty,
|
|
|
|
|
PwrActivityOrigin origin);
|
|
|
|
|
bool isSet() const;
|
|
|
|
|
|
|
|
|
|
private:
|
2020-11-03 02:22:49 +01:00
|
|
|
void check();
|
|
|
|
|
|
2025-01-17 21:02:13 +01:00
|
|
|
float density_; // transitions / second
|
|
|
|
|
float duty_; // probability signal is high
|
2020-07-31 18:42:24 +02:00
|
|
|
PwrActivityOrigin origin_;
|
2020-11-03 02:22:49 +01:00
|
|
|
|
2025-01-17 21:02:13 +01:00
|
|
|
static constexpr float min_density = 1E-10;
|
2020-07-31 18:42:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PowerResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
PowerResult();
|
|
|
|
|
void clear();
|
2025-01-16 00:20:21 +01:00
|
|
|
float internal() const { return internal_; }
|
|
|
|
|
float switching() const { return switching_; }
|
|
|
|
|
float leakage() const { return leakage_; }
|
2020-07-31 18:42:24 +02:00
|
|
|
float total() const;
|
|
|
|
|
void incr(PowerResult &result);
|
2025-01-16 00:20:21 +01:00
|
|
|
void incrInternal(float pwr);
|
|
|
|
|
void incrSwitching(float pwr);
|
|
|
|
|
void incrLeakage(float pwr);
|
|
|
|
|
|
2020-07-31 18:42:24 +02:00
|
|
|
private:
|
|
|
|
|
float internal_;
|
|
|
|
|
float switching_;
|
|
|
|
|
float leakage_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|