2009-07-07 17:50:02 +00:00
|
|
|
/*
|
2011-09-30 14:15:37 -04:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2009-07-07 17:50:02 +00:00
|
|
|
*
|
2015-08-31 13:09:47 +02:00
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2020-10-07 09:15:31 -04:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2009-07-07 17:50:02 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2024-02-02 23:04:56 +00:00
|
|
|
#ifndef ERC_H
|
|
|
|
#define ERC_H
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2024-05-03 11:11:16 -07:00
|
|
|
#include <erc/erc_settings.h>
|
2024-06-06 11:20:04 +01:00
|
|
|
#include <sch_sheet_path.h>
|
|
|
|
#include <sch_screen.h>
|
|
|
|
#include <sch_reference_list.h>
|
|
|
|
#include <connection_graph.h>
|
2024-04-25 14:24:46 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2020-07-03 17:08:17 -04:00
|
|
|
|
2010-11-11 16:10:27 -05:00
|
|
|
|
2020-05-12 22:00:37 -04:00
|
|
|
class SCHEMATIC;
|
2021-02-22 23:47:17 +00:00
|
|
|
class DS_PROXY_VIEW_ITEM;
|
2023-08-13 19:44:10 -04:00
|
|
|
class SCH_EDIT_FRAME;
|
2023-08-13 20:31:19 -04:00
|
|
|
class PROGRESS_REPORTER;
|
2024-02-02 23:04:56 +00:00
|
|
|
struct KIFACE;
|
|
|
|
class PROJECT;
|
2024-04-25 14:24:46 +00:00
|
|
|
class SCH_RULE_AREA;
|
2020-05-28 14:36:54 +01:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2014-01-18 03:07:05 -06:00
|
|
|
extern const wxString CommentERC_H[];
|
|
|
|
extern const wxString CommentERC_V[];
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2020-07-03 17:08:17 -04:00
|
|
|
|
|
|
|
class ERC_TESTER
|
2019-03-11 17:32:05 -04:00
|
|
|
{
|
2020-07-03 17:08:17 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
ERC_TESTER( SCHEMATIC* aSchematic ) :
|
2024-06-06 11:20:04 +01:00
|
|
|
m_schematic( aSchematic ),
|
|
|
|
m_settings( aSchematic->ErcSettings() ),
|
2024-06-06 17:58:48 +01:00
|
|
|
m_sheetList( aSchematic->BuildSheetListSortedByPageNumbers() ),
|
2024-06-06 11:20:04 +01:00
|
|
|
m_screens( aSchematic->Root() ),
|
|
|
|
m_nets( aSchematic->ConnectionGraph()->GetNetMap() )
|
2020-07-03 17:08:17 -04:00
|
|
|
{
|
2024-06-06 11:20:04 +01:00
|
|
|
m_sheetList.GetMultiUnitSymbols( m_refMap, true );
|
2020-07-03 17:08:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-10-07 09:15:31 -04:00
|
|
|
* Inside a given sheet, one cannot have sheets with duplicate names (file
|
2020-07-03 17:08:17 -04:00
|
|
|
* names can be duplicated).
|
2020-10-07 09:15:31 -04:00
|
|
|
*
|
2020-07-03 17:08:17 -04:00
|
|
|
* @return the error count
|
|
|
|
* @param aCreateMarker: true = create error markers in schematic,
|
|
|
|
* false = calculate error count only
|
|
|
|
*/
|
|
|
|
int TestDuplicateSheetNames( bool aCreateMarker );
|
|
|
|
|
|
|
|
/**
|
2020-10-07 09:15:31 -04:00
|
|
|
* Check for any unresolved text variable references.
|
2020-07-03 17:08:17 -04:00
|
|
|
*/
|
2021-02-22 23:47:17 +00:00
|
|
|
void TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet );
|
2020-07-03 17:08:17 -04:00
|
|
|
|
|
|
|
/**
|
2020-10-07 09:15:31 -04:00
|
|
|
* Check that there are no conflicting bus alias definitions in the schematic.
|
2020-07-03 17:08:17 -04:00
|
|
|
*
|
|
|
|
* (for example, two hierarchical sub-sheets contain different definitions for
|
|
|
|
* the same bus alias)
|
|
|
|
*
|
|
|
|
* @return the error count
|
|
|
|
*/
|
|
|
|
int TestConflictingBusAliases();
|
|
|
|
|
|
|
|
/**
|
2021-05-05 22:41:51 +01:00
|
|
|
* Test if all units of each multiunit symbol have the same footprint assigned.
|
2020-07-03 17:08:17 -04:00
|
|
|
* @return The error count.
|
|
|
|
*/
|
|
|
|
int TestMultiunitFootprints();
|
|
|
|
|
2020-07-06 20:10:08 -04:00
|
|
|
/**
|
|
|
|
* In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
|
|
|
|
* In KiCad 6, this no longer results in those pins joining the net, so we need to warn about it
|
|
|
|
* @return the error count
|
|
|
|
*/
|
|
|
|
int TestNoConnectPins();
|
|
|
|
|
2020-08-30 15:25:31 -04:00
|
|
|
/**
|
|
|
|
* Checks the full netlist against the pin-to-pin connectivity requirements
|
|
|
|
* @return the error count
|
|
|
|
*/
|
|
|
|
int TestPinToPin();
|
|
|
|
|
|
|
|
/**
|
2021-05-05 22:41:51 +01:00
|
|
|
* Checks if shared pins on multi-unit symbols have been connected to different nets
|
2020-08-30 15:25:31 -04:00
|
|
|
* @return the error count
|
|
|
|
*/
|
|
|
|
int TestMultUnitPinConflicts();
|
|
|
|
|
2025-08-07 13:02:55 -07:00
|
|
|
/**
|
|
|
|
* Checks for ground-labeled pins not on a ground net while another pin is.
|
|
|
|
* @return warning count
|
|
|
|
*/
|
|
|
|
int TestGroundPins();
|
|
|
|
|
2024-07-21 23:25:35 +01:00
|
|
|
/**
|
|
|
|
* Checks for global and local labels with the same name
|
|
|
|
* @return the error count
|
|
|
|
*/
|
|
|
|
int TestSameLocalGlobalLabel();
|
|
|
|
|
2020-08-30 15:42:46 -04:00
|
|
|
/**
|
|
|
|
* Checks for labels that differ only in capitalization
|
|
|
|
* @return the error count
|
|
|
|
*/
|
|
|
|
int TestSimilarLabels();
|
|
|
|
|
2024-05-03 12:04:41 -07:00
|
|
|
/**
|
|
|
|
* Test to see if there are potentially confusing 4-way junctions in the schematic.
|
|
|
|
*/
|
|
|
|
int TestFourWayJunction();
|
|
|
|
|
2024-07-09 10:05:30 -07:00
|
|
|
/**
|
|
|
|
* Test to see if there are labels that are connected to more than one wire.
|
|
|
|
*/
|
|
|
|
int TestLabelMultipleWires();
|
|
|
|
|
2020-10-07 09:15:31 -04:00
|
|
|
/**
|
|
|
|
* Test symbols for changed library symbols and broken symbol library links.
|
|
|
|
* @return the number of issues found
|
|
|
|
*/
|
|
|
|
int TestLibSymbolIssues();
|
|
|
|
|
2024-02-01 17:29:16 +00:00
|
|
|
/**
|
|
|
|
* Test footprint links against the current footprint libraries.
|
|
|
|
* @return the number of issues found
|
|
|
|
*/
|
|
|
|
int TestFootprintLinkIssues( KIFACE* aCvPcb, PROJECT* aProject );
|
|
|
|
|
2024-08-16 15:33:26 -06:00
|
|
|
/**
|
|
|
|
* Test symbols to ensure that assigned footprint passes any given footprint filters.
|
|
|
|
* @return the number of issues found
|
|
|
|
*/
|
|
|
|
int TestFootprintFilters();
|
|
|
|
|
2022-03-17 20:23:14 +00:00
|
|
|
/**
|
|
|
|
* Test pins and wire ends for being off grid.
|
|
|
|
* @return the error count
|
|
|
|
*/
|
2023-10-14 20:46:39 +01:00
|
|
|
int TestOffGridEndpoints();
|
2022-03-17 20:23:14 +00:00
|
|
|
|
2022-11-07 12:27:58 +00:00
|
|
|
/**
|
|
|
|
* Test SPICE models for various issues.
|
|
|
|
*/
|
|
|
|
int TestSimModelIssues();
|
|
|
|
|
2022-11-25 20:40:01 -08:00
|
|
|
/**
|
|
|
|
* Test for uninstantiated units of multi unit symbols
|
|
|
|
*/
|
|
|
|
int TestMissingUnits();
|
2023-08-13 19:44:10 -04:00
|
|
|
|
2023-11-04 13:58:24 +00:00
|
|
|
/**
|
|
|
|
* Tests for netclasses that are referenced but not defined.
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
int TestMissingNetclasses();
|
|
|
|
|
2024-04-25 14:24:46 +00:00
|
|
|
/**
|
|
|
|
* Tests for rule area ERC issues
|
|
|
|
*/
|
|
|
|
int RunRuleAreaERC();
|
|
|
|
|
2023-08-13 20:31:19 -04:00
|
|
|
void RunTests( DS_PROXY_VIEW_ITEM* aDrawingSheet, SCH_EDIT_FRAME* aEditFrame,
|
2024-02-02 23:04:56 +00:00
|
|
|
KIFACE* aCvPcb, PROJECT* aProject, PROGRESS_REPORTER* aProgressReporter );
|
2023-08-13 19:44:10 -04:00
|
|
|
|
2020-07-03 17:08:17 -04:00
|
|
|
private:
|
2024-06-06 11:20:04 +01:00
|
|
|
SCHEMATIC* m_schematic;
|
|
|
|
ERC_SETTINGS& m_settings;
|
|
|
|
SCH_SHEET_LIST m_sheetList;
|
|
|
|
SCH_SCREENS m_screens;
|
|
|
|
SCH_MULTI_UNIT_REFERENCE_MAP m_refMap;
|
|
|
|
const NET_MAP& m_nets;
|
2019-03-11 17:32:05 -04:00
|
|
|
};
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
|
2024-02-02 23:04:56 +00:00
|
|
|
#endif // ERC_H
|