Commit Graph

259 Commits

Author SHA1 Message Date
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
Jeff Young bcdec0dea7 Move '~' pin name processing to LIB_PIN and SCH_PIN.
This will also allow us to do variable processing in the future if
desired.
2021-06-12 19:54:34 +01:00
Wayne Stambaugh fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
Marek Roszko 4df3cb912d Remove another leaky wx/log.h header 2021-06-03 08:11:15 -04:00
Jon Evans 9effeb1fcb Don't crash if an invalid bus connection is made
Certain situations can trigger the stale cleanup being run
on a bus that doesn't actually contain the stated member.
In this case we should just keep calm and carry on -- who knows
what netlist will be generated, but we shouldn't crash.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8530
2021-06-01 21:49:25 -04:00
Jon Evans 55c1d814f9 Fix hierarchical propagation for designs with unmatched hier ports
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8397
2021-05-10 17:54:09 -04:00
Jeff Young 2e3860de6f Naming conventions. 2021-05-05 22:58:40 +01:00
Wayne Stambaugh 2b86b34124 Eeschema: split out SCH_SHEET_PIN declarations into separate header. 2021-04-06 17:15:49 -04:00
Wayne Stambaugh 1786ae8773 Eeschema: use symbol nomenclature for object file naming. 2021-02-24 08:48:02 -05:00
Jon Evans d951ac5bfe Fix logic issue with sheet pin ERC
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7592
2021-02-18 12:10:59 -05:00
Jon Evans 212c67c365 Fix bus<>net conflict ERC not checking local labels 2021-02-14 21:35:29 -05:00
Jon Evans 07e1ae1b56 Fix logic of global label ERC check
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7392
2021-02-13 10:29:31 -05:00
Jon Evans dbd749c07a ERC warn if hierarchical labels have no matching sheet pin
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7511
2021-02-13 10:24:22 -05:00
Jon Evans 7015f4cf75 Use full names for bus membership ERC checking
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7522
2021-02-13 10:09:16 -05:00
Jon Evans 73ea0fc15e Always upgrade to a stronger driver even if the path is longer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7492
2021-02-11 17:25:14 -05:00
Jon Evans 8e9b457887 Make sure sheet pin connections get reset every time
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7499
2021-02-11 17:25:14 -05:00
Jeff Young 0ba0160da9 Add a PT_NIC pin electrical type and a netlist token for SCH_NO_CONNECT.
ADDED a new pin electrical type "free" for internally unconnected pins.

CHANGED the "unconnected" pin electrical type is now represented by
"no_connect" in files and netlists.  (The legacy syntax is also accepted
in files.)
2021-01-23 00:10:01 +00:00
Jeff Young 274fc60fe9 Formatting. 2021-01-23 00:10:01 +00:00
Jon Evans 6cd4fcf30c Don't pick a name with a longer path to override with
Only triggered on some platforms because of compiler-dependent
unordered_set iteration

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7169
2021-01-18 21:50:26 -05:00
Jeff Young 95ca5a0233 Don't record null drivers.
Fixes https://gitlab.com/kicad/code/kicad/issues/7155
2021-01-17 16:24:22 +00:00
Jeff Young f3a6d2655e Improvements to ERC and bus parsing.
1) Add some nullptr safety to ERC.
2) Allow unconnected flagging on bus/wire entries.
3) Allow commas in bus group definitions.

Fixes https://gitlab.com/kicad/code/kicad/issues/7155
2021-01-17 16:24:22 +00:00
Jon Evans 02681fcf0e Move no-connect processing to connection graph
This way the net names can be inspected in eeschema and cross-probing works.
Testcases updated for the name changes

