2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2024-01-12 01:34:49 +01:00
|
|
|
// 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
|
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/>.
|
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 20:35:51 +02:00
|
|
|
#include <mutex>
|
|
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "Map.hh"
|
|
|
|
|
#include "Vector.hh"
|
|
|
|
|
#include "SdcClass.hh"
|
|
|
|
|
#include "StaState.hh"
|
|
|
|
|
#include "SearchClass.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
|
|
|
|
class MinMax;
|
|
|
|
|
class PathEndVisitor;
|
|
|
|
|
|
|
|
|
|
typedef PathEndSeq::Iterator PathGroupIterator;
|
|
|
|
|
typedef Map<const Clock*, PathGroup*> PathGroupClkMap;
|
|
|
|
|
typedef Map<const char*, PathGroup*, CharPtrLess> PathGroupNamedMap;
|
|
|
|
|
|
|
|
|
|
// A collection of PathEnds grouped and sorted for reporting.
|
|
|
|
|
class PathGroup
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-01-14 00:58:47 +01:00
|
|
|
~PathGroup();
|
2018-09-28 17:54:21 +02:00
|
|
|
// Path group that compares compare slacks.
|
|
|
|
|
static PathGroup *makePathGroupArrival(const char *name,
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
|
|
|
|
const MinMax *min_max,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
// Path group that compares arrival time, sorted by min_max.
|
|
|
|
|
static PathGroup *makePathGroupSlack(const char *name,
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
|
|
|
|
float min_slack,
|
|
|
|
|
float max_slack,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
const char *name() const { return name_; }
|
|
|
|
|
const MinMax *minMax() const { return min_max_;}
|
|
|
|
|
const PathEndSeq &pathEnds() const { return path_ends_; }
|
|
|
|
|
void insert(PathEnd *path_end);
|
2024-11-24 00:38:26 +01:00
|
|
|
// Push group_path_count into path_ends.
|
2023-01-20 19:19:39 +01:00
|
|
|
void pushEnds(PathEndSeq &path_ends);
|
2025-01-14 00:58:47 +01:00
|
|
|
// Predicate to determine if a PathEnd is worth saving.
|
|
|
|
|
bool saveable(PathEnd *path_end);
|
2024-11-24 00:38:26 +01:00
|
|
|
int maxPaths() const { return group_path_count_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
PathGroupIterator *iterator();
|
|
|
|
|
// This does NOT delete the path ends.
|
|
|
|
|
void clear();
|
2024-11-24 00:38:26 +01:00
|
|
|
static int group_path_count_max;
|
2019-02-16 21:07:59 +01:00
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
protected:
|
|
|
|
|
PathGroup(const char *name,
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
|
|
|
|
float min_slack,
|
|
|
|
|
float max_slack,
|
|
|
|
|
bool cmp_slack,
|
|
|
|
|
const MinMax *min_max,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
void ensureSortedMaxPaths();
|
|
|
|
|
void prune();
|
|
|
|
|
void sort();
|
|
|
|
|
|
|
|
|
|
const char *name_;
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count_;
|
|
|
|
|
int endpoint_path_count_;
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins_;
|
|
|
|
|
float slack_min_;
|
|
|
|
|
float slack_max_;
|
|
|
|
|
PathEndSeq path_ends_;
|
|
|
|
|
const MinMax *min_max_;
|
|
|
|
|
bool compare_slack_;
|
|
|
|
|
float threshold_;
|
2019-03-13 01:25:53 +01:00
|
|
|
std::mutex lock_;
|
2018-09-28 17:54:21 +02:00
|
|
|
const StaState *sta_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PathGroups : public StaState
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-11-24 00:38:26 +01:00
|
|
|
PathGroups(int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
|
|
|
|
float slack_min,
|
|
|
|
|
float slack_max,
|
|
|
|
|
PathGroupNameSet *group_names,
|
|
|
|
|
bool setup,
|
|
|
|
|
bool hold,
|
|
|
|
|
bool recovery,
|
|
|
|
|
bool removal,
|
|
|
|
|
bool clk_gating_setup,
|
|
|
|
|
bool clk_gating_hold,
|
|
|
|
|
bool unconstrained,
|
|
|
|
|
const StaState *sta);
|
|
|
|
|
~PathGroups();
|
2019-03-13 01:25:53 +01:00
|
|
|
// Use corner nullptr to make PathEnds for all corners.
|
2018-09-28 17:54:21 +02:00
|
|
|
// The PathEnds in the vector are owned by the PathGroups.
|
2023-01-20 19:19:39 +01:00
|
|
|
PathEndSeq makePathEnds(ExceptionTo *to,
|
|
|
|
|
bool unconstrained_paths,
|
|
|
|
|
const Corner *corner,
|
|
|
|
|
const MinMaxAll *min_max,
|
|
|
|
|
bool sort_by_slack);
|
2018-09-28 17:54:21 +02:00
|
|
|
PathGroup *findPathGroup(const char *name,
|
|
|
|
|
const MinMax *min_max) const;
|
|
|
|
|
PathGroup *findPathGroup(const Clock *clock,
|
|
|
|
|
const MinMax *min_max) const;
|
|
|
|
|
PathGroup *pathGroup(const PathEnd *path_end) const;
|
|
|
|
|
static bool isGroupPathName(const char *group_name);
|
|
|
|
|
static const char *asyncPathGroupName() { return async_group_name_; }
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void makeGroupPathEnds(ExceptionTo *to,
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
|
|
|
|
const Corner *corner,
|
|
|
|
|
const MinMaxAll *min_max);
|
|
|
|
|
void makeGroupPathEnds(ExceptionTo *to,
|
|
|
|
|
const Corner *corner,
|
|
|
|
|
const MinMaxAll *min_max,
|
|
|
|
|
PathEndVisitor *visitor);
|
|
|
|
|
void makeGroupPathEnds(VertexSet *endpoints,
|
|
|
|
|
const Corner *corner,
|
|
|
|
|
const MinMaxAll *min_max,
|
|
|
|
|
PathEndVisitor *visitor);
|
|
|
|
|
void enumPathEnds(PathGroup *group,
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
2018-12-05 23:18:41 +01:00
|
|
|
bool cmp_slack);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2023-01-20 19:19:39 +01:00
|
|
|
void pushGroupPathEnds(PathEndSeq &path_ends);
|
|
|
|
|
void pushUnconstrainedPathEnds(PathEndSeq &path_ends,
|
2018-09-28 17:54:21 +02:00
|
|
|
const MinMaxAll *min_max);
|
|
|
|
|
|
2024-11-24 00:38:26 +01:00
|
|
|
void makeGroups(int group_path_count,
|
|
|
|
|
int endpoint_path_count,
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins,
|
|
|
|
|
float slack_min,
|
|
|
|
|
float slack_max,
|
|
|
|
|
PathGroupNameSet *group_names,
|
|
|
|
|
bool setup_hold,
|
|
|
|
|
bool async,
|
|
|
|
|
bool gated_clk,
|
|
|
|
|
bool unconstrained,
|
|
|
|
|
const MinMax *min_max);
|
|
|
|
|
bool reportGroup(const char *group_name,
|
|
|
|
|
PathGroupNameSet *group_names) const;
|
|
|
|
|
GroupPath *groupPathTo(const PathEnd *path_end) const;
|
|
|
|
|
|
2024-11-24 00:38:26 +01:00
|
|
|
int group_path_count_;
|
|
|
|
|
int endpoint_path_count_;
|
2018-09-28 17:54:21 +02:00
|
|
|
bool unique_pins_;
|
|
|
|
|
float slack_min_;
|
|
|
|
|
float slack_max_;
|
|
|
|
|
|
|
|
|
|
// Paths grouped by SDC group_path command.
|
|
|
|
|
// name -> PathGroup
|
|
|
|
|
PathGroupNamedMap named_map_[MinMax::index_count];
|
|
|
|
|
// clock -> PathGroup
|
|
|
|
|
PathGroupClkMap clk_map_[MinMax::index_count];
|
|
|
|
|
// Min/max path delays.
|
|
|
|
|
PathGroup *path_delay_[MinMax::index_count];
|
|
|
|
|
// Gated clock checks.
|
|
|
|
|
PathGroup *gated_clk_[MinMax::index_count];
|
|
|
|
|
// Asynchronous (recovery/removal) checks.
|
|
|
|
|
PathGroup *async_[MinMax::index_count];
|
|
|
|
|
// Unconstrained paths.
|
|
|
|
|
PathGroup *unconstrained_[MinMax::index_count];
|
|
|
|
|
|
|
|
|
|
static const char *path_delay_group_name_;
|
|
|
|
|
static const char *gated_clk_group_name_;
|
|
|
|
|
static const char *async_group_name_;
|
|
|
|
|
static const char *unconstrained_group_name_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace
|