Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hier connect with test #6413

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
38 changes: 35 additions & 3 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,44 @@ 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();
// case 1: source/dest in same module

//
// 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();
dbNet* dest_db_net = dest_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);
}

if (dest_db_net && (dest_db_net != source_db_net)) {
// if we have dest_mod_net, keep it
dbModNet* dest_mod_net = dest_pin->getModNet();
dest_pin->disconnect();
dest_pin->connect(source_db_net);
if (dest_mod_net) {
dest_pin->connect(dest_mod_net);
}
}

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
69 changes: 69 additions & 0 deletions src/dbSta/src/tmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////
// BSD 3-Clause License
//
// Copyright (c) 2021, The Regents of the University of California
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#pragma once

#include "AbstractPowerDensityDataSource.h"
#include "gui/heatMap.h"

namespace sta {
class dbSta;
class Corner;

class PowerDensityDataSource : public gui::RealValueHeatMapDataSource,
public AbstractPowerDensityDataSource
{
public:
PowerDensityDataSource(dbSta* sta, utl::Logger* logger);

protected:
bool populateMap() override;
void combineMapData(bool base_has_value,
double& base,
double new_data,
double data_area,
double intersection_area,
double rect_area) override;

private:
sta::dbSta* sta_;

bool include_internal_ = true;
bool include_leakage_ = true;
bool include_switching_ = true;

std::string corner_;

sta::Corner* getCorner() const;
};

} // namespace sta
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
Loading