|
KiCad PCB EDA Suite
|
#include <net_chain_bridging.h>#include <queue>#include <unordered_map>#include <base_units.h>#include <board.h>#include <footprint.h>#include <math/vector2d.h>#include <netinfo.h>#include <pad.h>#include <pcb_track.h>Go to the source code of this file.
Functions | |
| double | FootprintChainBridgingLength (const FOOTPRINT *aFootprint, const wxString &aNetChain) |
| Compute the bridging length contributed by a single footprint to a net chain. | |
| double | BoardChainBridgingLength (const BOARD *aBoard, const wxString &aNetChain) |
| Sum chain bridging length across every footprint on the board. | |
| double | ChainBridgingDelayPerMm (const BOARD *aBoard, const wxString &aNetChain) |
| Pick a single per-IU-per-mm delay for a given chain. | |
| 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, i.e. | |
| 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 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 aEndPad. | |
| 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, i.e.
attoseconds) in one pass. The delay is derived from the first chain track with a measurable per-mm propagation delay so the bridging contribution tracks the actual stackup; if no such track exists the helper falls back to ~5.9 ps/mm (150 ps/in).
The matched-length DRC provider and the tuning pattern generator share this helper so the time-domain DRC verdict and the tuner's per-net budget agree on bridging delay. The returned tuple is (lengthIU, delayIU).
Definition at line 126 of file net_chain_bridging.cpp.
References BoardChainBridgingLength(), ChainBridgingDelayPerMm(), BOARD::IsEmpty(), and pcbIUScale.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PCB_TUNING_PATTERN::GetCachedBridgingLength(), and DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal().
| double BoardChainBridgingLength | ( | const BOARD * | aBoard, |
| const wxString & | aNetChain ) |
Sum chain bridging length across every footprint on the board.
Definition at line 81 of file net_chain_bridging.cpp.
References FootprintChainBridgingLength(), BOARD::Footprints(), and BOARD::IsEmpty().
Referenced by BoardChainBridging(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| double ChainBridgingDelayPerMm | ( | const BOARD * | aBoard, |
| const wxString & | aNetChain ) |
Pick a single per-IU-per-mm delay for a given chain.
Walks the chain's tracks until it finds one with a measurable per-mm propagation delay; falls back to the default constant if none. Shared between the aggregate and per-edge bridge helpers so they always apply the same scaling.
Definition at line 95 of file net_chain_bridging.cpp.
References DEFAULT_PROPAGATION_DELAY_PS_PER_MM, NETINFO_ITEM::GetNetChain(), BOARD::GetTrackLength(), BOARD::IsEmpty(), pcbIUScale, and BOARD::Tracks().
Referenced by BoardChainBridging(), CHAIN_TOPOLOGY::CHAIN_TOPOLOGY(), and EnumerateChainBridges().
| 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 chain.
Unlike FootprintChainBridgingLength (which returns a single max-span scalar per footprint), this returns one edge per qualifying cross-net pad pair, which is what the CHAIN_TOPOLOGY graph builder needs to compute trunk paths through series passives.
Definition at line 143 of file net_chain_bridging.cpp.
References ChainBridgingDelayPerMm(), delta, BOARD::Footprints(), NETINFO_ITEM::GetNetChain(), BOARD::IsEmpty(), pad, and pcbIUScale.
Referenced by CHAIN_TOPOLOGY::CHAIN_TOPOLOGY(), and PartitionNetChainAroundNet().
| double FootprintChainBridgingLength | ( | const FOOTPRINT * | aFootprint, |
| const wxString & | aNetChain ) |
Compute the bridging length contributed by a single footprint to a net chain.
A footprint bridges two segments of the same chain when it has at least one chain pad on each of two distinct nets. The bridging contribution is the maximum pairwise Euclidean distance between any two chain pads on different nets. This is a conservative upper bound that handles 3+ pad devices (centre-tap beads, transformers, dual-winding parts) without silently dropping their contribution.
Returns 0.0 when the footprint has fewer than two chain pads, or when all chain pads share the same netcode (no cross-net bridging possible).
The DRC matched-length provider and the tuning pattern generator share this predicate so they always agree on which footprints bridge a chain and by how much.
Definition at line 35 of file net_chain_bridging.cpp.
References delta, NETINFO_ITEM::GetNetChain(), EMBEDDED_FILES::IsEmpty(), pad, and FOOTPRINT::Pads().
Referenced by BoardChainBridgingLength().
| 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 aEndPad.
The chain bridge graph (nodes = chain netcodes, edges = CHAIN_BRIDGE) is built from EnumerateChainBridges() with aQueryNet's node and every incident edge removed. Multi- source BFS seeds from every non-query bridge neighbor of aStartPad to fill beforeStart, and from every non-query bridge neighbor of aEndPad to fill afterEnd. Footprints that place several chain pads on distinct nets therefore contribute every such neighbor on the seeded side, not just one.
If aQueryNet is the chain terminal, one side may legitimately be empty; status is still OK. If the two sets overlap, the chain has a cycle that does not pass through aQueryNet and the partition is ambiguous; both sets are still populated and status is AMBIGUOUS_OVERLAP.
Multi-pad parts (transformers, beads) are represented by EnumerateChainBridges() as a complete cross-net pad-pair graph per footprint. When the chain spans more than two nets through one footprint the resulting clique is treated as fully connected, which is consistent with how the DRC trunk-length topology consumes the same edges.
Definition at line 191 of file net_chain_bridging.cpp.
References AMBIGUOUS_OVERLAP, END_PAD_NOT_ON_QUERY, EnumerateChainBridges(), BOARD::FindNet(), BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetNet(), NETINFO_ITEM::GetNetChain(), INVALID_INPUT, NO_CHAIN_BRIDGES, OK, QUERY_NET_NOT_IN_CHAIN, result, seed, and START_PAD_NOT_ON_QUERY.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().