CHANGED: all unconnected pins are now included in the netlist with no_connect_ prefixes
2021-01-14 20:55:49 -05:00
Jon Evans 9b69c1e198 Fix a bone-headed cause of non-determinism 2021-01-14 19:20:37 -05:00
Jon Evans 654e9a77db Connectivity: defer and parallelize item updates
Good for ~15% performance improvement in large designs
2021-01-14 12:21:19 -05:00
Jon Evans 6fb1ed2824 Make sure hierarchical overrides are deterministic
Without alphabetic sorting here, we are at the mercy of
the r-tree and multithreading.
2021-01-14 12:21:19 -05:00
Jon Evans b90e72ed07 Don't simplify hierarchical nets based on weak drivers
This behavior provided shorter net names, but was confusing if
the user gives an explicit strong driver in the subsheet but not
one in the parent sheet.

Testcases updated for net name changes; connectivity is the same

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4201
2021-01-13 22:10:56 -05:00
Jon Evans 24ff66f5a2 ERC: flag unconnected sheet pins
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1780
2021-01-13 19:47:28 -05:00
Jon Evans 693e40b5b0 Exclude buses from dangling label checks
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7017
2021-01-13 19:37:05 -05:00
Jon Evans ede500f117 Don't create multiple markers for the same issue
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7016
2021-01-12 23:24:13 -05:00
Jon Evans 5ceadbda3b Don't show redundant ERC markers from subsheets
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7016
2021-01-12 23:24:13 -05:00
Jeff Young c3d46c1cb5 Add ncPins to the list of no_connect_ nets.
This allows the info to be acted upon in PCBNew (for instance, clearance
rules).

Fixes https://gitlab.com/kicad/code/kicad/issues/6991
2021-01-07 21:56:04 +00:00
Jon Evans 487aa37d2e Connectivity: don't rename things multiple times in subsheets
Depending on what order the subgraphs are processed in, it's
possible to hit a case where the parent sheet renames a bus
member before the bus neighbor renaming logic runs.  In this
case, we don't want to apply the bus neighbor logic as it will
break connectivity to the parent sheet if that bus was not
also renamed (for example, if the hier ports only make net
connections and not bus connections)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6887
2020-12-29 16:42:30 -05:00
Jon Evans e33a331095 Don't ERC check absorbed subgraphs
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6861
2020-12-27 15:31:48 -05:00
Jeff Young 3d852372ca Handle nested unescaping (for buses in particular).
Also adds a few missing unescape() calls when showing netnames to the
user.

Fixes https://gitlab.com/kicad/code/kicad/issues/6400
2020-12-20 15:59:09 +00:00
Seth Hillbrand 7b9c21e290 Not connected pins should not get connected
This prevents splitting wires/busses on the NC pin end.  It also keeps
NC pins out of the netlist.

Fixes https://gitlab.com/kicad/code/kicad/issues/6777
2020-12-17 11:56:42 -08:00
Jon Evans 6544dca056 Ensure driver connections are always properly initialized
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6694
2020-12-12 10:43:30 -05:00
Jeff Young ad281f7538 Remove duplicated TestDanglingEnds routines.
Also adds a changedItemHandler so that the single remaining version
can update the view.

Fixes https://gitlab.com/kicad/code/kicad/issues/6581
2020-12-06 21:24:16 +00:00
Jeff Young c85ef8eb69 Make updating netnames in backannotate more discrete.
Trying to be too smart was producing unexpected results.

Fixes https://gitlab.com/kicad/code/kicad/issues/6480
2020-11-25 22:16:56 +00:00
Jeff Young 9c7c05c161 Mostly formatting cleanup but a few type-casting cleanups too. 2020-11-24 22:16:41 +00:00
Jeff Young 44850e9409 Fix nullptr crash. 2020-11-24 14:13:03 +00:00
Jeff Young c94001839b Minor performance improvements to connection graph. 2020-11-23 19:47:55 +00:00
jean-pierre charras 94a358c592 fix 2 compil issues 2020-11-17 19:32:20 +01:00
Jeff Young 6654c03041 Embarking on the next adventure: component -> symbol. 2020-11-15 20:23:15 +00:00
jean-pierre charras 79dd6e6476 Eeschema, ERC: fix missing call to subgraph->ResolveDrivers() when test driver
conflicts (more than one name for a net) is disabled.

