Back-propagate from child sheets when two parents point to one child

This commit is contained in:
Jon Evans 2019-05-05 10:25:38 -04:00
parent b7e67073ef
commit 019a731e03
1 changed files with 16 additions and 1 deletions

View File

@ -1386,6 +1386,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
{
SCH_CONNECTION* conn = aSubgraph->m_driver_connection;
std::vector<CONNECTION_SUBGRAPH*> children;
std::vector<CONNECTION_SUBGRAPH*> visited;
auto add_children = [&] ( CONNECTION_SUBGRAPH* aParent ) {
for( SCH_SHEET_PIN* pin : aParent->m_hier_pins )
@ -1513,6 +1514,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
if( !aSubgraph->m_hier_ports.empty() )
return;
visited.push_back( aSubgraph );
// If we are a bus, we must propagate to local neighbors and then the hierarchy
if( conn->IsBus() )
propagate_bus_neighbors( aSubgraph );
@ -1528,11 +1531,23 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
if( !child->m_dirty )
{
wxLogTrace( "CONN", "Child %lu (%s) is not dirty",
wxLogTrace( "CONN", "Child %lu (%s) is not dirty, backpropagating it",
child->m_code, child->m_driver_connection->Name() );
for( CONNECTION_SUBGRAPH* subgraph : visited )
{
subgraph->m_driver_connection->Clone( *child->m_driver_connection );
subgraph->UpdateItemConnections();
if( conn->IsBus() )
propagate_bus_neighbors( subgraph );
}
continue;
}
visited.push_back( child );
// Check for grandchildren
if( !child->m_hier_pins.empty() )
add_children( child );