reorg power headers

This commit is contained in:
James Cherry 2020-07-31 09:42:24 -07:00
parent a23ba7b88e
commit cafb7b9152
6 changed files with 88 additions and 59 deletions

73
include/sta/PowerClass.hh Normal file
View File

@ -0,0 +1,73 @@
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2020, 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/>.
#pragma once
namespace sta {
enum class PwrActivityOrigin
{
global,
input,
user,
propagated,
clock,
constant,
defaulted,
unknown
};
class PwrActivity
{
public:
PwrActivity();
PwrActivity(float activity,
float duty,
PwrActivityOrigin origin);
float activity() const { return activity_; }
float duty() const { return duty_; }
PwrActivityOrigin origin() { return origin_; }
const char *originName() const;
void set(float activity,
float duty,
PwrActivityOrigin origin);
bool isSet() const;
private:
// In general activity is per clock cycle, NOT per second.
float activity_;
float duty_;
PwrActivityOrigin origin_;
};
class PowerResult
{
public:
PowerResult();
void clear();
float &internal() { return internal_; }
float &switching() { return switching_; }
float &leakage() { return leakage_; }
float total() const;
void incr(PowerResult &result);
private:
float internal_;
float switching_;
float leakage_;
};
} // namespace

View File

@ -22,7 +22,7 @@
#include "NetworkClass.hh"
#include "SearchClass.hh"
#include "SdcClass.hh"
#include "Power.hh"
#include "PowerClass.hh"
namespace sta {

View File

@ -29,6 +29,7 @@
#include "StaState.hh"
#include "VertexVisitor.hh"
#include "SearchClass.hh"
#include "PowerClass.hh"
struct Tcl_Interp;

View File

@ -65,7 +65,7 @@ isPositiveUnate(const LibertyCell *cell,
const LibertyPort *from,
const LibertyPort *to);
Power::Power(Sta *sta) :
Power::Power(StaState *sta) :
StaState(sta),
global_activity_{0.0, 0.0, PwrActivityOrigin::unknown},
input_activity_{0.1, 0.5, PwrActivityOrigin::input},

View File

@ -16,12 +16,19 @@
#pragma once
#include "Sta.hh"
#include <utility>
#include "UnorderedMap.hh"
#include "Network.hh"
#include "SdcClass.hh"
#include "PowerClass.hh"
#include "StaState.hh"
namespace sta {
class PowerResult;
class PwrActivity;
class Sta;
class Corner;
class DcalcAnalysisPt;
class PropActivityVisitor;
class BfsFwdIterator;
@ -44,47 +51,12 @@ typedef UnorderedMap<const Pin*,PwrActivity> PwrActivityMap;
typedef UnorderedMap<SeqPin, PwrActivity,
SeqPinHash, SeqPinEqual> PwrSeqActivityMap;
enum class PwrActivityOrigin
{
global,
input,
user,
propagated,
clock,
constant,
defaulted,
unknown
};
class PwrActivity
{
public:
PwrActivity();
PwrActivity(float activity,
float duty,
PwrActivityOrigin origin);
float activity() const { return activity_; }
float duty() const { return duty_; }
PwrActivityOrigin origin() { return origin_; }
const char *originName() const;
void set(float activity,
float duty,
PwrActivityOrigin origin);
bool isSet() const;
private:
// In general activity is per clock cycle, NOT per second.
float activity_;
float duty_;
PwrActivityOrigin origin_;
};
// The Power class has access to Sta components directly for
// convenience but also requires access to the Sta class member functions.
class Power : public StaState
{
public:
Power(Sta *sta);
Power(StaState *sta);
void power(const Corner *corner,
// Return values.
PowerResult &total,
@ -204,21 +176,4 @@ private:
friend class PropActivityVisitor;
};
class PowerResult
{
public:
PowerResult();
void clear();
float &internal() { return internal_; }
float &switching() { return switching_; }
float &leakage() { return leakage_; }
float total() const;
void incr(PowerResult &result);
private:
float internal_;
float switching_;
float leakage_;
};
} // namespace

View File

@ -68,7 +68,6 @@
#include "PathEnd.hh"
#include "PathGroup.hh"
#include "PathAnalysisPt.hh"
#include "Power.hh"
#include "Property.hh"
#include "WritePathSpice.hh"
#include "Search.hh"
@ -78,6 +77,7 @@
#include "search/CheckMinPulseWidths.hh"
#include "search/Levelize.hh"
#include "search/ReportPath.hh"
#include "search/Power.hh"
namespace sta {