2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2026-03-10 21:21:17 +01:00
|
|
|
// Copyright (c) 2026, 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
|
2022-01-04 18:17:08 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-09-28 17:54:21 +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.
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2020-02-16 01:13:16 +01:00
|
|
|
#pragma once
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2026-02-05 02:33:04 +01:00
|
|
|
#include <array>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "LibertyClass.hh"
|
|
|
|
|
#include "Transition.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
|
|
|
|
class InternalPowerModel;
|
|
|
|
|
|
2026-02-05 02:33:04 +01:00
|
|
|
using InternalPowerModels =
|
|
|
|
|
std::array<std::shared_ptr<InternalPowerModel>, RiseFall::index_count>;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
class InternalPower
|
|
|
|
|
{
|
|
|
|
|
public:
|
2026-02-05 02:33:04 +01:00
|
|
|
InternalPower(LibertyPort *port,
|
2026-01-04 01:59:35 +01:00
|
|
|
LibertyPort *related_port,
|
2026-02-11 16:33:09 +01:00
|
|
|
LibertyPort *related_pg_pin,
|
2026-02-05 02:33:04 +01:00
|
|
|
const std::shared_ptr<FuncExpr> &when,
|
|
|
|
|
InternalPowerModels &models);
|
|
|
|
|
//InternalPower(InternalPower &&other) noexcept;
|
2018-09-28 17:54:21 +02:00
|
|
|
LibertyCell *libertyCell() const;
|
|
|
|
|
LibertyPort *port() const { return port_; }
|
|
|
|
|
LibertyPort *relatedPort() const { return related_port_; }
|
2026-02-05 02:33:04 +01:00
|
|
|
FuncExpr *when() const { return when_.get(); }
|
2026-02-11 16:33:09 +01:00
|
|
|
LibertyPort *relatedPgPin() const { return related_pg_pin_; }
|
2025-03-31 00:27:53 +02:00
|
|
|
float power(const RiseFall *rf,
|
2026-01-04 01:59:35 +01:00
|
|
|
const Pvt *pvt,
|
|
|
|
|
float in_slew,
|
2026-02-05 02:33:04 +01:00
|
|
|
float load_cap) const;
|
|
|
|
|
const InternalPowerModel *model(const RiseFall *rf) const;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
LibertyPort *port_;
|
|
|
|
|
LibertyPort *related_port_;
|
2026-02-11 16:33:09 +01:00
|
|
|
LibertyPort *related_pg_pin_;
|
2026-02-05 02:33:04 +01:00
|
|
|
std::shared_ptr<FuncExpr> when_;
|
|
|
|
|
InternalPowerModels models_;
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class InternalPowerModel
|
|
|
|
|
{
|
|
|
|
|
public:
|
2026-01-04 01:59:35 +01:00
|
|
|
InternalPowerModel(TableModel *model);
|
2018-09-28 17:54:21 +02:00
|
|
|
~InternalPowerModel();
|
|
|
|
|
float power(const LibertyCell *cell,
|
2026-01-04 01:59:35 +01:00
|
|
|
const Pvt *pvt,
|
|
|
|
|
float in_slew,
|
|
|
|
|
float load_cap) const;
|
2025-04-12 01:59:48 +02:00
|
|
|
std::string reportPower(const LibertyCell *cell,
|
|
|
|
|
const Pvt *pvt,
|
|
|
|
|
float in_slew,
|
|
|
|
|
float load_cap,
|
|
|
|
|
int digits) const;
|
2026-02-05 02:33:04 +01:00
|
|
|
const TableModel *model() const { return model_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void findAxisValues(float in_slew,
|
2026-01-04 01:59:35 +01:00
|
|
|
float load_cap,
|
|
|
|
|
// Return values.
|
|
|
|
|
float &axis_value1,
|
|
|
|
|
float &axis_value2,
|
|
|
|
|
float &axis_value3) const;
|
2023-12-12 23:32:30 +01:00
|
|
|
float axisValue(const TableAxis *axis,
|
2026-01-04 01:59:35 +01:00
|
|
|
float in_slew,
|
|
|
|
|
float load_cap) const;
|
2018-09-28 17:54:21 +02:00
|
|
|
bool checkAxes(const TableModel *model);
|
2023-12-12 23:32:30 +01:00
|
|
|
bool checkAxis(const TableAxis *axis);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
TableModel *model_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|