KiCad PCB EDA Suite
Loading...
Searching...
No Matches
net_chain_bridging.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 */
20
21#ifndef PCBNEW_NET_CHAIN_BRIDGING_H
22#define PCBNEW_NET_CHAIN_BRIDGING_H
23
24#include <algorithm>
25#include <limits>
26#include <set>
27#include <tuple>
28#include <vector>
29
30#include <wx/string.h>
31
32class BOARD;
33class FOOTPRINT;
34class PAD;
35
36
37constexpr double DEFAULT_PROPAGATION_DELAY_PS_PER_MM = 5.9; // 150 ps/in fallback when no track delay sample is available
38
39
55double FootprintChainBridgingLength( const FOOTPRINT* aFootprint, const wxString& aNetChain );
56
57
61double BoardChainBridgingLength( const BOARD* aBoard, const wxString& aNetChain );
62
63
70double ChainBridgingDelayPerMm( const BOARD* aBoard, const wxString& aNetChain );
71
72
83std::tuple<double, double> BoardChainBridging( const BOARD* aBoard, const wxString& aNetChain );
84
85
91inline int SubtractBridgingClamped( int aValue, long long aDelta )
92{
93 long long adjusted = static_cast<long long>( aValue ) - aDelta;
94
95 return static_cast<int>( std::clamp( adjusted,
96 0LL,
97 static_cast<long long>( std::numeric_limits<int>::max() ) ) );
98}
99
100
110{
113 double length;
114 double delay;
115};
116
117
125std::vector<CHAIN_BRIDGE> EnumerateChainBridges( const BOARD* aBoard, const wxString& aNetChain );
126
127
132{
134 INVALID_INPUT, // null board, equal pads, etc.
135 QUERY_NET_NOT_IN_CHAIN, // aQueryNet has no chain assignment
136 START_PAD_NOT_ON_QUERY, // aStartPad's netcode != aQueryNet
138 NO_CHAIN_BRIDGES, // the query net has no series-passive bridge in the chain
139 AMBIGUOUS_OVERLAP // the two sides share at least one netcode (cycle)
140};
141
142
155
156
178NET_CHAIN_PARTITION PartitionNetChainAroundNet( const BOARD* aBoard, int aQueryNet,
179 const PAD* aStartPad, const PAD* aEndPad );
180
181
182#endif // PCBNEW_NET_CHAIN_BRIDGING_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:323
Definition pad.h:65
#define OK
double ChainBridgingDelayPerMm(const BOARD *aBoard, const wxString &aNetChain)
Pick a single per-IU-per-mm delay for a given chain.
NET_CHAIN_PARTITION PartitionNetChainAroundNet(const BOARD *aBoard, int aQueryNet, const PAD *aStartPad, const PAD *aEndPad)
Partition the chain containing aQueryNet around it, cut at the bridges incident on aStartPad and aEnd...
constexpr double DEFAULT_PROPAGATION_DELAY_PS_PER_MM
std::tuple< double, double > BoardChainBridging(const BOARD *aBoard, const wxString &aNetChain)
Compute both the chain bridging length and its associated propagation delay (in internal delay IU,...
std::vector< CHAIN_BRIDGE > EnumerateChainBridges(const BOARD *aBoard, const wxString &aNetChain)
Enumerate every per-pad-pair bridge edge contributed by every footprint on the board to the named cha...
int SubtractBridgingClamped(int aValue, long long aDelta)
Saturating subtract for bridge-adjusting MINOPTMAX<int> bounds without overflow when the delta is in ...
double BoardChainBridgingLength(const BOARD *aBoard, const wxString &aNetChain)
Sum chain bridging length across every footprint on the board.
NET_CHAIN_PARTITION_STATUS
Status returned by PartitionNetChainAroundNet().
double FootprintChainBridgingLength(const FOOTPRINT *aFootprint, const wxString &aNetChain)
Compute the bridging length contributed by a single footprint to a net chain.
One series-component bridge edge inside a chain graph.
Result of PartitionNetChainAroundNet().
std::set< int > beforeStart
NET_CHAIN_PARTITION_STATUS status