You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
4.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 2009-2020 KiCad Developers, see change_log.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file erc.h
  27. */
  28. #ifndef _ERC_H
  29. #define _ERC_H
  30. #include <erc_settings.h>
  31. class NETLIST_OBJECT;
  32. class NETLIST_OBJECT_LIST;
  33. class SCH_SHEET_LIST;
  34. class SCHEMATIC;
  35. namespace KIGFX
  36. {
  37. class WS_PROXY_VIEW_ITEM;
  38. }
  39. extern const wxString CommentERC_H[];
  40. extern const wxString CommentERC_V[];
  41. class ERC_TESTER
  42. {
  43. public:
  44. ERC_TESTER( SCHEMATIC* aSchematic ) :
  45. m_schematic( aSchematic )
  46. {
  47. }
  48. /**
  49. * Perform ERC testing for electrical conflicts between \a NetItemRef and other items
  50. * (mainly pin) on the same net.
  51. *
  52. * @param aList = a reference to the list of connected objects
  53. * @param aNetItemRef = index in list of the current object
  54. * @param aNetStart = index in list of net objects of the first item
  55. * @param aMinConnexion = a pointer to a variable to store the minimal connection
  56. * found( NOD, DRV, NPI, NET_NC)
  57. */
  58. void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned aNetStart,
  59. int* aMinConnexion );
  60. /**
  61. * Inside a given sheet, one cannot have sheets with duplicate names (file
  62. * names can be duplicated).
  63. *
  64. * @return the error count
  65. * @param aCreateMarker: true = create error markers in schematic,
  66. * false = calculate error count only
  67. */
  68. int TestDuplicateSheetNames( bool aCreateMarker );
  69. /**
  70. * Check for any unresolved text variable references.
  71. */
  72. void TestTextVars( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet );
  73. /**
  74. * Check that there are no conflicting bus alias definitions in the schematic.
  75. *
  76. * (for example, two hierarchical sub-sheets contain different definitions for
  77. * the same bus alias)
  78. *
  79. * @return the error count
  80. */
  81. int TestConflictingBusAliases();
  82. /**
  83. * Test if all units of each multiunit component have the same footprint assigned.
  84. * @return The error count.
  85. */
  86. int TestMultiunitFootprints();
  87. /**
  88. * In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
  89. * In KiCad 6, this no longer results in those pins joining the net, so we need to warn about it
  90. * @return the error count
  91. */
  92. int TestNoConnectPins();
  93. /**
  94. * Checks the full netlist against the pin-to-pin connectivity requirements
  95. * @return the error count
  96. */
  97. int TestPinToPin();
  98. /**
  99. * Checks if shared pins on multi-unit components have been connected to different nets
  100. * @return the error count
  101. */
  102. int TestMultUnitPinConflicts();
  103. /**
  104. * Checks for labels that differ only in capitalization
  105. * @return the error count
  106. */
  107. int TestSimilarLabels();
  108. /**
  109. * Test symbols for changed library symbols and broken symbol library links.
  110. * @return the number of issues found
  111. */
  112. int TestLibSymbolIssues();
  113. private:
  114. SCHEMATIC* m_schematic;
  115. };
  116. #endif // _ERC_H