Add new ERC rule to check for global labels with only one entry in the schematic

By default this rule is set to ignore to provide continuity for those using
single global labels to name nets (e.g. in simulation)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13212
This commit is contained in:
JamesJ 2024-03-15 20:42:32 +00:00 committed by Jon Evans
parent 3f2e3d89e2
commit 2311eed08a
10 changed files with 1361 additions and 0 deletions

View File

@ -2945,6 +2945,11 @@ int CONNECTION_GRAPH::RunERC()
}
}
if( settings.IsTestEnabled( ERCE_SINGLE_GLOBAL_LABEL ) )
{
error_count += ercCheckSingleGlobalLabel();
}
return error_count;
}
@ -3710,6 +3715,56 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
}
int CONNECTION_GRAPH::ercCheckSingleGlobalLabel()
{
int errors = 0;
std::map<wxString, std::tuple<int, const SCH_ITEM*, SCH_SHEET_PATH>> labelData;
for( const SCH_SHEET_PATH& sheet : m_sheetList )
{
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
{
SCH_TEXT* labelText = static_cast<SCH_TEXT*>( item );
wxString resolvedLabelText =
EscapeString( labelText->GetShownText( &sheet, false ), CTX_NETNAME );
if( labelData.find( resolvedLabelText ) == labelData.end() )
{
labelData[resolvedLabelText] = { 1, item, sheet };
}
else
{
std::get<0>( labelData[resolvedLabelText] ) += 1;
std::get<1>( labelData[resolvedLabelText] ) = nullptr;
std::get<2>( labelData[resolvedLabelText] ) = sheet;
}
}
}
for( const auto& label : labelData )
{
if( std::get<0>( label.second ) == 1 )
{
const SCH_SHEET_PATH& sheet = std::get<2>( label.second );
const SCH_ITEM* item = std::get<1>( label.second );
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_SINGLE_GLOBAL_LABEL );
ercItem->SetItems( std::get<1>( label.second ) );
ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItemsSheetPaths( sheet );
SCH_MARKER* marker = new SCH_MARKER( ercItem, item->GetPosition() );
sheet.LastScreen()->Append( marker );
errors++;
}
}
return errors;
}
int CONNECTION_GRAPH::ercCheckHierSheets()
{
int errors = 0;

View File

@ -685,6 +685,11 @@ private:
*/
int ercCheckHierSheets();
/**
* Check that a global label is instantiated more that once across the schematic heirarchy
*/
int ercCheckSingleGlobalLabel();
/**
* Get the number of pins in a given subgraph.
*

View File

@ -95,6 +95,10 @@ ERC_ITEM ERC_ITEM::similarLabels( ERCE_SIMILAR_LABELS,
_( "Labels are similar (lower/upper case difference only)"),
wxT( "similar_labels" ) );
ERC_ITEM ERC_ITEM::singleGlobalLabel( ERCE_SINGLE_GLOBAL_LABEL,
_( "Global label only appears once in the schematic"),
wxT( "single_global_label" ) );
ERC_ITEM ERC_ITEM::differentUnitFootprint( ERCE_DIFFERENT_UNIT_FP,
_( "Different footprint assigned in another unit of the symbol" ),
wxT( "different_unit_footprint" ) );
@ -200,6 +204,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> ERC_ITEM::allItemTypes( {
ERC_ITEM::noConnectDangling,
ERC_ITEM::labelDangling,
ERC_ITEM::globalLabelDangling,
ERC_ITEM::singleGlobalLabel,
ERC_ITEM::wireDangling,
ERC_ITEM::busEntryNeeded,
ERC_ITEM::endpointOffGrid,
@ -255,6 +260,7 @@ std::shared_ptr<ERC_ITEM> ERC_ITEM::Create( int aErrorCode )
case ERCE_NOCONNECT_NOT_CONNECTED: return std::make_shared<ERC_ITEM>( noConnectDangling );
case ERCE_LABEL_NOT_CONNECTED: return std::make_shared<ERC_ITEM>( labelDangling );
case ERCE_SIMILAR_LABELS: return std::make_shared<ERC_ITEM>( similarLabels );
case ERCE_SINGLE_GLOBAL_LABEL: return std::make_shared<ERC_ITEM>( singleGlobalLabel );
case ERCE_DIFFERENT_UNIT_FP: return std::make_shared<ERC_ITEM>( differentUnitFootprint );
case ERCE_DIFFERENT_UNIT_NET: return std::make_shared<ERC_ITEM>( differentUnitNet );
case ERCE_BUS_ALIAS_CONFLICT: return std::make_shared<ERC_ITEM>( busDefinitionConflict );

View File

@ -195,6 +195,7 @@ private:
static ERC_ITEM noConnectDangling;
static ERC_ITEM labelDangling;
static ERC_ITEM globalLabelDangling;
static ERC_ITEM singleGlobalLabel;
static ERC_ITEM similarLabels;
static ERC_ITEM differentUnitFootprint;
static ERC_ITEM differentUnitNet;

View File

@ -97,6 +97,7 @@ ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
m_ERCSeverities[ERCE_ENDPOINT_OFF_GRID] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_PIN_TO_PIN_WARNING] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_SIMILAR_LABELS] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_SINGLE_GLOBAL_LABEL] = RPT_SEVERITY_IGNORE;
m_ERCSeverities[ERCE_GLOBLABEL] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_DRIVER_CONFLICT] = RPT_SEVERITY_WARNING;
m_ERCSeverities[ERCE_BUS_ENTRY_CONFLICT] = RPT_SEVERITY_WARNING;

View File

@ -49,6 +49,7 @@ enum ERCE_T
ERCE_NOCONNECT_NOT_CONNECTED, ///< A no connect symbol is not connected to anything.
ERCE_LABEL_NOT_CONNECTED, ///< Label not connected to anything.
ERCE_SIMILAR_LABELS, ///< 2 labels are equal for case insensitive comparisons.
ERCE_SINGLE_GLOBAL_LABEL, ///< A global label only exists once in the schematic.
ERCE_DIFFERENT_UNIT_FP, ///< Different units of the same symbol have different
///< footprints assigned.
ERCE_MISSING_POWER_INPUT_PIN, ///< Symbol has power input pins that are not placed on the
@ -81,6 +82,7 @@ enum ERCE_T
ERCE_DUPLICATE_REFERENCE, ///< More than one symbol with the same reference.
ERCE_BUS_ENTRY_NEEDED, ///< Importer failed to auto-place a bus entry.
ERCE_LAST = ERCE_BUS_ENTRY_NEEDED,
// Errors after this point will not automatically appear in the Severities Panel

View File

@ -0,0 +1,669 @@
(kicad_sch
(version 20240101)
(generator "eeschema")
(generator_version "8.99")
(uuid "d5d94a04-f459-45ad-8d13-fc9e59249d4d")
(paper "A4")
(lib_symbols
(symbol "Device:R"
(pin_numbers hide)
(pin_names
(offset 0)
)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "R"
(at 2.032 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 0 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at -1.778 0 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_keywords" "R res resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_fp_filters" "R_*"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "R_0_1"
(rectangle
(start -1.016 -2.54)
(end 1.016 2.54)
(stroke
(width 0.254)
(type default)
)
(fill
(type none)
)
)
)
(symbol "R_1_1"
(pin passive line
(at 0 3.81 270)
(length 1.27)
(name "~"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin passive line
(at 0 -3.81 90)
(length 1.27)
(name "~"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
)
)
(junction
(at 77.47 72.39)
(diameter 0)
(color 0 0 0 0)
(uuid "e2b99536-4811-4d62-82c0-8a7a93ea6738")
)
(no_connect
(at 87.63 82.55)
(uuid "2b2e47e8-f552-4f46-a45c-743aec851b2c")
)
(no_connect
(at 87.63 72.39)
(uuid "49331f78-cff2-46ce-8c6d-76396494349d")
)
(no_connect
(at 87.63 57.15)
(uuid "7c4eb019-fb04-4a6d-9ab9-234857b7ef64")
)
(no_connect
(at 87.63 43.18)
(uuid "9614add8-1c46-44e1-b319-ede7b792b345")
)
(wire
(pts
(xy 77.47 72.39) (xy 80.01 72.39)
)
(stroke
(width 0)
(type default)
)
(uuid "12c42adf-eb77-4bed-88d1-1df43bcff9fc")
)
(wire
(pts
(xy 76.2 43.18) (xy 80.01 43.18)
)
(stroke
(width 0)
(type default)
)
(uuid "2fce3eb3-953b-48bf-b98b-9727113397e5")
)
(wire
(pts
(xy 76.2 72.39) (xy 77.47 72.39)
)
(stroke
(width 0)
(type default)
)
(uuid "8d68b38a-d8a2-474f-82c9-3cd18f3e35b1")
)
(wire
(pts
(xy 80.01 82.55) (xy 77.47 82.55)
)
(stroke
(width 0)
(type default)
)
(uuid "a5db9820-29ca-49b3-bbf9-a81780dcd165")
)
(wire
(pts
(xy 76.2 57.15) (xy 80.01 57.15)
)
(stroke
(width 0)
(type default)
)
(uuid "c93ff82e-afc4-45d0-a32a-5e479608d5a9")
)
(wire
(pts
(xy 77.47 82.55) (xy 77.47 72.39)
)
(stroke
(width 0)
(type default)
)
(uuid "d3fc98dc-6bf2-43d6-84a6-f8285193b639")
)
(global_label "LABEL_1"
(shape input)
(at 76.2 43.18 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "2c446a26-ac00-4525-a5cc-053b49d53b4d")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 65.4739 43.18 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(global_label "LABEL_5"
(shape input)
(at 76.2 72.39 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "aa832918-5c37-42d6-bff5-56bb358c68b6")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 65.4739 72.39 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(global_label "LABEL_2"
(shape input)
(at 76.2 57.15 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "ac7164af-47c0-4fd2-8b34-6a0b0155e7d1")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 65.4739 57.15 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(symbol
(lib_id "Device:R")
(at 83.82 72.39 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "31286d50-9c13-4ff3-960e-5695b3c22640")
(property "Reference" "R3"
(at 83.82 66.04 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 83.82 68.58 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 83.82 74.168 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 83.82 72.39 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 83.82 72.39 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "359afc62-ff3a-4bd8-a7ff-92b22b898800")
)
(pin "1"
(uuid "321fb651-6076-4f83-9fa2-7c790c5ab44e")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(reference "R3")
(unit 1)
)
)
)
)
(symbol
(lib_id "Device:R")
(at 83.82 43.18 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "6787ba05-e7e8-4b39-acc5-a64a25430806")
(property "Reference" "R1"
(at 83.82 36.83 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 83.82 39.37 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 83.82 44.958 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 83.82 43.18 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 83.82 43.18 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "256c73c1-3cce-4fd7-abb4-14b180086dcb")
)
(pin "1"
(uuid "143a7499-6308-40e6-b43d-20ea0fbc999b")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(reference "R1")
(unit 1)
)
)
)
)
(symbol
(lib_id "Device:R")
(at 83.82 82.55 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "6c796822-a3cb-41ad-9ad7-db0f8438bdaa")
(property "Reference" "R4"
(at 83.82 76.2 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 83.82 78.74 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 83.82 84.328 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 83.82 82.55 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 83.82 82.55 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "84c74ee8-3510-4855-a4cb-47ab1555d9ed")
)
(pin "1"
(uuid "48abd134-e642-441a-9309-e6597fa44162")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(reference "R4")
(unit 1)
)
)
)
)
(symbol
(lib_id "Device:R")
(at 83.82 57.15 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "95b942c3-1c78-4270-adb7-fa372e9216bb")
(property "Reference" "R2"
(at 83.82 50.8 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 83.82 53.34 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 83.82 58.928 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 83.82 57.15 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 83.82 57.15 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "3d232f07-dcec-4ca8-a192-1b1c7b1b3697")
)
(pin "1"
(uuid "7e0f9a49-664d-4102-8252-160e238690e5")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(reference "R2")
(unit 1)
)
)
)
)
(sheet
(at 121.92 29.21)
(size 68.58 34.29)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "108aca09-78d6-4a5a-9683-bd8f0b8a9ba0")
(property "Sheetname" "issue13212_subsheet_1"
(at 121.92 28.4984 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "issue13212_subsheet_1.kicad_sch"
(at 121.92 64.0846 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(page "2")
)
)
)
)
(sheet
(at 121.92 73.66)
(size 68.58 25.4)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "d99ef0eb-dd5f-4c0c-a284-26c02dab55ae")
(property "Sheetname" "issue13212_subsheet_2_1"
(at 121.92 72.9484 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "issue13212_subsheet_2.kicad_sch"
(at 121.92 99.6446 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(page "3")
)
)
)
)
(sheet
(at 196.85 73.66)
(size 68.58 25.4)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "f7d9c491-ba72-418d-a50a-74bc5a374f6f")
(property "Sheetname" "issue13212_subsheet_2_2"
(at 196.85 72.9484 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "issue13212_subsheet_2.kicad_sch"
(at 196.85 99.6446 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d"
(page "4")
)
)
)
)
(sheet_instances
(path "/"
(page "1")
)
)
)

View File

@ -0,0 +1,338 @@
(kicad_sch
(version 20240101)
(generator "eeschema")
(generator_version "8.99")
(uuid "825f5574-7c34-4268-8e99-adc0a8680e45")
(paper "A4")
(lib_symbols
(symbol "Device:R"
(pin_numbers hide)
(pin_names
(offset 0)
)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "R"
(at 2.032 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 0 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at -1.778 0 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_keywords" "R res resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_fp_filters" "R_*"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "R_0_1"
(rectangle
(start -1.016 -2.54)
(end 1.016 2.54)
(stroke
(width 0.254)
(type default)
)
(fill
(type none)
)
)
)
(symbol "R_1_1"
(pin passive line
(at 0 3.81 270)
(length 1.27)
(name "~"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin passive line
(at 0 -3.81 90)
(length 1.27)
(name "~"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
)
)
(no_connect
(at 81.28 59.69)
(uuid "2838d6f7-be0c-404c-a5d0-af44ce5e6a09")
)
(no_connect
(at 81.28 45.72)
(uuid "e28018da-e333-4ef8-9aca-4a242bbb93c2")
)
(wire
(pts
(xy 69.85 45.72) (xy 73.66 45.72)
)
(stroke
(width 0)
(type default)
)
(uuid "688354ab-af19-4bed-a7b8-2c6666ae9f01")
)
(wire
(pts
(xy 69.85 59.69) (xy 73.66 59.69)
)
(stroke
(width 0)
(type default)
)
(uuid "b9d28cdb-c221-41dc-9c34-8af8ae420577")
)
(global_label "LABEL_2"
(shape input)
(at 69.85 45.72 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "69e0368b-ae04-4005-9be3-6e3dcdc0ed1a")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 59.1239 45.72 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(global_label "LABEL_3"
(shape input)
(at 69.85 59.69 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "9c9bf0cb-08c2-49cd-96e5-b25e4c3415bd")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 59.1239 59.69 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(symbol
(lib_id "Device:R")
(at 77.47 45.72 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "996c6c0a-9067-4e34-a45e-674e192ac25b")
(property "Reference" "R5"
(at 77.47 39.37 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 77.47 41.91 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 77.47 47.498 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 77.47 45.72 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 77.47 45.72 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "c2dc0c6c-9994-4892-9af3-534a09c125f4")
)
(pin "1"
(uuid "d7ac789c-f4ed-46d3-895c-f404fcf4bdc9")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d/108aca09-78d6-4a5a-9683-bd8f0b8a9ba0"
(reference "R5")
(unit 1)
)
)
)
)
(symbol
(lib_id "Device:R")
(at 77.47 59.69 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "be83a0d9-b4ac-4c41-a061-ce8015064f81")
(property "Reference" "R6"
(at 77.47 53.34 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 77.47 55.88 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 77.47 61.468 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 77.47 59.69 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 77.47 59.69 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "775b8187-82d7-4938-b744-4b868b7323e7")
)
(pin "1"
(uuid "8aea6fd7-c9d7-497a-a848-ce097bd9aff0")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d/108aca09-78d6-4a5a-9683-bd8f0b8a9ba0"
(reference "R6")
(unit 1)
)
)
)
)
)

View File

@ -0,0 +1,238 @@
(kicad_sch
(version 20240101)
(generator "eeschema")
(generator_version "8.99")
(uuid "3cd2ce96-6581-4e9d-bf1a-c5c033579540")
(paper "A4")
(lib_symbols
(symbol "Device:R"
(pin_numbers hide)
(pin_names
(offset 0)
)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(property "Reference" "R"
(at 2.032 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 0 0 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at -1.778 0 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_keywords" "R res resistor"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_fp_filters" "R_*"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(symbol "R_0_1"
(rectangle
(start -1.016 -2.54)
(end 1.016 2.54)
(stroke
(width 0.254)
(type default)
)
(fill
(type none)
)
)
)
(symbol "R_1_1"
(pin passive line
(at 0 3.81 270)
(length 1.27)
(name "~"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "1"
(effects
(font
(size 1.27 1.27)
)
)
)
)
(pin passive line
(at 0 -3.81 90)
(length 1.27)
(name "~"
(effects
(font
(size 1.27 1.27)
)
)
)
(number "2"
(effects
(font
(size 1.27 1.27)
)
)
)
)
)
)
)
(no_connect
(at 91.44 54.61)
(uuid "38ab9cd9-da98-4453-84ae-b6aa2af8d788")
)
(wire
(pts
(xy 80.01 54.61) (xy 83.82 54.61)
)
(stroke
(width 0)
(type default)
)
(uuid "84015706-010f-411d-9b0d-a1086bda2e91")
)
(global_label "LABEL_4"
(shape input)
(at 80.01 54.61 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "54332250-d02a-44c7-8e38-026f5fdc904f")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 69.2839 54.61 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(symbol
(lib_id "Device:R")
(at 87.63 54.61 90)
(unit 1)
(exclude_from_sim no)
(in_bom yes)
(on_board yes)
(dnp no)
(fields_autoplaced yes)
(uuid "cb595375-d317-4f9d-adbd-5de81c25dee5")
(property "Reference" "R7"
(at 87.63 48.26 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Value" "R"
(at 87.63 50.8 90)
(effects
(font
(size 1.27 1.27)
)
)
)
(property "Footprint" ""
(at 87.63 56.388 90)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Datasheet" "~"
(at 87.63 54.61 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "Description" "Resistor"
(at 87.63 54.61 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(pin "2"
(uuid "1ee73fa8-19b9-4420-8600-1d00a2531d16")
)
(pin "1"
(uuid "6f2a456b-ca60-425e-b1ba-a36035c466f7")
)
(instances
(project "issue13212"
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d/d99ef0eb-dd5f-4c0c-a284-26c02dab55ae"
(reference "R7")
(unit 1)
)
(path "/d5d94a04-f459-45ad-8d13-fc9e59249d4d/f7d9c491-ba72-418d-a50a-74bc5a374f6f"
(reference "R8")
(unit 1)
)
)
)
)
)

View File

@ -83,3 +83,49 @@ BOOST_FIXTURE_TEST_CASE( ERCGlobalLabels, ERC_REGRESSION_TEST_FIXTURE )
}
}
BOOST_FIXTURE_TEST_CASE( ERCSingleGlobalLabels, ERC_REGRESSION_TEST_FIXTURE )
{
LOCALE_IO dummy;
// Check for Errors when using global labels
std::vector<std::pair<wxString, int>> tests = { { "issue13212", 3 } };
for( const std::pair<wxString, int>& test : tests )
{
KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic );
ERC_SETTINGS& settings = m_schematic->ErcSettings();
SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() );
// Skip the "Modified symbol" warning
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_ISSUES] = RPT_SEVERITY_IGNORE;
settings.m_ERCSeverities[ERCE_LIB_SYMBOL_MISMATCH] = RPT_SEVERITY_IGNORE;
// Configure the rules under test
settings.m_ERCSeverities[ERCE_GLOBLABEL] = RPT_SEVERITY_IGNORE;
settings.m_ERCSeverities[ERCE_SINGLE_GLOBAL_LABEL] = RPT_SEVERITY_ERROR;
m_schematic->ConnectionGraph()->Recalculate( m_schematic->GetSheets(), true );
m_schematic->ConnectionGraph()->RunERC();
ERC_TESTER tester( m_schematic.get() );
tester.TestConflictingBusAliases();
tester.TestMultUnitPinConflicts();
tester.TestMultiunitFootprints();
tester.TestNoConnectPins();
tester.TestPinToPin();
tester.TestSimilarLabels();
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second,
"Expected " << test.second << " errors in " << test.first.ToStdString()
<< " but got " << errors.GetCount() << "\n"
<< reportWriter.GetTextReport() );
}
}