Commit Graph

241 Commits

Author SHA1 Message Date
Seth Hillbrand 70b4503187 Fix cherry-pick errors 2023-04-13 02:11:39 +02:00
Seth Hillbrand 68dfcddbe9 Allow bus elements to connect
Previously, bus elements that were not instantiated as individual nets
could not connect to each other.  This caused issues for complex
schematics where busses needed to connect to other busses with elements
that resolved to the same net names.  Functionally, this means mixing
bus elements, which we will replace with first-class elements in version
8 but currently can only be accomplished either by using bus aliases and
  this patch or by individually instantiating each bus element as a
local label

Fixes https://gitlab.com/kicad/code/kicad/issues/14300

(cherry picked from commit 16b4ec3c7e)
2023-04-12 16:10:50 +02:00
Seth Hillbrand 39dcd0a352 Handle nested netclass assignments
Netclass directives should not be overriden, instead hold our error
checking for actually missing nets

Fixes https://gitlab.com/kicad/code/kicad/issues/14494

(cherry picked from commit 012737593b)
2023-04-06 17:38:42 -07:00
Jeff Young dce2247925 Improve scoping control of connetion members.
(The real bug here is that CONNECTION_GRAPH::assignNetCodesToBus() was
growing the bus aliases members list because it used a non-const
reference to it as a local storage list.  The const scoping of it will
prevent this type of error in future.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14269
2023-04-04 11:35:06 +01:00
Seth Hillbrand 420eceecbb Simplify name caching
We don't need two functions to get driver names.  The map should be
mutable to allow updates when needed.  C++17 gives some extra syntactic
sugar for map manipulation
2023-01-24 10:30:52 -08:00
JamesJCode fef3274e8e Eeschema: ERC checks handle connections between a common sub-circuit
Fixes #10926

Contains the following changes:

    - Adds a new ERC_SCH_PIN_CONTEXT class which is used to provide deterministic
      comparison between items causing ERC violations (e.g. pins) when associated
      with a SCH_SHEET_PATH context.

    - Adds association of SCH_SHEET_PATHs for ERC_ITEMs and the sub-schematic items
      which caused an ERC violation. This allows correct display of markers on the
      sheets of interest only, and allows correct naming resolution and cross-probing
      from the ERC dialog.

    - Adds a new ERC_TREE_MODEL class, derived from RC_TREE_MODEL, which correctly
      resolves component references across heirarchical sheets using the associated
      SCH_SHEET_PATHs. This allows sheet-specific component references to be displayed
      correctly in the ERC results tree.

    - Updates SCH_MARKER to only draw sheet-specific markers on the sheet causing
      an ERC violation.

    - Increments the schematic file version.

    - When loading a schematic with legacy ERC exclusions, discards those of type
      ERCE_PIN_TO_PIN_WARNING, ERCE_PIN_TO_PIN_ERROR, ERCE_HIERACHICAL_LABEL, and
      ERCE_DIFFERENT_UNIT_NET as there is no safe way to automatically infer the
      information which is now stored with these exclusions (sheet paths for error
      location and related items). Requiring users to (once) re-add exclusions is
      preferable to silently incorrectly matching new ERC issues to legacy exclusions.
2023-01-24 14:11:01 +00:00
Seth Hillbrand ed0d57ddf6 Handle the forced propagation to subgraphs 2023-01-20 15:20:03 -08:00
Seth Hillbrand e6dbca051c Force realtime connectivity on
The pressure relief valve was not useful for common work patterns as it
forced the recalculation on many common actions such as bus expansion.
This caused it to actually feel slower than with the pressure relief
valve off.

For most schematics, realtime is now fast enough to not need the valve
and for those that are extremely complex, removing the valve helps this
run more predictably
2023-01-20 15:17:57 -08:00
Marek Roszko d2c0f5fc2a More wxSing 2023-01-16 23:14:38 -05:00
Seth Hillbrand bd6d0b6cb6 Ensure that all subgraphs are processed
Don't skip subgraphs just because they do not have off-sheet connections
on their hierarchical ports
2023-01-12 17:01:09 -08:00
Jon Evans c530bdb5a1 Rename GetSelectMenuText to GetItemDescription
This descriptive text is used for many more things than
just the select menu these days.
2023-01-11 22:27:44 -05:00
Jon Evans 5657ca5a04 No-connects might not be connected to a pin
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13256
2022-12-23 20:50:49 -05:00
Seth Hillbrand c86688d280 Ensure we have a subgraph 2022-12-14 16:41:52 -08:00
Seth Hillbrand bc8366cd95 Don't report a pin if the pin is null
The pins can exist on a different sheet from the no-connect.  In this
case, we do not set the ERC for the current sheet to the remote pins,
instead only link the NC
2022-12-12 19:29:15 -08:00
Seth Hillbrand eaf56bc05a Fix NC and label connection logic
label has 0 pins -> unconnected label warning
label has 1 pin -> OK only if also has a NC marker, otherwise unconnected pin warning
label has >1 pins -> OK only if has no NC marker, otherwise "NC is connected" warning

Thanks @craftyjon for helping work out the details
2022-12-09 02:14:05 +00:00
Seth Hillbrand 9a5df73060 ERC: don't flag hierarchically connected NCs
NCs require no more than one pin on the full net.  They may also have
multiple labels connecting them.
2022-12-07 13:48:25 -08:00
Seth Hillbrand f9a36b9c91 Update thread_pool to 3.3
Fixes an issue with `wait_for_tasks()` and adds a lower-overhead
`push_loop` helper.  We replace our usage of `parallelize_loop` with
`push_loop` as we didn't use the multi-future vector return and don't
need the extra overhead.
2022-12-02 12:01:34 -08:00
Seth Hillbrand 6625afabb7 Restore subgraph removal behavior
Commit 938645b29d had lines commented out
for debugging purposes.  This commit restores the original lines

Fixes https://gitlab.com/kicad/code/kicad/issues/12165

Fixes https://gitlab.com/kicad/code/kicad/issues/12814
2022-11-22 05:43:53 -08:00
Seth Hillbrand 938645b29d Add terrible hack to get subgraph netname
In certain cases, the subgraph does not receive the proper netname,
preventing us from checking for correct pin counts.  This is a backwards
iteration of the net name <-> subgraph map to extract the proper name
and sibling subgraphs

Fixes https://gitlab.com/kicad/code/kicad/issues/12165

Fixes https://gitlab.com/kicad/code/kicad/issues/12814
2022-11-21 15:19:45 -08:00
Jon Evans 0e454054f1 Also include resolved name when checking for bus membership 2022-11-02 17:37:34 -04:00
Jon Evans 5689c4b625 Include overridden drivers when checking bus membership
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10945
2022-10-30 19:17:04 -04:00
Jon Evans 3f68b7c5c1 Don't consider sheet pins as connections in ERC
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9828
2022-10-29 09:06:31 -04:00
Jon Evans 3a9ed47bf0 Prioritize power symbols over hidden power pins on regular symbols
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8400
2022-10-27 22:54:36 -04:00
Jon Evans 141c1f020e ERC: Include power connections in multiple driver test
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12138
2022-10-27 22:36:40 -04:00
Jon Evans 014d536954 Ignore lastDriver in connectivity
Using the last driver in driver sorting breaks the stability/reproducibility
of the netlisting algorithm.  The last driver still needs to be tracked for
efficient redraw dirty detection.

Partially reverts 81e1bc9
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10757
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11393
2022-10-21 22:29:25 -04:00
Jeff Young eea8c7a8fd Handle netclasses assigned to bus labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/12546
2022-10-02 15:01:16 +01:00
Seth Hillbrand 9adae0e8ba Avoid double-processing SCH_ITEMs
Elements such as zero-length lines might get into the connection map,
causing the system to process them twice.  This can cause allocation
errors when both are performed at the same time

Fixes https://gitlab.com/kicad/code/kicad/issues/12278
2022-10-01 12:28:39 -07:00
Seth Hillbrand 4b20eb9cb0 Remove debugging code 2022-09-19 15:25:06 -07:00
Seth Hillbrand e0f7c3b057 Properly handle non-connected labels in ERC
All labels need to be attached to a net that has at least 2 pins in
order for this to be a valid net.  To check for the existing pins, we
need to interate over all subgraphs in the net, counting pins
2022-09-19 15:18:32 -07:00
Jeff Young 64a6fc0fd4 Push UNITS_PROVIDER down into a low-level mixin.
This allows us to also construct cheap UNIT_PROVIDERs for specific
tasks when necessary.
2022-09-19 17:10:59 +01:00
Seth Hillbrand 60374daa49 Fix ERC global label unit tests
Need to test all units in the subgraph as there are chances that the
subgraph might have more than one label, which needs to be consistently
handled
2022-09-12 13:16:45 -07:00
Jeff Young 536561f7b3 Move bus aliases to std::set.
This is mostly to output the aliases sorted (for ease of VCS integration),
but also because a btree will be faster than hashing on a small dataset.

Fixes https://gitlab.com/kicad/code/kicad/issues/11890
2022-09-11 19:48:08 +01:00
Seth Hillbrand 05cdf915d0 Show ERC errors when any label only has 1 pin
To be connected, the label must have at least two pins on a subgraph
(or, in the case of a hierarchical label, two pins somewhere in its
connection)

Fixes https://gitlab.com/kicad/code/kicad/issues/7203
2022-09-09 17:21:57 -07:00
Seth Hillbrand 16479277cc Catch connection errors when stacked pins have NC flags
Don't flag the error as having a connected net with an NC flag.  Stacked
pins are not connected in that sense, so are allowed an NC flag
2022-09-09 17:21:57 -07:00
jean-pierre charras 92edee5a08 Fix issues related to m_unit SYMBOL member:
- ensure it is updated in DIALOG_SYMBOL_PROPERTIES
- ensure it is restored after changes in CONNECTION_GRAPH::Recalculate
2022-09-04 20:59:06 +02:00
Jeff Young 88c9177ff6 Move bus members from wxArray to std::vector and fix some bugs in dialog. 2022-08-21 20:54:41 +01:00
Jeff Young a9536b5de9 CHANGED netclass assignments now done via canvas or via patterns. 2022-08-14 22:56:29 +01:00
jean-pierre charras 7441510b3c CONNECTION_GRAPH::Recalculate(): ensure unit and pin list are up to date.
Multi-unit symbols created previously incorrect connections, due to not
up to date or missing data. I also saw crashes due to this not up to date data
Fixes #12149
https://gitlab.com/kicad/code/kicad/issues/12149
2022-08-03 17:21:16 +02:00
Jeff Young 96f01d33c8 Performance improvements.
1) Move a bunch of std::map's to std::unordered_map to get constant-time
look-ups
2) Lengthen progress-reporting intervals to spend more time doing work
and less time talking about it
3) Reverse order of SHAPE_LINE_CHAINs in thermal intersection checks to
make (much) better use of bbox caches
4) Don't re-generate bboxes we already have
5) Fix some autos that weren't by reference (and were therefore copying
large datasets)
6) Rename delta progressDelta so it's easier to search for in future
7) Get rid of a few more autos (because I don't like them)
8) Pass large items to lambdas by reference

