2009-07-07 17:50:02 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00: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 11:09:47 +00:00
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2011-10-07 14:41:30 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2020-03-16 11:05:01 +00:00
|
|
|
* Copyright (C) 2009-2020 KiCad Developers, see change_log.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
|
|
|
|
*/
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* @file erc.h
|
|
|
|
*/
|
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
#ifndef _ERC_H
|
|
|
|
#define _ERC_H
|
|
|
|
|
2010-11-11 21:10:27 +00:00
|
|
|
|
|
|
|
class NETLIST_OBJECT;
|
2013-09-27 12:30:35 +00:00
|
|
|
class NETLIST_OBJECT_LIST;
|
2018-01-19 15:12:36 +00:00
|
|
|
class SCH_SHEET_LIST;
|
2020-05-13 02:00:37 +00:00
|
|
|
class SCHEMATIC;
|
2010-11-11 21:10:27 +00:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
/* For ERC markers: error types (used in diags, and to set the color):
|
|
|
|
*/
|
|
|
|
enum errortype
|
|
|
|
{
|
|
|
|
OK = 0,
|
|
|
|
WAR, // Error: severity = warning
|
|
|
|
ERR, // Error: severity = error
|
|
|
|
UNC // Error: unconnected pin
|
|
|
|
};
|
|
|
|
|
2014-01-18 09:07:05 +00:00
|
|
|
extern const wxString CommentERC_H[];
|
|
|
|
extern const wxString CommentERC_V[];
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
/// DRC error codes:
|
2019-03-11 21:32:05 +00:00
|
|
|
enum ERCE_T
|
|
|
|
{
|
|
|
|
ERCE_UNSPECIFIED = 0,
|
2020-03-10 18:46:57 +00:00
|
|
|
ERCE_FIRST,
|
|
|
|
ERCE_DUPLICATE_SHEET_NAME = ERCE_FIRST, // duplicate sheet names within a given sheet
|
2019-03-11 21:32:05 +00:00
|
|
|
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
|
|
|
|
ERCE_HIERACHICAL_LABEL, // mismatch between hierarchical labels and pins sheets
|
|
|
|
ERCE_NOCONNECT_CONNECTED, // a no connect symbol is connected to more than 1 pin
|
2019-04-12 01:22:19 +00:00
|
|
|
ERCE_NOCONNECT_NOT_CONNECTED, // a no connect symbol is not connected to anything
|
2019-03-11 21:32:05 +00:00
|
|
|
ERCE_LABEL_NOT_CONNECTED, // label not connected to anything
|
|
|
|
ERCE_SIMILAR_LABELS, // 2 labels are equal fir case insensitive comparisons
|
|
|
|
ERCE_DIFFERENT_UNIT_FP, // different units of the same component have different footprints assigned
|
|
|
|
ERCE_DIFFERENT_UNIT_NET, // a shared pin in a multi-unit component is connected to more than one net
|
|
|
|
ERCE_BUS_ALIAS_CONFLICT, // conflicting bus alias definitions across sheets
|
|
|
|
ERCE_DRIVER_CONFLICT, // conflicting drivers (labels, etc) on a subgraph
|
|
|
|
ERCE_BUS_ENTRY_CONFLICT, // a wire connected to a bus doesn't match the bus
|
|
|
|
ERCE_BUS_LABEL_ERROR, // a label attached to a bus isn't in bus format
|
|
|
|
ERCE_BUS_TO_BUS_CONFLICT, // a connection between bus objects doesn't share at least one net
|
|
|
|
ERCE_BUS_TO_NET_CONFLICT, // a bus wire is graphically connected to a net port/pin (or vice versa)
|
2019-04-12 01:22:19 +00:00
|
|
|
ERCE_GLOBLABEL, // a global label is unique
|
2020-03-29 01:12:29 +00:00
|
|
|
ERCE_UNRESOLVED_VARIABLE,
|
2020-04-28 08:55:44 +00:00
|
|
|
ERCE_LAST = ERCE_UNRESOLVED_VARIABLE,
|
|
|
|
|
|
|
|
// Errors after this point will not automatically appear in the Severities Panel
|
|
|
|
|
|
|
|
ERCE_PIN_TO_PIN_WARNING, // pin connected to an other pin: warning level
|
|
|
|
ERCE_PIN_TO_PIN_ERROR, // pin connected to an other pin: error level
|
2019-03-11 21:32:05 +00:00
|
|
|
};
|
2009-07-07 17:50:02 +00:00
|
|
|
|
2010-11-11 21:10:27 +00:00
|
|
|
/* Minimal connection table */
|
|
|
|
#define NPI 4 // Net with Pin isolated, this pin has type Not Connected and must be left N.C.
|
|
|
|
#define DRV 3 // Net driven by a signal (a pin output for instance)
|
|
|
|
#define NET_NC 2 // Net "connected" to a "NoConnect symbol"
|
|
|
|
#define NOD 1 // Net not driven ( Such as 2 or more connected inputs )
|
|
|
|
#define NOC 0 // initial state of a net: no connection
|
|
|
|
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef
|
|
|
|
* or between aNetItemRef and aNetItemTst.
|
|
|
|
* if MinConn < 0: this is an error on labels
|
|
|
|
*/
|
2020-03-16 11:05:01 +00:00
|
|
|
void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst, int MinConnexion,
|
|
|
|
int Diag );
|
2010-11-11 21:10:27 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* Perform ERC testing for electrical conflicts between \a NetItemRef and other items
|
2015-06-09 10:40:34 +00:00
|
|
|
* (mainly pin) on the same net.
|
|
|
|
* @param aList = a reference to the list of connected objects
|
|
|
|
* @param aNetItemRef = index in list of the current object
|
|
|
|
* @param aNetStart = index in list of net objects of the first item
|
|
|
|
* @param aMinConnexion = a pointer to a variable to store the minimal connection
|
|
|
|
* found( NOD, DRV, NPI, NET_NC)
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
2020-03-16 11:05:01 +00:00
|
|
|
void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned aNetStart,
|
|
|
|
int* aMinConnexion );
|
2015-06-09 10:40:34 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* Function TestDuplicateSheetNames( )
|
|
|
|
* inside a given sheet, one cannot have sheets with duplicate names (file
|
|
|
|
* names can be duplicated).
|
|
|
|
* @return the error count
|
|
|
|
* @param aCreateMarker: true = create error markers in schematic,
|
|
|
|
* false = calculate error count only
|
|
|
|
*/
|
2020-05-13 02:00:37 +00:00
|
|
|
int TestDuplicateSheetNames( SCHEMATIC* aSchematic, bool aCreateMarker );
|
2010-11-11 21:10:27 +00:00
|
|
|
|
2020-03-29 01:12:29 +00:00
|
|
|
/**
|
|
|
|
* Function TestTextVars()
|
|
|
|
* Checks for any unresolved text variable references.
|
|
|
|
*/
|
2020-05-13 02:00:37 +00:00
|
|
|
void TestTextVars( SCHEMATIC* aSchematic );
|
2020-03-29 01:12:29 +00:00
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/**
|
|
|
|
* Checks that there are not conflicting bus alias definitions in the schematic
|
|
|
|
*
|
|
|
|
* (for example, two hierarchical sub-sheets contain different definitions for
|
|
|
|
* the same bus alias)
|
|
|
|
*
|
|
|
|
* @return the error count
|
|
|
|
*/
|
2020-05-13 02:00:37 +00:00
|
|
|
int TestConflictingBusAliases( SCHEMATIC* aSchematic );
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2018-01-19 15:12:36 +00:00
|
|
|
/**
|
|
|
|
* Test if all units of each multiunit component have the same footprint assigned.
|
|
|
|
* @param aSheetList contains components to be validated.
|
|
|
|
* @return The error count.
|
|
|
|
*/
|
2020-05-13 02:00:37 +00:00
|
|
|
int TestMultiunitFootprints( const SCH_SHEET_LIST& aSheetList );
|
2018-01-19 15:12:36 +00:00
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
#endif // _ERC_H
|