2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2025-01-22 02:54:33 +01:00
|
|
|
// Copyright (c) 2025, 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
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "MinMax.hh"
|
|
|
|
|
#include "NetworkClass.hh"
|
|
|
|
|
#include "SdcClass.hh"
|
|
|
|
|
#include "Transition.hh"
|
|
|
|
|
#include "GraphClass.hh"
|
|
|
|
|
#include "Delay.hh"
|
|
|
|
|
#include "StaState.hh"
|
|
|
|
|
#include "SearchClass.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
2018-12-21 07:41:54 +01:00
|
|
|
class DcalcAnalysisPt;
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
class Path
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-03-27 02:21:03 +01:00
|
|
|
Path();
|
2025-09-17 00:30:16 +02:00
|
|
|
Path(const Path *path);
|
2025-03-27 02:21:03 +01:00
|
|
|
Path(Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
Path(Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
Arrival arrival,
|
|
|
|
|
Path *prev_path,
|
|
|
|
|
Edge *prev_edge,
|
|
|
|
|
TimingArc *prev_arc,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
Path(Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
Arrival arrival,
|
|
|
|
|
Path *prev_path,
|
|
|
|
|
Edge *prev_edge,
|
|
|
|
|
TimingArc *prev_arc,
|
|
|
|
|
bool is_enum,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
~Path();
|
2025-04-12 01:59:48 +02:00
|
|
|
std::string to_string(const StaState *sta) const;
|
2025-03-27 02:21:03 +01:00
|
|
|
bool isNull() const;
|
|
|
|
|
// prev_path null
|
|
|
|
|
void init(Vertex *vertex,
|
|
|
|
|
Arrival arrival,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
void init(Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
Arrival arrival,
|
|
|
|
|
Path *prev_path,
|
|
|
|
|
Edge *prev_edge,
|
|
|
|
|
TimingArc *prev_arc,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
void init(Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
void init(Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
Arrival arrival,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
|
|
|
|
|
Vertex *vertex(const StaState *sta) const;
|
|
|
|
|
VertexId vertexId(const StaState *sta) const;
|
|
|
|
|
Pin *pin(const StaState *sta) const;
|
|
|
|
|
Tag *tag(const StaState *sta) const;
|
|
|
|
|
TagIndex tagIndex(const StaState *sta) const;
|
|
|
|
|
void setTag(Tag *tag);
|
|
|
|
|
size_t pathIndex(const StaState *sta) const;
|
2025-09-17 00:30:16 +02:00
|
|
|
const ClkInfo *clkInfo(const StaState *sta) const;
|
2025-03-27 02:21:03 +01:00
|
|
|
const ClockEdge *clkEdge(const StaState *sta) const;
|
|
|
|
|
const Clock *clock(const StaState *sta) const;
|
|
|
|
|
bool isClock(const StaState *sta) const;
|
|
|
|
|
const RiseFall *transition(const StaState *sta) const;
|
|
|
|
|
int rfIndex(const StaState *sta) const;
|
|
|
|
|
const MinMax *minMax(const StaState *sta) const;
|
|
|
|
|
PathAnalysisPt *pathAnalysisPt(const StaState *sta) const;
|
|
|
|
|
PathAPIndex pathAnalysisPtIndex(const StaState *sta) const;
|
|
|
|
|
DcalcAnalysisPt *dcalcAnalysisPt(const StaState *sta) const;
|
|
|
|
|
Arrival &arrival() { return arrival_; }
|
|
|
|
|
const Arrival &arrival() const { return arrival_; }
|
|
|
|
|
void setArrival(Arrival arrival);
|
|
|
|
|
Required &required() { return required_; }
|
|
|
|
|
const Required &required() const {return required_; }
|
|
|
|
|
void setRequired(const Required &required);
|
|
|
|
|
Slack slack(const StaState *sta) const;
|
|
|
|
|
Slew slew(const StaState *sta) const;
|
2018-09-28 17:54:21 +02:00
|
|
|
// This takes the same time as prevPath and prevArc combined.
|
2025-03-27 02:21:03 +01:00
|
|
|
Path *prevPath() const;
|
|
|
|
|
void setPrevPath(Path *prev_path);
|
|
|
|
|
void clearPrevPath(const StaState *sta);
|
|
|
|
|
TimingArc *prevArc(const StaState *sta) const;
|
|
|
|
|
Edge *prevEdge(const StaState *sta) const;
|
|
|
|
|
Vertex *prevVertex(const StaState *sta) const;
|
|
|
|
|
void setPrevEdgeArc(Edge *prev_edge,
|
|
|
|
|
TimingArc *prev_arc,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
bool isEnum() const { return is_enum_; }
|
|
|
|
|
void setIsEnum(bool is_enum);
|
|
|
|
|
void checkPrevPath(const StaState *sta) const;
|
|
|
|
|
|
2025-04-06 21:36:32 +02:00
|
|
|
static Path *vertexPath(const Path *path,
|
|
|
|
|
const StaState *sta);
|
2025-03-27 02:21:03 +01:00
|
|
|
static Path *vertexPath(const Path &path,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static Path *vertexPath(const Vertex *vertex,
|
|
|
|
|
Tag *tag,
|
|
|
|
|
const StaState *sta);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
static bool less(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static int cmp(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Compare all path attributes (vertex, transition, tag, analysis point).
|
|
|
|
|
static bool equal(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Compare pin name and transition and source clock edge.
|
|
|
|
|
static int cmpPinTrClk(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Compare source clock edge.
|
|
|
|
|
static int cmpClk(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Compare vertex, transition, path ap and tag without crpr clk pin.
|
|
|
|
|
static int cmpNoCrpr(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Search back on each path until finding a difference.
|
|
|
|
|
static int cmpAll(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static bool lessAll(const Path *path1,
|
|
|
|
|
const Path *path2,
|
|
|
|
|
const StaState *sta);
|
2025-03-27 02:21:03 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
Path *prev_path_;
|
|
|
|
|
Arrival arrival_;
|
|
|
|
|
Required required_;
|
|
|
|
|
union {
|
|
|
|
|
VertexId vertex_id_;
|
|
|
|
|
EdgeId prev_edge_id_;
|
|
|
|
|
};
|
|
|
|
|
TagIndex tag_index_:tag_index_bit_count;
|
|
|
|
|
bool is_enum_:1;
|
|
|
|
|
unsigned prev_arc_idx_:2;
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Compare all path attributes (vertex, transition, tag, analysis point).
|
|
|
|
|
class PathLess
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit PathLess(const StaState *sta);
|
|
|
|
|
bool operator()(const Path *path1,
|
|
|
|
|
const Path *path2) const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
const StaState *sta_;
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-27 02:21:03 +01:00
|
|
|
// Iterator for paths on a vertex.
|
|
|
|
|
class VertexPathIterator : public Iterator<Path*>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// Iterate over all vertex paths.
|
|
|
|
|
VertexPathIterator(Vertex *vertex,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Iterate over vertex paths with the same transition and
|
|
|
|
|
// analysis pt but different tags.
|
|
|
|
|
VertexPathIterator(Vertex *vertex,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
const PathAnalysisPt *path_ap,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Iterate over vertex paths with the same transition and
|
|
|
|
|
// analysis pt min/max but different tags.
|
|
|
|
|
VertexPathIterator(Vertex *vertex,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
const MinMax *min_max,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
VertexPathIterator(Vertex *vertex,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
const PathAnalysisPt *path_ap,
|
|
|
|
|
const MinMax *min_max,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
virtual ~VertexPathIterator();
|
|
|
|
|
virtual bool hasNext();
|
|
|
|
|
virtual Path *next();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void findNext();
|
|
|
|
|
|
|
|
|
|
const Search *search_;
|
2025-05-02 02:34:51 +02:00
|
|
|
bool filtered_;
|
2025-03-27 02:21:03 +01:00
|
|
|
const RiseFall *rf_;
|
|
|
|
|
const PathAnalysisPt *path_ap_;
|
|
|
|
|
const MinMax *min_max_;
|
|
|
|
|
Path *paths_;
|
|
|
|
|
size_t path_count_;
|
2025-05-02 02:34:51 +02:00
|
|
|
size_t path_index_;
|
2025-03-27 02:21:03 +01:00
|
|
|
Path *next_;
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
} // namespace
|