Fixes https://gitlab.com/kicad/code/kicad/issues/12130
2022-08-03 11:59:42 +01:00
Jeff Young 6f49b57f9b Cleanup & performance enhancements. 2022-08-01 13:09:51 +01:00
jean-pierre charras 993c446fdf Fix some warnings detected by PVS-STUDIO (most are not used vars) 2022-07-25 18:23:52 +02:00
Seth Hillbrand 283446a3a8 Flag ERC error on non-stacked pins
Pins that are explicitly connected in the schematic should not have an
"unconnected pin" ERC error.  But stacked pins do not count as
explicitly connected because the schematic designer has not connected
them

(cherry picked from commit 865bb54591)
2022-07-17 20:17:11 -07:00
Alex aaf99eb0cc Performance optimizations. 2022-07-11 21:25:12 +00:00
Seth Hillbrand 6a8519dfd9 Fix ERC error missing on stacked pins
Stacked pins are not connected, so they should be flagged as such.  This
checks for stacked pins that are not part of different symbols

Fixes https://gitlab.com/kicad/code/kicad/issues/11926

(cherry picked from commit 90ef84b958)
2022-06-28 15:04:14 -07:00
Seth Hillbrand 03c279ffd4 ADDED: Threadpool
Thread pools are long-lasting executors that have close to zero overhead
when launching new jobs.  This is advantageous over creating new threads
as we can use this for threading smalling jobs and smaller quanta.  It
also avoids the heuristics needed to determine the optimal number of
threads to spawn
2022-06-24 22:59:24 +00:00
Seth Hillbrand 719874fe9c Thread the connectivity vector updates
Now that we are dealing with individual connection elements that do not
update their connected elements as well, we can thread the update, just
being careful to guard any remaining updates (bus_enty/busLine) that
need reciprocal updating

