ERC: use separate tests for input pins and power input pins.
Input pins can be driven by many pin types: output, passive, 3state, I/O But Power pins can be driven by only power output pins, and cannot use the same criteria in ERC tests.
This commit is contained in:
parent
76ac8b5acf
commit
2e92cc7958
|
@ -100,10 +100,23 @@ const wxString CommentERC_V[] =
|
|||
};
|
||||
|
||||
|
||||
// List of pin types that are considered drivers
|
||||
// List of pin types that are considered drivers for usual input pins
|
||||
// i.e. pin type = ELECTRICAL_PINTYPE::PT_INPUT, but not PT_POWER_IN
|
||||
// that need only a PT_POWER_OUT pin type to be driven
|
||||
const std::set<ELECTRICAL_PINTYPE> DrivingPinTypes =
|
||||
{
|
||||
ELECTRICAL_PINTYPE::PT_OUTPUT,
|
||||
ELECTRICAL_PINTYPE::PT_POWER_OUT,
|
||||
ELECTRICAL_PINTYPE::PT_PASSIVE,
|
||||
ELECTRICAL_PINTYPE::PT_TRISTATE,
|
||||
ELECTRICAL_PINTYPE::PT_BIDI
|
||||
};
|
||||
|
||||
// List of pin types that are considered drivers for power pins
|
||||
// In fact only a ELECTRICAL_PINTYPE::PT_POWER_OUT pin type can drive
|
||||
// power input pins
|
||||
const std::set<ELECTRICAL_PINTYPE> DrivingPowerPinTypes =
|
||||
{
|
||||
ELECTRICAL_PINTYPE::PT_POWER_OUT
|
||||
};
|
||||
|
||||
|
@ -455,6 +468,20 @@ int ERC_TESTER::TestPinToPin()
|
|||
SCH_PIN* needsDriver = nullptr;
|
||||
bool hasDriver = false;
|
||||
|
||||
// We need different drivers for power nets and normal nets.
|
||||
// A power net has at least one pin having the ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||
// and power nets can be driven only by ELECTRICAL_PINTYPE::PT_POWER_OUT pins
|
||||
bool ispowerNet = false;
|
||||
|
||||
for( SCH_PIN* refPin : pins )
|
||||
{
|
||||
if( refPin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN )
|
||||
{
|
||||
ispowerNet = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( SCH_PIN* refPin : pins )
|
||||
{
|
||||
ELECTRICAL_PINTYPE refType = refPin->GetType();
|
||||
|
@ -469,7 +496,10 @@ int ERC_TESTER::TestPinToPin()
|
|||
needsDriver = refPin;
|
||||
}
|
||||
|
||||
hasDriver |= ( DrivingPinTypes.count( refType ) != 0 );
|
||||
if( ispowerNet )
|
||||
hasDriver |= ( DrivingPowerPinTypes.count( refType ) != 0 );
|
||||
else
|
||||
hasDriver |= ( DrivingPinTypes.count( refType ) != 0 );
|
||||
|
||||
for( SCH_PIN* testPin : pins )
|
||||
{
|
||||
|
@ -487,7 +517,10 @@ int ERC_TESTER::TestPinToPin()
|
|||
|
||||
ELECTRICAL_PINTYPE testType = testPin->GetType();
|
||||
|
||||
hasDriver |= ( DrivingPinTypes.count( testType ) != 0 );
|
||||
if( ispowerNet )
|
||||
hasDriver |= ( DrivingPowerPinTypes.count( testType ) != 0 );
|
||||
else
|
||||
hasDriver |= ( DrivingPinTypes.count( testType ) != 0 );
|
||||
|
||||
PIN_ERROR erc = settings.GetPinMapValue( refType, testType );
|
||||
|
||||
|
@ -513,7 +546,9 @@ int ERC_TESTER::TestPinToPin()
|
|||
|
||||
if( needsDriver && !hasDriver )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_PIN_NOT_DRIVEN );
|
||||
int err_code = ispowerNet ? ERCE_POWERPIN_NOT_DRIVEN : ERCE_PIN_NOT_DRIVEN;
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( err_code );
|
||||
|
||||
ercItem->SetItems( needsDriver );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, needsDriver->GetTransformedPosition() );
|
||||
|
|
|
@ -50,6 +50,10 @@ ERC_ITEM ERC_ITEM::pinNotDriven( ERCE_PIN_NOT_DRIVEN,
|
|||
_( "Input pin not driven by any Output pins" ),
|
||||
wxT( "pin_not_driven" ) );
|
||||
|
||||
ERC_ITEM ERC_ITEM::powerpinNotDriven( ERCE_POWERPIN_NOT_DRIVEN,
|
||||
_( "Input Power pin not driven by any Output Power pins" ),
|
||||
wxT( "power_pin_not_driven" ) );
|
||||
|
||||
ERC_ITEM ERC_ITEM::pinTableWarning( ERCE_PIN_TO_PIN_WARNING,
|
||||
_( "Conflict problem between pins" ),
|
||||
wxT( "pin_to_pin" ) );
|
||||
|
@ -130,6 +134,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> ERC_ITEM::allItemTypes( {
|
|||
ERC_ITEM::duplicateSheetName,
|
||||
ERC_ITEM::pinNotConnected,
|
||||
ERC_ITEM::pinNotDriven,
|
||||
ERC_ITEM::powerpinNotDriven,
|
||||
ERC_ITEM::pinTableWarning,
|
||||
ERC_ITEM::hierLabelMismatch,
|
||||
ERC_ITEM::noConnectConnected,
|
||||
|
@ -159,6 +164,7 @@ std::shared_ptr<ERC_ITEM> ERC_ITEM::Create( int aErrorCode )
|
|||
case ERCE_DUPLICATE_SHEET_NAME: return std::make_shared<ERC_ITEM>( duplicateSheetName );
|
||||
case ERCE_PIN_NOT_CONNECTED: return std::make_shared<ERC_ITEM>( pinNotConnected );
|
||||
case ERCE_PIN_NOT_DRIVEN: return std::make_shared<ERC_ITEM>( pinNotDriven );
|
||||
case ERCE_POWERPIN_NOT_DRIVEN: return std::make_shared<ERC_ITEM>( powerpinNotDriven );
|
||||
case ERCE_PIN_TO_PIN_WARNING: return std::make_shared<ERC_ITEM>( pinTableWarning );
|
||||
case ERCE_PIN_TO_PIN_ERROR: return std::make_shared<ERC_ITEM>( pinTableError );
|
||||
case ERCE_HIERACHICAL_LABEL: return std::make_shared<ERC_ITEM>( hierLabelMismatch );
|
||||
|
|
|
@ -55,6 +55,7 @@ private:
|
|||
static ERC_ITEM duplicateSheetName;
|
||||
static ERC_ITEM pinNotConnected;
|
||||
static ERC_ITEM pinNotDriven;
|
||||
static ERC_ITEM powerpinNotDriven;
|
||||
static ERC_ITEM pinTableWarning;
|
||||
static ERC_ITEM pinTableError;
|
||||
static ERC_ITEM hierLabelMismatch;
|
||||
|
|
|
@ -39,6 +39,9 @@ enum ERCE_T
|
|||
ERCE_DUPLICATE_SHEET_NAME = ERCE_FIRST, ///< Duplicate sheet names within a given sheet.
|
||||
ERCE_PIN_NOT_CONNECTED, ///< Pin not connected and not no connect symbol.
|
||||
ERCE_PIN_NOT_DRIVEN, ///< Pin connected to some others pins but no pin to drive it.
|
||||
///< pins to drive it can be output, passive, 3sttae, I/O
|
||||
ERCE_POWERPIN_NOT_DRIVEN, ///< Power input pin connected to some others pins but no
|
||||
///< power out pin to drive it.
|
||||
ERCE_HIERACHICAL_LABEL, ///< Mismatch between hierarchical labels and pins sheets.
|
||||
ERCE_NOCONNECT_CONNECTED, ///< A no connect symbol is connected to more than 1 pin.
|
||||
ERCE_NOCONNECT_NOT_CONNECTED, ///< A no connect symbol is not connected to anything.
|
||||
|
|
Loading…
Reference in New Issue