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 "Vector.hh"
|
|
|
|
|
#include "Set.hh"
|
|
|
|
|
#include "Transition.hh"
|
|
|
|
|
#include "SdcClass.hh"
|
|
|
|
|
#include "SearchClass.hh"
|
2025-03-27 02:21:03 +01:00
|
|
|
#include "Path.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
|
|
|
|
// Tags are used to distinguish multiple paths that hold
|
|
|
|
|
// arrival/required times on a vertex.
|
|
|
|
|
//
|
|
|
|
|
// Each tag corresponds to a different path on the vertex thru a
|
|
|
|
|
// set of exceptions.
|
|
|
|
|
//
|
|
|
|
|
// Clock paths are distinguished from non-clock paths using separate
|
|
|
|
|
// tags. This is because clocks pins can also have input arrivals wrt
|
|
|
|
|
// other clocks.
|
|
|
|
|
//
|
|
|
|
|
// When common clock reconvergence pessimism removal is enabled the
|
|
|
|
|
// tag ClkInfo includes the last clock driver pin so that distinct
|
|
|
|
|
// paths are used for paths from different sources of min/max clock
|
|
|
|
|
// arrivals.
|
|
|
|
|
|
|
|
|
|
class Tag
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Tag(TagIndex index,
|
2023-06-02 04:28:32 +02:00
|
|
|
int rf_index,
|
2018-09-28 17:54:21 +02:00
|
|
|
PathAPIndex path_ap_index,
|
2025-09-17 00:30:16 +02:00
|
|
|
const ClkInfo *clk_info,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool is_clk,
|
|
|
|
|
InputDelay *input_delay,
|
|
|
|
|
bool is_segment_start,
|
|
|
|
|
ExceptionStateSet *states,
|
|
|
|
|
bool own_states,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
~Tag();
|
2025-04-12 01:59:48 +02:00
|
|
|
std::string to_string(const StaState *sta) const;
|
|
|
|
|
std::string to_string(bool report_index,
|
|
|
|
|
bool report_rf_min_max,
|
|
|
|
|
const StaState *sta) const;
|
2025-09-17 00:30:16 +02:00
|
|
|
const ClkInfo *clkInfo() const { return clk_info_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
bool isClock() const { return is_clk_; }
|
2023-01-19 19:23:45 +01:00
|
|
|
const ClockEdge *clkEdge() const;
|
|
|
|
|
const Clock *clock() const;
|
2018-09-28 17:54:21 +02:00
|
|
|
const Pin *clkSrc() const;
|
2023-06-02 04:28:32 +02:00
|
|
|
int rfIndex() const { return rf_index_; }
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *transition() const;
|
2025-10-30 16:53:36 +01:00
|
|
|
const MinMax *minMax(const StaState *sta) const;
|
2018-09-28 17:54:21 +02:00
|
|
|
PathAnalysisPt *pathAnalysisPt(const StaState *sta) const;
|
|
|
|
|
PathAPIndex pathAPIndex() const { return path_ap_index_; }
|
|
|
|
|
TagIndex index() const { return index_; }
|
|
|
|
|
ExceptionStateSet *states() const { return states_; }
|
|
|
|
|
void setStates(ExceptionStateSet *states);
|
|
|
|
|
bool isGenClkSrcPath() const;
|
2023-01-19 19:23:45 +01:00
|
|
|
const Clock *genClkSrcPathClk(const StaState *sta) const;
|
2018-09-28 17:54:21 +02:00
|
|
|
// Input delay at search startpoint (not propagated).
|
|
|
|
|
InputDelay *inputDelay() const { return input_delay_; }
|
|
|
|
|
bool isLoop() const { return is_loop_; }
|
|
|
|
|
bool isFilter() const { return is_filter_; }
|
|
|
|
|
bool isSegmentStart() const { return is_segment_start_; }
|
2025-09-16 22:53:16 +02:00
|
|
|
size_t hash(bool match_crpr_clk_pin,
|
|
|
|
|
const StaState *sta) const;
|
2025-03-27 02:21:03 +01:00
|
|
|
size_t matchHash(bool match_crpr_clk_pin,
|
|
|
|
|
const StaState *sta) const;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2025-09-16 23:49:01 +02:00
|
|
|
static int cmp(const Tag *tag1,
|
|
|
|
|
const Tag *tag2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static int matchCmp(const Tag *tag1,
|
|
|
|
|
const Tag *tag2,
|
|
|
|
|
bool match_clk_clk_pin,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static bool match(const Tag *tag1,
|
|
|
|
|
const Tag *tag2,
|
|
|
|
|
bool match_crpr_clk_pin,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static bool equal(const Tag *tag1,
|
|
|
|
|
const Tag *tag2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static bool matchNoPathAp(const Tag *tag1,
|
|
|
|
|
const Tag *tag2);
|
|
|
|
|
static bool matchCrpr(const Tag *tag1,
|
|
|
|
|
const Tag *tag2);
|
|
|
|
|
static bool matchNoCrpr(const Tag *tag1,
|
|
|
|
|
const Tag *tag2);
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
protected:
|
|
|
|
|
void findHash();
|
|
|
|
|
|
2025-09-16 23:49:01 +02:00
|
|
|
// Match tag clock edge, clock driver and exception states but not clk info.
|
|
|
|
|
static bool match(const Tag *tag1,
|
|
|
|
|
const Tag *tag2,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
static bool stateEqual(const Tag *tag1,
|
|
|
|
|
const Tag *tag2);
|
|
|
|
|
static int stateCmp(const Tag *tag1,
|
|
|
|
|
const Tag *tag2);
|
|
|
|
|
static bool stateEqualCrpr(const Tag *tag1,
|
|
|
|
|
const Tag *tag2);
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
private:
|
2025-09-17 00:30:16 +02:00
|
|
|
const ClkInfo *clk_info_;
|
2018-09-28 17:54:21 +02:00
|
|
|
InputDelay *input_delay_;
|
|
|
|
|
ExceptionStateSet *states_;
|
2019-08-08 23:13:02 +02:00
|
|
|
size_t hash_;
|
|
|
|
|
size_t match_hash_;
|
2023-06-02 03:16:51 +02:00
|
|
|
TagIndex index_;
|
2018-09-28 17:54:21 +02:00
|
|
|
bool is_clk_:1;
|
|
|
|
|
bool is_filter_:1;
|
|
|
|
|
bool is_loop_:1;
|
|
|
|
|
bool is_segment_start_:1;
|
|
|
|
|
// Indicates that states_ is owned by the tag.
|
|
|
|
|
bool own_states_:1;
|
2023-06-02 04:28:32 +02:00
|
|
|
unsigned int rf_index_:RiseFall::index_bit_count;
|
2018-09-28 17:54:21 +02:00
|
|
|
unsigned int path_ap_index_:path_ap_index_bit_count;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TagLess
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-05-09 20:28:03 +02:00
|
|
|
TagLess(const StaState *sta);
|
2018-09-28 17:54:21 +02:00
|
|
|
bool operator()(const Tag *tag1,
|
|
|
|
|
const Tag *tag2) const;
|
2025-05-09 20:28:03 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const StaState *sta_;
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TagIndexLess
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
bool operator()(const Tag *tag1,
|
|
|
|
|
const Tag *tag2) const;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TagHash
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-09-16 22:53:16 +02:00
|
|
|
TagHash(const StaState *sta);
|
2021-12-10 02:19:26 +01:00
|
|
|
size_t operator()(const Tag *tag) const;
|
2025-09-16 22:53:16 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const StaState *sta_;
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TagEqual
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-09-16 22:53:16 +02:00
|
|
|
TagEqual(const StaState *sta);
|
2018-09-28 17:54:21 +02:00
|
|
|
bool operator()(const Tag *tag1,
|
2021-12-10 02:19:26 +01:00
|
|
|
const Tag *tag2) const;
|
2025-09-16 22:53:16 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const StaState *sta_;
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|