Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/est/include/est/EstimateParasitics.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ class EstimateParasitics : public sta::dbStaState, public ParasiticsService

private:
void ensureParasitics();
bool isIdealClockPin(const sta::Pin* pin) const;
bool isIdealClockNet(const sta::Net* net) const;
void estimateWireParasiticSteiner(const sta::Pin* drvr_pin,
const sta::Net* net,
sta::SpefWriter* spef_writer);
Expand Down
55 changes: 46 additions & 9 deletions src/est/src/EstimateParasitics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ void EstimateParasitics::updateParasitics()
switch (parasitics_src_) {
case ParasiticsSrc::kPlacement:
for (const sta::Net* net : parasitics_invalid_) {
if (isIdealClockNet(net)) {
continue;
}
//
// TODO: remove this check (we expect all to be flat net)
//
Expand All @@ -461,6 +464,9 @@ void EstimateParasitics::updateParasitics()
// TODO: update detailed route for modified nets
incr_groute_->updateRoutes();
for (const sta::Net* net : parasitics_invalid_) {
if (isIdealClockNet(net)) {
continue;
}
debugPrint(logger_,
EST,
"estimate_parasitics",
Expand All @@ -482,6 +488,9 @@ void EstimateParasitics::updateParasitics()
// groute call.
if (parasitics_src_ != ParasiticsSrc::kNone) {
for (const sta::Net* net : parasitics_invalid_) {
if (isIdealClockNet(net)) {
continue;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main performance fix.
It does not retrigger the redundant update of all DFFs connected to an ideal clock net.

}
debugPrint(logger_,
EST,
"estimate_parasitics",
Expand Down Expand Up @@ -732,15 +741,7 @@ void EstimateParasitics::estimateWireParasiticSteiner(
const sta::Net* net,
sta::SpefWriter* spef_writer)
{
bool all_modes_ideal_clock = true;
for (sta::Mode* mode : sta_->modes()) {
if (!sta_->isIdealClock(drvr_pin, mode)) {
all_modes_ideal_clock = false;
break;
}
}

if (!all_modes_ideal_clock) {
if (!isIdealClockPin(drvr_pin)) {
SteinerTree* tree = makeSteinerTree(drvr_pin);
if (tree) {
debugPrint(logger_,
Expand Down Expand Up @@ -1145,6 +1146,42 @@ bool EstimateParasitics::isPad(const sta::Instance* inst) const
return false;
}

bool EstimateParasitics::isIdealClockPin(const sta::Pin* pin) const
{
// An ideal clock pin carries fixed arrivals that do not depend on
// parasitics, so its parasitics never need re-estimation.
bool is_clock = false;
for (sta::Mode* mode : sta_->modes()) {
// In multi-mode designs, a pin may be an ideal clock only in a subset of
// modes. Ignore modes where the pin is not a clock at all.
// e.g., scan clock pin may not be defined as clock in function mode.
if (!sta_->isClock(pin, mode)) {
continue;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eder-matheus isClock() check is newly added to handle the Problem 2 in the PR description.

}
is_clock = true;
if (!sta_->isIdealClock(pin, mode)) {
return false;
}
}
return is_clock;
}

bool EstimateParasitics::isIdealClockNet(const sta::Net* net) const
{
odb::dbNet* db_net = db_network_->staToDb(net);
if (db_net == nullptr) {
return false;
}

PinSet* drivers = network_->drivers(net);
if (drivers == nullptr || drivers->empty()) {
return false;
}

const Pin* drvr_pin = *drivers->begin();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a check somewhere upfront that clock nets cannot be multidriven nets? Maybe just add a comment here about that. Even an assert might work!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I let Codex & Claude search the detector for multiple drivers in clock network, but they couldn't find it.

Typically, clock network does not have multiple drivers except for clock mesh design.
I am not sure if OpenROAD supports the clock mesh design, but it seems unlikely.

If there are multiple clock drivers, this API retrieves only the first driver and check if it is an ideal clock.
This logic works even if multiple drivers are present because the multiple drivers have the identical clock type (there will be no such case that one of the multiple drivers is an ideal clock while another clock driver is not).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has been some discussion of adding clock mesh support but it hasn't gone anywhere so far.

return isIdealClockPin(drvr_pin);
Comment thread
jhkim-pii marked this conversation as resolved.
Resolved
}

void EstimateParasitics::parasiticsInvalid(const sta::Net* net)
{
odb::dbNet* db_net = db_network_->findFlatDbNet(net);
Expand Down
19 changes: 19 additions & 0 deletions src/est/test/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022-2025, The OpenROAD Authors
load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//test:regression.bzl", "regression_test")

package(features = ["layering_check"])
Expand Down Expand Up @@ -37,3 +38,21 @@ filegroup(
name = test_name,
data = [":test_resources"],
) for test_name in TESTS]

cc_test(
name = "TestEstimateParasitics",
srcs = ["cpp/TestEstimateParasitics.cc"],
data = ["cpp/TestEstimateParasitics.v"],
deps = [
"//src/dbSta",
"//src/dbSta:dbNetwork",
"//src/est",
"//src/odb/src/db",
"//src/rsz",
"//src/sta:opensta_lib",
"//src/tst:integrated_fixture",
"//src/utl",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)
27 changes: 27 additions & 0 deletions src/est/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(openroad)

or_integration_tests(
"est"
TESTS
Expand All @@ -9,3 +11,28 @@ or_integration_tests(
make_parasitics6
make_parasitics7
)

add_executable(TestEstimateParasitics cpp/TestEstimateParasitics.cc)
target_link_libraries(TestEstimateParasitics
OpenSTA
GTest::gtest
GTest::gtest_main
GTest::gmock
dbSta_lib
utl_lib
est_lib
rsz_lib
grt_lib
dpl_lib
stt_lib
odb
tst
${TCL_LIBRARY}
)

gtest_discover_tests(TestEstimateParasitics
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)

add_dependencies(build_and_test TestEstimateParasitics
)
Loading
Loading