Commit Graph

222 Commits

Author SHA1 Message Date
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
Seth Hillbrand 5b5c7d41b4 Break up buildConnectionGraph for debugging
Needed to find bottlenecks in fns, so break out individual sections of
the massive function for easier understanding.

buildItemSubgraphs (one section of the previous function) would build
millions of connections that were never used as stacked pins created X!
connections.  Also tested using sets instead of lists and keeping unique
lists to avoid flagging but none of these were as performant as using
flags to remember which items had already been processed.

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

(cherry picked from commit 17b1b68ac7)
2022-03-11 16:58:38 -08:00
Seth Hillbrand 8fd87e1f04 Change connectivity item group from set to vector
Reserve space for new items to speed construction of connectivity graph

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

(cherry picked from commit 7aebc4b11f)
2022-03-05 13:04:11 -05:00
Jeff Young c7dda3fbec Formatting. 2022-02-22 22:19:55 +00:00
Marek Roszko c4c56de708 Neurotically update position wxPoint usages 2022-01-01 11:55:51 -05:00
Marek Roszko 347e03363a Convert wxPoint/wxSize starting from EDA_RECT usages 2022-01-01 11:30:33 -05:00
Jeff Young e48d4a653a Pick better auto-generated netnames.
Fixes https://gitlab.com/kicad/code/kicad/issues/4312
2021-12-24 18:13:16 +00:00
Jeff Young 889970a449 SCH_NETCLASS_FLAGs and SCH_FIELDs for labels.
ADDED: a new label type for netclass flags.
ADDED: the ability to define fields on labels.
2021-12-24 16:13:27 +00:00
Jon Evans a205595404 PROF_COUNTER -> PROF_TIMER
I want to add an event counter, and this one is a timer
2021-12-05 14:25:37 -05:00
jean-pierre charras 3a00d76207 Fix a compil warning (shadowed var) and add a comment. 2021-12-01 11:05:16 +01:00
Jon Evans d7f5917fb0 ERC: flag duplicated local labels with no pins as floating
See https://gitlab.com/kicad/code/kicad/-/issues/9593
2021-11-27 22:34:11 -05:00
Jon Evans 08cb573e11 Do not propagate bus entries across buses and wires at the same point
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9678
2021-11-25 13:36:30 -05:00
Jeff Young 7fc04c3cf2 Fixes for realtime connectivity being off.
Fixes https://gitlab.com/kicad/code/kicad/issues/9628
2021-11-24 13:20:44 +00:00
Wayne Stambaugh 53f5d616aa Coverity issue fixes. 2021-11-13 11:38:31 -05:00
Jeff Young 83e5208213 Fix a couple of holes in the IsTestEnabled() checks.
Fixes https://gitlab.com/kicad/code/kicad/issues/7270
2021-11-04 16:24:06 +00:00
Jeff Young 75b5bcf46d Make Coverity happy. 2021-10-19 17:14:04 +01:00
Jeff Young 4e48a16847 Look for all types of label conficts in ERC.
Fixes https://gitlab.com/kicad/code/kicad/issues/9367
2021-10-18 18:09:40 +01:00
Jeff Young f606679164 Proper numeric sorting for intersheet refs.
Also expunges the horrifically named std::remove and std::remove_if
(neither of which remove anything).
2021-10-01 18:29:21 +01:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Jon Evans 3aab37bd2a Fix determinism issue when comparing a local and hierarchical label
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8406
2021-07-03 16:43:00 -04:00