Skip to content

Commit 7d0e0bb

Browse files
committed
Merge branch 'master' of https://github.com/The-OpenROAD-Project-private/OpenSTA into secure-test-suite-cleanup
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
2 parents 619d6bc + 4c8efd7 commit 7d0e0bb

10 files changed

Lines changed: 4688 additions & 4 deletions

File tree

.github/workflows/buildifier.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525

2626
steps:
2727
- name: Checkout Code
28-
uses: actions/checkout@v5
28+
uses: actions/checkout@v6
2929

3030
- name: Cache buildifier
3131
id: cache-buildifier
32-
uses: actions/cache@v4
32+
uses: actions/cache@v5
3333
with:
3434
path: ./buildifier
3535
key: ${{ runner.os }}-buildifier-${{ env.BUILDIFIER_VERSION }}

graph/Graph.i

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "Graph.hh"
2929
#include "FuncExpr.hh"
3030
#include "TimingRole.hh"
31+
#include "search/Levelize.hh"
3132
#include "Liberty.hh"
3233
#include "Network.hh"
3334
#include "Clock.hh"
@@ -118,6 +119,32 @@ remove_delay_slew_annotations()
118119
Sta::sta()->removeDelaySlewAnnotations();
119120
}
120121

122+
void
123+
report_levelized_drvr_vertices(int max_count)
124+
{
125+
Sta *sta = Sta::sta();
126+
sta->ensureGraph();
127+
const VertexSeq &drvrs = sta->levelizedDrvrVertices();
128+
Report *report = sta->report();
129+
const Network *network = sta->network();
130+
report->report("driver vertex count {}", drvrs.size());
131+
Level prev_level = -1;
132+
int n = 0;
133+
for (Vertex *vertex : drvrs) {
134+
Level level = vertex->level();
135+
if (level < prev_level)
136+
report->report("level order violated {} {} < {}",
137+
network->pathName(vertex->pin()),
138+
level, prev_level);
139+
if (n < max_count)
140+
report->report("{} level={}",
141+
network->pathName(vertex->pin()),
142+
level);
143+
prev_level = level;
144+
n++;
145+
}
146+
}
147+
121148
%} // inline
122149

123150
////////////////////////////////////////////////////////////////

include/sta/Sta.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ public:
13251325
// Ensure that the timing graph has been built.
13261326
Graph *ensureGraph();
13271327
void ensureClkArrivals();
1328+
const VertexSeq& levelizedDrvrVertices();
13281329

13291330
// Find all arc delays and vertex slews with delay calculator.
13301331
virtual void findDelays();

search/Levelize.cc

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Levelize::Levelize(StaState *sta) :
5353
level_space_(10),
5454
roots_(makeVertexSet(sta)),
5555
relevelize_from_(makeVertexSet(sta)),
56-
observer_(nullptr)
56+
observer_(nullptr),
57+
drvr_vertices_level_valid_(false)
5758
{
5859
}
5960

@@ -90,6 +91,8 @@ Levelize::clear()
9091
loops_.clear();
9192
loop_edges_.clear();
9293
max_level_ = 0;
94+
drvr_vertices_level_valid_ = false;
95+
levelized_drvr_vertices_.clear();
9396
}
9497

9598
void
@@ -546,6 +549,7 @@ Levelize::setLevel(Vertex *vertex,
546549
void
547550
Levelize::invalid()
548551
{
552+
drvr_vertices_level_valid_ = false;
549553
if (levelized_) {
550554
debugPrint(debug_, "levelize", 1, "levels invalid");
551555
levelized_ = false;
@@ -559,6 +563,8 @@ Levelize::deleteVertexBefore(Vertex *vertex)
559563
if (levelized_) {
560564
roots_.erase(vertex);
561565
relevelize_from_.erase(vertex);
566+
drvr_vertices_level_valid_ = false;
567+
levelized_drvr_vertices_.clear();
562568
}
563569
}
564570

@@ -570,6 +576,7 @@ Levelize::relevelizeFrom(Vertex *vertex)
570576
vertex->to_string(this));
571577
relevelize_from_.insert(vertex);
572578
levels_valid_ = false;
579+
drvr_vertices_level_valid_ = false;
573580
}
574581
}
575582

@@ -584,6 +591,7 @@ Levelize::deleteEdgeBefore(Edge *edge)
584591
// fails because the DFS path will be missing.
585592
levelized_ = false;
586593
levels_valid_ = false;
594+
drvr_vertices_level_valid_ = false;
587595
}
588596
}
589597

@@ -710,6 +718,36 @@ Levelize::checkLevels()
710718
}
711719
}
712720

721+
void
722+
Levelize::levelizeDrvrVertices()
723+
{
724+
levelized_drvr_vertices_.clear();
725+
// Rough estimate: ~half of vertices are drivers
726+
levelized_drvr_vertices_.reserve(graph_->vertexCount() / 2);
727+
VertexIterator vertex_iter(graph_);
728+
while (vertex_iter.hasNext()) {
729+
Vertex *vertex = vertex_iter.next();
730+
if (vertex->isDriver(network_))
731+
levelized_drvr_vertices_.emplace_back(vertex);
732+
}
733+
sort(levelized_drvr_vertices_,
734+
[this](const Vertex *a, const Vertex *b) {
735+
if (a->level() != b->level())
736+
return a->level() < b->level();
737+
return VertexNameLess(network_)(a, b);
738+
});
739+
drvr_vertices_level_valid_ = true;
740+
}
741+
742+
const VertexSeq &
743+
Levelize::levelizedDrvrVertices()
744+
{
745+
ensureLevelized();
746+
if (!drvr_vertices_level_valid_)
747+
levelizeDrvrVertices();
748+
return levelized_drvr_vertices_;
749+
}
750+
713751
////////////////////////////////////////////////////////////////
714752

715753
GraphLoop::GraphLoop(EdgeSeq *edges) :

search/Levelize.hh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public:
7474
void checkLevels();
7575
// Public for regression testing.
7676
void levelize();
77-
77+
const VertexSeq &levelizedDrvrVertices();
78+
7879
protected:
7980
void findRoots();
8081
VertexSeq sortedRootsWithFanout();
@@ -104,6 +105,7 @@ protected:
104105
void clearLoopEdges();
105106
void deleteLoops();
106107
void reportPath(EdgeSeq &path) const;
108+
void levelizeDrvrVertices();
107109

108110
bool levelized_;
109111
bool levels_valid_;
@@ -116,6 +118,8 @@ protected:
116118
EdgeSet disabled_loop_edges_;
117119
EdgeSet latch_d_to_q_edges_;
118120
LevelizeObserver *observer_;
121+
VertexSeq levelized_drvr_vertices_;
122+
bool drvr_vertices_level_valid_;
119123
};
120124

121125
// Loops broken by levelization may not necessarily be combinational.

search/Sta.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,12 @@ Sta::ensureClkArrivals()
29002900
search_->findClkArrivals();
29012901
}
29022902

2903+
const VertexSeq&
2904+
Sta::levelizedDrvrVertices()
2905+
{
2906+
return levelize_->levelizedDrvrVertices();
2907+
}
2908+
29032909
////////////////////////////////////////////////////////////////
29042910

29052911
VertexSet &

0 commit comments

Comments
 (0)