OpenSTA/include/sta/search/ClkInfo.hh

123 lines
3.6 KiB
C++
Raw Normal View History

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-02-16 01:13:16 +01:00
#pragma once
2018-09-28 17:54:21 +02:00
2020-04-05 20:35:51 +02:00
#include "util/DisallowCopyAssign.hh"
#include "liberty/Transition.hh"
#include "search/SearchClass.hh"
#include "search/PathVertexRep.hh"
2018-09-28 17:54:21 +02:00
namespace sta {
class PathVertex;
class ClkInfo
{
public:
ClkInfo(ClockEdge *clk_edge,
const Pin *clk_src,
bool is_propagated,
const Pin *gen_clk_src,
bool is_gen_clk_src_path,
2019-11-11 23:30:19 +01:00
const RiseFall *pulse_clk_sense,
2018-09-28 17:54:21 +02:00
Arrival insertion,
float latency,
ClockUncertainties *uncertainties,
PathAPIndex path_ap_index,
PathVertexRep &crpr_clk_path,
const StaState *sta);
~ClkInfo();
const char *asString(const StaState *sta) const;
ClockEdge *clkEdge() const { return clk_edge_; }
Clock *clock() const;
const Pin *clkSrc() const { return clk_src_; }
bool isPropagated() const { return is_propagated_; }
const Pin *genClkSrc() const { return gen_clk_src_; }
bool isPulseClk() const { return is_pulse_clk_; }
2019-11-11 23:30:19 +01:00
RiseFall *pulseClkSense() const;
2018-09-28 17:54:21 +02:00
int pulseClkSenseTrIndex() const { return pulse_clk_sense_; }
float latency() const { return latency_; }
Arrival &insertion() { return insertion_; }
const Arrival &insertion() const { return insertion_; }
ClockUncertainties *uncertainties() const { return uncertainties_; }
PathAPIndex pathAPIndex() const { return path_ap_index_; }
// Clock path for the last driver in the clock network used for
// crpr resolution.
PathVertexRep &crprClkPath() { return crpr_clk_path_; }
const PathVertexRep &crprClkPath() const { return crpr_clk_path_; }
const Pin *crprClkPin(const StaState *sta) const;
// Much faster than crprClkPin.
2019-11-11 17:38:25 +01:00
VertexId crprClkVertexId() const;
2019-03-13 01:25:53 +01:00
// Much faster than crprClkPin != nullptr
2018-09-28 17:54:21 +02:00
bool hasCrprClkPin() const { return !crpr_clk_path_.isNull(); }
bool refsFilter(const StaState *sta) const;
// This clk_info/tag is used for a generated clock source path.
bool isGenClkSrcPath() const { return is_gen_clk_src_path_; }
2019-08-08 23:13:02 +02:00
size_t hash() const { return hash_; }
2018-09-28 17:54:21 +02:00
protected:
void findHash(const StaState *sta);
private:
DISALLOW_COPY_AND_ASSIGN(ClkInfo);
ClockEdge *clk_edge_;
const Pin *clk_src_;
const Pin *gen_clk_src_;
PathVertexRep crpr_clk_path_;
ClockUncertainties *uncertainties_;
Arrival insertion_;
float latency_;
2019-08-08 23:13:02 +02:00
size_t hash_;
2018-09-28 17:54:21 +02:00
unsigned int is_propagated_:1;
unsigned int is_gen_clk_src_path_:1;
unsigned int is_pulse_clk_:1;
2019-11-11 23:30:19 +01:00
unsigned int pulse_clk_sense_:RiseFall::index_bit_count;
2018-09-28 17:54:21 +02:00
unsigned int path_ap_index_:path_ap_index_bit_count;
};
class ClkInfoLess
{
public:
explicit ClkInfoLess(const StaState *sta);
~ClkInfoLess() {}
bool operator()(const ClkInfo *clk_info1,
const ClkInfo *clk_info2) const;
protected:
const StaState *sta_;
};
class ClkInfoHash
{
public:
2019-08-08 23:13:02 +02:00
size_t operator()(const ClkInfo *clk_info);
2018-09-28 17:54:21 +02:00
};
class ClkInfoEqual
{
public:
ClkInfoEqual(const StaState *sta);
bool operator()(const ClkInfo *clk_info1,
const ClkInfo *clk_info2);
protected:
const StaState *sta_;
};
} // namespace