ArrivalVisitor::pruneCrprArrivals() seg fault (replace pr477)

Signed-off-by: James Cherry <cherry@CerezoBook.local>
This commit is contained in:
James Cherry 2026-07-18 18:29:04 -07:00
parent 76bc0496ec
commit dc5ccd2d69
3 changed files with 19 additions and 8 deletions

View File

@ -118,6 +118,15 @@ ClkInfo::crprClkVertexId(const StaState *sta) const
return crpr_clk_path_.vertexId(sta); return crpr_clk_path_.vertexId(sta);
} }
const MinMax *
ClkInfo::crprClkMinMax(const StaState *sta) const
{
if (crpr_clk_path_.isNull())
return nullptr;
else
return crpr_clk_path_.tag(sta)->minMax();
}
Path * Path *
ClkInfo::crprClkPath(const StaState *sta) ClkInfo::crprClkPath(const StaState *sta)
{ {

View File

@ -78,13 +78,14 @@ public:
// Null for clocks because the path cannot point to itself. // Null for clocks because the path cannot point to itself.
Path *crprClkPath(const StaState *sta); Path *crprClkPath(const StaState *sta);
const Path *crprClkPath(const StaState *sta) const; const Path *crprClkPath(const StaState *sta) const;
const Path *crprClkPathRaw() const;
VertexId crprClkVertexId(const StaState *sta) const; VertexId crprClkVertexId(const StaState *sta) const;
const MinMax *crprClkMinMax(const StaState *sta) const;
bool hasCrprClkPin() const { return !crpr_clk_path_.isNull(); } bool hasCrprClkPin() const { return !crpr_clk_path_.isNull(); }
// This clk_info/tag is used for a generated clock source path. // This clk_info/tag is used for a generated clock source path.
bool isGenClkSrcPath() const { return is_gen_clk_src_path_; } bool isGenClkSrcPath() const { return is_gen_clk_src_path_; }
size_t hash() const { return hash_; } size_t hash() const { return hash_; }
bool crprPathRefsFilter() const { return crpr_path_refs_filter_; } bool crprPathRefsFilter() const { return crpr_path_refs_filter_; }
const Path *crprClkPathRaw() const;
static int cmp(const ClkInfo *clk_info1, static int cmp(const ClkInfo *clk_info1,
const ClkInfo *clk_info2, const ClkInfo *clk_info2,

View File

@ -1396,13 +1396,15 @@ ArrivalVisitor::pruneCrprArrivals()
size_t path_index = path_itr->second; size_t path_index = path_itr->second;
const ClkInfo *clk_info = tag->clkInfo(); const ClkInfo *clk_info = tag->clkInfo();
bool deleted_tag = false; bool deleted_tag = false;
if (!tag->isClock() && clk_info->hasCrprClkPin()) { if (!tag->isClock()
const MinMax *min_max = tag->minMax(); && clk_info->hasCrprClkPin()) {
Path *path_no_crpr = tag_bldr_no_crpr_->tagMatchPath(tag); Path *path_no_crpr = tag_bldr_no_crpr_->tagMatchPath(tag);
if (path_no_crpr) { if (path_no_crpr
&& path_no_crpr->tag(this) != tag) {
Arrival max_arrival = path_no_crpr->arrival(); Arrival max_arrival = path_no_crpr->arrival();
const ClkInfo *clk_info_no_crpr = path_no_crpr->clkInfo(this); const ClkInfo *clk_info_no_crpr = path_no_crpr->clkInfo(this);
Arrival max_crpr = crpr->maxCrpr(clk_info_no_crpr); Arrival max_crpr = crpr->maxCrpr(clk_info_no_crpr);
const MinMax *min_max = tag->minMax();
Arrival max_arrival_max_crpr = (min_max == MinMax::max()) Arrival max_arrival_max_crpr = (min_max == MinMax::max())
? delayDiff(max_arrival, max_crpr, this) ? delayDiff(max_arrival, max_crpr, this)
: delaySum(max_arrival, max_crpr, this); : delaySum(max_arrival, max_crpr, this);
@ -1412,11 +1414,10 @@ ArrivalVisitor::pruneCrprArrivals()
delayAsString(max_crpr, this), delayAsString(max_crpr, this),
delayAsString(max_arrival_max_crpr, this)); delayAsString(max_arrival_max_crpr, this));
Arrival arrival = tag_bldr_->arrival(path_index); Arrival arrival = tag_bldr_->arrival(path_index);
// Latch D->Q path uses enable min so crpr clk path min/max
// does not match the path min/max.
if (delayGreater(max_arrival_max_crpr, arrival, min_max, this) if (delayGreater(max_arrival_max_crpr, arrival, min_max, this)
&& clk_info_no_crpr->crprClkPath(this)->minMax(this) // Latch D->Q path uses enable min so crpr clk path min/max
== clk_info->crprClkPath(this)->minMax(this)) { // does not match the path min/max.
&& clk_info_no_crpr->crprClkMinMax(this) == clk_info->crprClkMinMax(this)) {
debugPrint(debug_, "search", 3, " pruned {}", debugPrint(debug_, "search", 3, " pruned {}",
tag->to_string(this)); tag->to_string(this));
path_itr = path_index_map.erase(path_itr); path_itr = path_index_map.erase(path_itr);