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>
|
2015-08-31 11:09:47 +00:00
|
|
|
* Copyright (C) 2009-2015 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;
|
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:
|
|
|
|
#define ERCE_UNSPECIFIED 0
|
2009-11-03 13:26:31 +00:00
|
|
|
#define ERCE_DUPLICATE_SHEET_NAME 1 // duplicate sheet names within a given sheet
|
|
|
|
#define ERCE_PIN_NOT_CONNECTED 2 // pin not connected and not no connect symbol
|
|
|
|
#define ERCE_PIN_NOT_DRIVEN 3 // pin connected to some others pins but no pin to drive it
|
|
|
|
#define ERCE_PIN_TO_PIN_WARNING 4 // pin connected to an other pin: warning level
|
|
|
|
#define ERCE_PIN_TO_PIN_ERROR 5 // pin connected to an other pin: error level
|
|
|
|
#define ERCE_HIERACHICAL_LABEL 6 // mismatch between hierarchical labels and pins sheets
|
|
|
|
#define ERCE_NOCONNECT_CONNECTED 7 // a no connect symbol is connected to more than 1 pin
|
2015-08-31 11:09:47 +00:00
|
|
|
#define ERCE_GLOBLABEL 8 // global label not connected to any other global label
|
2015-12-20 12:40:17 +00:00
|
|
|
#define ERCE_SIMILAR_LABELS 9 // 2 labels are equal fir case insensitive comparisons
|
|
|
|
#define ERCE_SIMILAR_GLBL_LABELS 10 // 2 labels are equal fir case insensitive comparisons
|
2018-01-19 15:12:36 +00:00
|
|
|
#define ERCE_DIFFERENT_UNIT_FP 11 // different units of the same component have different
|
|
|
|
// footprints assigned
|
2018-03-15 01:03:26 +00:00
|
|
|
#define ERCE_DIFFERENT_UNIT_NET 12 // a shared pin in a multi-unit component is connected
|
|
|
|
// to more than one net
|
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
|
|
|
/**
|
|
|
|
* Function WriteDiagnosticERC
|
|
|
|
* save the ERC errors to \a aFullFileName.
|
|
|
|
*
|
|
|
|
* @param aFullFileName A wxString object containing the file name and path.
|
|
|
|
*/
|
2015-12-20 12:40:17 +00:00
|
|
|
bool WriteDiagnosticERC( const wxString& aFullFileName );
|
2010-11-11 21:10:27 +00:00
|
|
|
|
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
|
|
|
|
*/
|
2015-12-20 12:40:17 +00:00
|
|
|
void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst,
|
2011-10-07 14:41:30 +00:00
|
|
|
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
|
|
|
*/
|
2015-12-20 12:40:17 +00:00
|
|
|
void TestOthersItems( NETLIST_OBJECT_LIST* aList,
|
2013-09-27 12:30:35 +00:00
|
|
|
unsigned aNetItemRef, unsigned aNetStart,
|
2015-06-09 10:40:34 +00:00
|
|
|
int* aMinConnexion );
|
|
|
|
|
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
|
|
|
|
*/
|
2015-12-20 12:40:17 +00:00
|
|
|
int TestDuplicateSheetNames( bool aCreateMarker );
|
2010-11-11 21:10:27 +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.
|
|
|
|
*/
|
|
|
|
int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList );
|
|
|
|
|
2009-07-07 17:50:02 +00:00
|
|
|
|
|
|
|
#endif // _ERC_H
|