Skip to content

Commit

Permalink
Merge pull request #6413 from andyfox-rushc/hier_connect_with_test
Browse files Browse the repository at this point in the history
Hier connect with test
  • Loading branch information
maliberty authored Dec 31, 2024
2 parents 74871cc + 3670481 commit eba58a2
Show file tree
Hide file tree
Showing 5 changed files with 1,084 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2917,7 +2917,9 @@ void dbNetwork::getParentHierarchy(dbModule* start_module,
if (cur_module == top_module) {
return;
}
cur_module = start_module->getModInst()->getParent();
cur_module = cur_module->getModInst()
? cur_module->getModInst()->getParent()
: nullptr;
}
}

Expand Down Expand Up @@ -3035,14 +3037,36 @@ void dbNetwork::hierarchicalConnect(dbITerm* source_pin,
// in hierarchy, which is ok, and the source/dest modnet will be null
dbModNet* source_db_mod_net = source_pin->getModNet();
dbModNet* dest_db_mod_net = dest_pin->getModNet();

//
// make sure there is a direct flat net connection
// Recall the hierarchical connections are overlayed
// onto the flat db network, so we have both worlds
// co-existing, something we respect even when making
// new hierarchical connections.

dbNet* source_db_net = source_pin->getNet();

if (!source_db_net) {
std::string connection_name_str(connection_name);
std::string flat_name = connection_name_str + "_flat";
source_db_net = dbNet::create(block(), flat_name.c_str(), false);
source_pin->connect(source_db_net);
dest_pin->connect(source_db_net);
}

// Make the hierarchical connection.
// case 1: source/dest in same module
if (source_db_module == dest_db_module) {
if (!source_db_mod_net) {
source_db_mod_net = dbModNet::create(source_db_module, connection_name);
source_pin->connect(source_db_mod_net);
}
dest_pin->connect(source_db_mod_net);
} else {
}

else {
//
// Attempt to factor connection (minimize punch through)
//
dbModBTerm* dest_modbterm = nullptr;
Expand Down
8 changes: 8 additions & 0 deletions src/dbSta/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ or_integration_tests(
write_verilog7
write_verilog8
)


foreach(TEST_NAME IN LISTS TEST_NAMES)
or_integration_test("dbSta" ${TEST_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/regression)
endforeach()

add_subdirectory(cpp)

25 changes: 25 additions & 0 deletions src/dbSta/test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include(openroad)

add_executable(TestHconn TestHconn.cpp)
target_link_libraries(TestHconn
OpenSTA
GTest::gtest
GTest::gtest_main
GTest::gmock
dbSta_lib
utl_lib
${TCL_LIBRARY}
)

target_include_directories(TestHconn
PRIVATE
${PROJECT_SOURCE_DIR}/src/dbSta/src
)

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

add_dependencies(build_and_test TestHconn
)

Loading

0 comments on commit eba58a2

Please sign in to comment.