Fixes https://gitlab.com/kicad/code/kicad/issues/10974

(cherry picked from commit 6a53e318e5)
2022-03-28 15:36:55 -07:00
Seth Hillbrand 6a33bcdc78 Avoid generating SCH_CONNECTION if not needed
If the SCH_ITEM has already been processed, the extra time needed to
iterated over the memberset and get the SCH_CONNECTION when we won't use
it is not neccesary.

Fixes https://gitlab.com/kicad/code/kicad/issues/10974

(cherry picked from commit 776a28a10e)
2022-03-28 15:36:55 -07:00
Seth Hillbrand 41f7354b7a Handle connection vector inline
Normally, you will gain by resursing a nested loop only over the
pairs that are not already handled.  In this case, however, you lose
time because you step outside of the cache by adding the reciprocal test
at each step.

Instead, we process one element at a time, keeping it cached and loop
over all other elements to add to the connection.  This saves us about
75% of the time for larger loops (e.g. stacked power pins on a large
BGA)

Fixes https://gitlab.com/kicad/code/kicad/issues/10974

(cherry picked from commit 3a98eacdb9)
2022-03-28 15:36:55 -07:00
Seth Hillbrand deb7a0beff Avoid marking symbols that will not be processed
We want to shorting the processing time by marking symbols that have
already been processed.  But we must avoid marking symbols that will not
be processed due to their other flags

Fixes https://gitlab.com/kicad/code/kicad/issues/11164

(cherry picked from commit 2208e0db16)
2022-03-17 10:10:56 -07:00
Seth Hillbrand d653484d72 Move connected_items from hash table to tree
This gains about 10% speed in heavily connected sheets

Fixes https://gitlab.com/kicad/code/kicad/issues/10974

(cherry picked from commit 187aa1c171)
2022-03-11 16:58:38 -08:00