KiCad PCB EDA Suite
erc.h
Go to the documentation of this file.
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@verizon.net>
6  * Copyright (C) 2009-2015 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 
30 #ifndef _ERC_H
31 #define _ERC_H
32 
33 
34 class NETLIST_OBJECT;
36 class SCH_SHEET_LIST;
37 
38 /* For ERC markers: error types (used in diags, and to set the color):
39 */
41 {
42  OK = 0,
43  WAR, // Error: severity = warning
44  ERR, // Error: severity = error
45  UNC // Error: unconnected pin
46 };
47 
48 extern const wxString CommentERC_H[];
49 extern const wxString CommentERC_V[];
50 
52 enum ERCE_T
53 {
55  ERCE_DUPLICATE_SHEET_NAME, // duplicate sheet names within a given sheet
56  ERCE_PIN_NOT_CONNECTED, // pin not connected and not no connect symbol
57  ERCE_PIN_NOT_DRIVEN, // pin connected to some others pins but no pin to drive it
58  ERCE_PIN_TO_PIN_WARNING, // pin connected to an other pin: warning level
59  ERCE_PIN_TO_PIN_ERROR, // pin connected to an other pin: error level
60  ERCE_HIERACHICAL_LABEL, // mismatch between hierarchical labels and pins sheets
61  ERCE_NOCONNECT_CONNECTED, // a no connect symbol is connected to more than 1 pin
62  ERCE_NOCONNECT_NOT_CONNECTED, // a no connect symbol is not connected to anything
63  ERCE_LABEL_NOT_CONNECTED, // label not connected to anything
64  ERCE_SIMILAR_LABELS, // 2 labels are equal fir case insensitive comparisons
65  ERCE_SIMILAR_GLBL_LABELS, // 2 labels are equal fir case insensitive comparisons
66  ERCE_DIFFERENT_UNIT_FP, // different units of the same component have different footprints assigned
67  ERCE_DIFFERENT_UNIT_NET, // a shared pin in a multi-unit component is connected to more than one net
68  ERCE_BUS_ALIAS_CONFLICT, // conflicting bus alias definitions across sheets
69  ERCE_DRIVER_CONFLICT, // conflicting drivers (labels, etc) on a subgraph
70  ERCE_BUS_ENTRY_CONFLICT, // a wire connected to a bus doesn't match the bus
71  ERCE_BUS_LABEL_ERROR, // a label attached to a bus isn't in bus format
72  ERCE_BUS_TO_BUS_CONFLICT, // a connection between bus objects doesn't share at least one net
73  ERCE_BUS_TO_NET_CONFLICT, // a bus wire is graphically connected to a net port/pin (or vice versa)
74  ERCE_GLOBLABEL, // a global label is unique
75 };
76 
77 /* Minimal connection table */
78 #define NPI 4 // Net with Pin isolated, this pin has type Not Connected and must be left N.C.
79 #define DRV 3 // Net driven by a signal (a pin output for instance)
80 #define NET_NC 2 // Net "connected" to a "NoConnect symbol"
81 #define NOD 1 // Net not driven ( Such as 2 or more connected inputs )
82 #define NOC 0 // initial state of a net: no connection
83 
84 
91 bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName );
92 
98 void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst,
99  int MinConnexion, int Diag );
100 
111  unsigned aNetItemRef, unsigned aNetStart,
112  int* aMinConnexion );
113 
122 int TestDuplicateSheetNames( bool aCreateMarker );
123 
134 int TestConflictingBusAliases( bool aCreateMarker = true );
135 
141 int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList );
142 
143 
144 #endif // _ERC_H
Class SCH_SHEET_LIST.
Definition: erc.h:43
int TestConflictingBusAliases(bool aCreateMarker=true)
Checks that there are not conflicting bus alias definitions in the schematic.
Definition: erc.cpp:225
const wxString CommentERC_H[]
Definition: erc.cpp:84
void TestOthersItems(NETLIST_OBJECT_LIST *aList, unsigned aNetItemRef, unsigned aNetStart, int *aMinConnexion)
Perform ERC testing for electrical conflicts between NetItemRef and other items (mainly pin) on the s...
Definition: erc.cpp:417
ERCE_T
DRC error codes:
Definition: erc.h:52
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
Definition: erc.h:42
Definition: erc.h:44
int TestMultiunitFootprints(SCH_SHEET_LIST &aSheetList)
Test if all units of each multiunit component have the same footprint assigned.
Definition: erc.cpp:271
bool WriteDiagnosticERC(EDA_UNITS_T aUnits, const wxString &aFullFileName)
Function WriteDiagnosticERC save the ERC errors to aFullFileName.
Definition: erc.cpp:569
Definition: erc.h:45
const wxString CommentERC_V[]
Definition: erc.cpp:100
int TestDuplicateSheetNames(bool aCreateMarker)
Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names...
Definition: erc.cpp:174
errortype
Definition: erc.h:40
void Diagnose(NETLIST_OBJECT *NetItemRef, NETLIST_OBJECT *NetItemTst, int MinConnexion, int Diag)
Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef or between aNe...
Definition: erc.cpp:341
EDA_UNITS_T
Definition: common.h:133