diff --git a/include/sta/Search.hh b/include/sta/Search.hh index 4cbbd9d8..a5d0a521 100644 --- a/include/sta/Search.hh +++ b/include/sta/Search.hh @@ -347,6 +347,7 @@ public: ExceptionTo *to, bool unconstrained, bool thru_latches); + VertexSeq filteredEndpoints(); protected: void init(StaState *sta); @@ -598,6 +599,7 @@ protected: // filter_from_ is owned by filter_ if it exists. ExceptionFrom *filter_from_; ExceptionTo *filter_to_; + VertexSet *filtered_arrivals_; bool found_downstream_clk_pins_; PathGroups *path_groups_; VisitPathEnds *visit_path_ends_; diff --git a/search/MakeTimingModel.cc b/search/MakeTimingModel.cc index a2fbac99..ecf8d0ea 100644 --- a/search/MakeTimingModel.cc +++ b/search/MakeTimingModel.cc @@ -323,8 +323,9 @@ MakeTimingModel::findTimingFromInput(Port *input_port) search_->findFilteredArrivals(from, nullptr, nullptr, false, false); end_visitor.setInputRf(input_rf); + VertexSeq endpoints = search_->filteredEndpoints(); VisitPathEnds visit_ends(sta_); - for (Vertex *end : *search_->endpoints()) + for (Vertex *end : endpoints) visit_ends.visitPathEnds(end, corner_, MinMaxAll::all(), true, &end_visitor); findOutputDelays(input_rf, output_delays); search_->deleteFilteredArrivals(); diff --git a/search/Search.cc b/search/Search.cc index 1b7a5970..bdaa9e0a 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -250,6 +250,7 @@ Search::init(StaState *sta) filter_ = nullptr; filter_from_ = nullptr; filter_to_ = nullptr; + filtered_arrivals_ = new VertexSet(graph_); found_downstream_clk_pins_ = false; } @@ -287,6 +288,7 @@ Search::~Search() delete worst_slacks_; delete check_crpr_; delete genclks_; + delete filtered_arrivals_; deleteFilter(); deletePathGroups(); } @@ -403,6 +405,7 @@ Search::deletePaths() Vertex *vertex = vertex_iter.next(); vertex->deletePaths(); } + filtered_arrivals_->clear(); graph_->clearArrivals(); graph_->clearPrevPaths(); arrivals_exist_ = false; @@ -504,24 +507,34 @@ Search::deleteFilteredArrivals() && (from->pins() || from->instances())) || thrus) { - VertexIterator vertex_iter(graph_); - while (vertex_iter.hasNext()) { - Vertex *vertex = vertex_iter.next(); - TagGroup *tag_group = tagGroup(vertex); - if (tag_group - && tag_group->hasFilterTag()) { - // Vertex's tag_group will be deleted. - deletePaths(vertex); - arrivalInvalid(vertex); - requiredInvalid(vertex); - } + for (Vertex *vertex : *filtered_arrivals_) { + deletePaths(vertex); + arrivalInvalid(vertex); + requiredInvalid(vertex); } + bool check_filter_arrivals = false; + if (check_filter_arrivals) { + VertexIterator vertex_iter(graph_); + while (vertex_iter.hasNext()) { + Vertex *vertex = vertex_iter.next(); + TagGroup *tag_group = tagGroup(vertex); + if (tag_group + && tag_group->hasFilterTag()) + filtered_arrivals_->erase(vertex); + } + if (!filtered_arrivals_->empty()) { + report_->reportLine("Filtered verticies mismatch"); + for (Vertex *vertex : *filtered_arrivals_) + report_->reportLine(" %s", vertex->name(network_)); + } + } + filtered_arrivals_->clear(); deleteFilterTagGroups(); deleteFilterClkInfos(); deleteFilterTags(); } + deleteFilter(); } - deleteFilter(); } void @@ -570,6 +583,7 @@ Search::deleteFilterClkInfos() void Search::findFilteredArrivals(bool thru_latches) { + filtered_arrivals_->clear(); findArrivalsSeed(); seedFilterStarts(); Level max_level = levelize_->maxLevel(); @@ -588,6 +602,17 @@ Search::findFilteredArrivals(bool thru_latches) arrivals_exist_ = true; } +VertexSeq +Search::filteredEndpoints() +{ + VertexSeq ends; + for (Vertex *vertex : *filtered_arrivals_) { + if (isEndpoint(vertex)) + ends.push_back(vertex); + } + return ends; +} + class SeedFaninsThruHierPin : public HierPinThruVisitor { public: @@ -654,6 +679,7 @@ Search::deleteVertexBefore(Vertex *vertex) deletePaths(vertex); arrival_iter_->deleteVertexBefore(vertex); invalid_arrivals_->erase(vertex); + filtered_arrivals_->erase(vertex); } if (requireds_exist_) { required_iter_->deleteVertexBefore(vertex); @@ -2659,6 +2685,8 @@ Search::setVertexArrivals(Vertex *vertex, } tag_bldr->copyArrivals(tag_group, prev_arrivals, prev_paths); vertex->setTagGroupIndex(tag_group->index()); + if (tag_group->hasFilterTag()) + filtered_arrivals_->insert(vertex); if (has_requireds) { requiredInvalid(vertex); @@ -2683,6 +2711,8 @@ Search::setVertexArrivals(Vertex *vertex, tag_bldr->copyArrivals(tag_group, arrivals, prev_paths); vertex->setTagGroupIndex(tag_group->index()); + if (tag_group->hasFilterTag()) + filtered_arrivals_->insert(vertex); } } }