This missing call was creating issues in tests that need a full connection
calculation, especially ercCheckFloatingWires()
2020-11-10 11:30:30 +01:00
Jeff Young 7c505da368 Make sure ERC tests honour the severity settings.
(And in particular, IGNORE.)

Fixes https://gitlab.com/kicad/code/kicad/issues/6178
2020-11-01 17:38:24 +00:00
Jon Evans 31d502735c Better messages for bus entry conflict ERC 2020-10-27 22:05:35 -04:00
Jon Evans 2edd246f36 Use explicit message for multiple drivers ERC
Fixes https://gitlab.com/kicad/code/kicad/-/issues/3980
2020-10-25 18:30:22 -04:00
Jon Evans ee08a3488f Fix missing driver conflict ERC 2020-10-25 18:13:03 -04:00
Jon Evans 7d09681f9e Improve reporting on NC and global label ERCs 2020-10-21 22:14:04 -04:00
Jeff Young 16d5f95981 Meet irreflexive requirements of std::sort
Fixes https://gitlab.com/kicad/code/kicad/issues/6053
2020-10-18 21:03:01 +01:00
Jeff Young 81e1bc9df0 Keep track of driver changes so the view can be updated.
Also make renaming of nets a bit more stable.

Fixes https://gitlab.com/kicad/code/kicad/issues/6018
2020-10-17 20:40:05 +01:00
Marek Roszko 5302f7ce73 Remove kicad_string.h from eda_text.h 2020-10-14 19:18:38 -04:00
Jon Evans 61f731aa1d Fix disambiguation for vector buses with different ranges
Previously disambiguation was looking for exact matches,
but vector buses are permitted to have different ranges and
still participate in merging, so they need to be disambiguated.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5925
2020-10-08 22:26:24 -04:00
Jon Evans 8f4fba4c67 Don't deallocate absorbed SGs anymore
Now there is some code depending on access to them
outside the context of connectivity calculation...

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5928
2020-10-08 21:24:35 -04:00
Jeff Young 4565631728 Finish moving eeschema assigned netclasses to sheet-path-relative.
Also adds code for the case where a new label is created on a net
with an existing netclass assignment.

Fixes https://gitlab.com/kicad/code/kicad/issues/5886
2020-10-07 16:31:55 +01:00
Jon Evans bdb18022c0 Flag all dangling labels, not just isolated ones
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1788
2020-10-04 17:13:42 -04:00
Seth Hillbrand 02a5d47de9 Avoid passing references in EESchema
This returns the connection list by value.  This allows easier Python
use

Also renames m_End() to GetEnd()
2020-09-08 06:29:27 -07:00
Jon Evans be0aad5984 Move similar labels check to new connectivity engine 2020-08-30 15:43:16 -04:00
Jon Evans 48d7c46a53 Move pin table checks to new connectivity system 2020-08-30 15:43:16 -04:00
Jon Evans 1d2838bd92 Fix overzealous driver check that was causing false positives 2020-08-25 21:54:14 -04:00
Jon Evans d40ae3de46 ADDED: ERC check for missing hier labels for sheet ports
A subsheet may have more than one instance of a hier label,
but it's generally a mistake if there is no matching hier label
for a port on the parent sheet.

This is harder to do today now that we don't have manual tool
for placing hier ports, but it's still possible if you place
ports but then rename the label on the subsheet.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3468
2020-08-25 21:52:52 -04:00
Jon Evans 45cae6405d Improve no-connect ERC and check for floating wires
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2393
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2038
2020-08-25 18:00:16 -04:00
Jeff Young 97c34e2516 ADDED alternate pin definitions and assignments.
Fixes https://gitlab.com/kicad/code/kicad/issues/2002
2020-08-21 18:29:36 +01:00
Tomasz Wlostowski d937fadd6f Migrate RC_ITEM to use shared_ptr 2020-08-13 14:50:59 +02:00