|
|
|
@ -47,6 +47,7 @@ |
|
|
|
#include <sch_marker.h>
|
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <lib_pin.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
|
|
|
|
#include <dialog_erc.h>
|
|
|
|
#include <erc.h>
|
|
|
|
@ -491,6 +492,12 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter ) |
|
|
|
unsigned nextItemIdx = lastItemIdx = 0; |
|
|
|
int MinConn = NOC; |
|
|
|
|
|
|
|
/* Check that a pin appears in only one net. This check is necessary
|
|
|
|
* because multi-unit components that have shared pins can be wired to |
|
|
|
* different nets. |
|
|
|
*/ |
|
|
|
std::unordered_map<wxString, wxString> pin_to_net_map; |
|
|
|
|
|
|
|
/* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
|
|
|
|
* by net number, which means we can group netlist items into ranges |
|
|
|
* that live in the same net. The range from nextItem to the current |
|
|
|
@ -555,11 +562,38 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter ) |
|
|
|
break; |
|
|
|
|
|
|
|
case NET_PIN: |
|
|
|
{ |
|
|
|
// Check if this pin has appeared before on a different net
|
|
|
|
if( item->m_Link ) |
|
|
|
{ |
|
|
|
auto ref = item->GetComponentParent()->GetRef( &item->m_SheetPath ); |
|
|
|
wxString pin_name = ref + "_" + item->m_PinNum; |
|
|
|
|
|
|
|
if( pin_to_net_map.count( pin_name ) == 0 ) |
|
|
|
{ |
|
|
|
pin_to_net_map[pin_name] = item->GetNetName(); |
|
|
|
} |
|
|
|
else if( pin_to_net_map[pin_name] != item->GetNetName() ) |
|
|
|
{ |
|
|
|
SCH_MARKER* marker = new SCH_MARKER(); |
|
|
|
|
|
|
|
marker->SetTimeStamp( GetNewTimeStamp() ); |
|
|
|
marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start, |
|
|
|
wxString::Format( _( "Pin %s on %s is connected to both %s and %s" ), |
|
|
|
item->m_PinNum, ref, pin_to_net_map[pin_name], item->GetNetName() ), |
|
|
|
item->m_Start ); |
|
|
|
marker->SetMarkerType( MARKER_BASE::MARKER_ERC ); |
|
|
|
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR ); |
|
|
|
|
|
|
|
item->m_SheetPath.LastScreen()->Append( marker ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Look for ERC problems between pins:
|
|
|
|
TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn ); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
lastItemIdx = itemIdx; |
|
|
|
} |
|
|
|
|