OpenSTA/search/PathRef.cc

257 lines
4.8 KiB
C++
Raw Permalink Normal View History

2018-09-28 17:54:21 +02:00
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2024, 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
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
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-09-28 17:54:21 +02:00
2020-04-05 23:53:44 +02:00
#include "PathRef.hh"
2020-04-05 20:35:51 +02:00
2020-04-05 23:53:44 +02:00
#include "Graph.hh"
#include "TagGroup.hh"
#include "PathEnumed.hh"
#include "PathVertex.hh"
#include "Search.hh"
2020-04-05 20:35:51 +02:00
2018-09-28 17:54:21 +02:00
namespace sta {
PathRef::PathRef() :
2019-03-13 01:25:53 +01:00
path_enumed_(nullptr)
2018-09-28 17:54:21 +02:00
{
}
PathRef::PathRef(const Path *path) :
2019-03-13 01:25:53 +01:00
path_enumed_(nullptr)
2018-09-28 17:54:21 +02:00
{
if (path)
path->setRef(this);
}
PathRef::PathRef(const PathRef &path) :
path_vertex_(path.path_vertex_),
path_enumed_(path.path_enumed_)
{
}
2018-12-26 20:03:31 +01:00
PathRef::PathRef(const PathRef *path) :
path_vertex_(path->path_vertex_),
path_enumed_(path->path_enumed_)
{
}
2018-09-28 17:54:21 +02:00
PathRef::PathRef(const PathVertex &path) :
path_vertex_(&path),
2019-03-13 01:25:53 +01:00
path_enumed_(nullptr)
2018-09-28 17:54:21 +02:00
{
}
void
PathRef::init()
{
path_vertex_.init();
2019-03-13 01:25:53 +01:00
path_enumed_ = nullptr;
2018-09-28 17:54:21 +02:00
}
void
PathRef::init(const PathRef &path)
{
path_vertex_ = path.path_vertex_;
path_enumed_ = path.path_enumed_;
}
void
PathRef::init(const PathRef *path)
{
path_vertex_ = path->path_vertex_;
path_enumed_ = path->path_enumed_;
}
void
PathRef::init(const PathVertex *path)
{
2019-11-11 21:03:38 +01:00
path_vertex_ = path;
2018-09-28 17:54:21 +02:00
}
void
PathRef::init(const PathVertex &path)
{
2019-11-11 21:03:38 +01:00
path_vertex_ = path;
2018-09-28 17:54:21 +02:00
}
void
PathRef::init(Vertex *vertex,
Tag *tag,
int arrival_index)
{
path_vertex_.init(vertex, tag, arrival_index);
2019-03-13 01:25:53 +01:00
path_enumed_ = nullptr;
2018-09-28 17:54:21 +02:00
}
void
PathRef::init(PathEnumed *path)
{
path_enumed_ = path;
}
void
PathRef::setRef(PathRef *ref) const
{
2019-11-11 21:03:38 +01:00
ref->path_vertex_ = path_vertex_;
2018-09-28 17:54:21 +02:00
ref->path_enumed_ = path_enumed_;
}
void
PathRef::deleteRep()
{
if (path_enumed_)
deletePathEnumed(path_enumed_);
}
bool
PathRef::isNull() const
{
2019-03-13 01:25:53 +01:00
return path_enumed_ == nullptr
2018-09-28 17:54:21 +02:00
&& path_vertex_.isNull();
}
Vertex *
PathRef::vertex(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->vertex(sta);
else
return path_vertex_.vertex(sta);
}
2019-11-11 17:38:25 +01:00
VertexId
PathRef::vertexId(const StaState *sta) const
2018-09-28 17:54:21 +02:00
{
if (path_enumed_)
2019-11-11 17:38:25 +01:00
return path_enumed_->vertexId(sta);
2018-09-28 17:54:21 +02:00
else
2019-11-11 17:38:25 +01:00
return path_vertex_.vertexId(sta);
2018-09-28 17:54:21 +02:00
}
Tag *
PathRef::tag(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->tag(sta);
else
return path_vertex_.tag(sta);
}
TagIndex
PathRef::tagIndex(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->tagIndex(sta);
else
return path_vertex_.tagIndex(sta);
}
2019-11-11 23:30:19 +01:00
const RiseFall *
2018-09-28 17:54:21 +02:00
PathRef::transition(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->transition(sta);
else
return path_vertex_.transition(sta);
}
int
2019-11-11 23:30:19 +01:00
PathRef::rfIndex(const StaState *sta) const
2018-09-28 17:54:21 +02:00
{
if (path_enumed_)
2019-11-11 23:30:19 +01:00
return path_enumed_->rfIndex(sta);
2018-09-28 17:54:21 +02:00
else
2019-11-11 23:30:19 +01:00
return path_vertex_.rfIndex(sta);
2018-09-28 17:54:21 +02:00
}
PathAnalysisPt *
PathRef::pathAnalysisPt(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->pathAnalysisPt(sta);
else
return path_vertex_.pathAnalysisPt(sta);
}
PathAPIndex
PathRef::pathAnalysisPtIndex(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->pathAnalysisPtIndex(sta);
else
return path_vertex_.pathAnalysisPtIndex(sta);
}
Arrival
PathRef::arrival(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->arrival(sta);
else
return path_vertex_.arrival(sta);
}
void
PathRef::setArrival(Arrival arrival,
const StaState *sta)
{
if (path_enumed_)
return path_enumed_->setArrival(arrival, sta);
else
return path_vertex_.setArrival(arrival, sta);
}
const Required &
PathRef::required(const StaState *sta) const
{
if (path_enumed_)
return path_enumed_->required(sta);
else
return path_vertex_.required(sta);
}
void
2021-03-25 21:30:47 +01:00
PathRef::setRequired(const Required &required,
const StaState *sta)
2018-09-28 17:54:21 +02:00
{
if (path_enumed_)
return path_enumed_->setRequired(required, sta);
else
return path_vertex_.setRequired(required, sta);
}
void
PathRef::prevPath(const StaState *sta,
// Return values.
2021-03-25 21:30:47 +01:00
PathRef &prev_path,
TimingArc *&prev_arc) const
2018-09-28 17:54:21 +02:00
{
if (path_enumed_)
path_enumed_->prevPath(sta, prev_path, prev_arc);
else
path_vertex_.prevPath(sta, prev_path, prev_arc);
}
void
PathRef::arrivalIndex(int &arrival_index,
bool &arrival_exists) const
{
return path_vertex_.arrivalIndex(arrival_index, arrival_exists);
}
} // namespace