Browse Source

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
6.0.7
Jon Evans 5 years ago
parent
commit
b90e72ed07
  1. 16
      eeschema/connection_graph.cpp
  2. 4
      qa/data/complex_hierarchy.kicad_prl
  3. 4
      qa/data/complex_hierarchy.kicad_pro
  4. 18
      qa/eeschema/data/netlists/test_global_promotion_2/test_global_promotion_2.net
  5. 532
      qa/eeschema/data/netlists/video/video.net
  6. 18
      qa/eeschema/data/netlists/weak_vector_bus_disambiguation/weak_vector_bus_disambiguation.net

16
eeschema/connection_graph.cpp

@ -1806,6 +1806,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
CONNECTION_SUBGRAPH* driver = aSubgraph;
CONNECTION_SUBGRAPH::PRIORITY highest =
CONNECTION_SUBGRAPH::GetDriverPriority( aSubgraph->m_driver );
bool originalStrong = ( highest >= CONNECTION_SUBGRAPH::PRIORITY::HIER_LABEL );
// Check if a subsheet has a higher-priority connection to the same net
if( highest < CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN )
@ -1815,13 +1816,20 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
CONNECTION_SUBGRAPH::PRIORITY priority =
CONNECTION_SUBGRAPH::GetDriverPriority( subgraph->m_driver );
// Upgrade driver to be this subgraph if this subgraph has a power pin or global
// Also upgrade if we found something with a shorter sheet path (higher in hierarchy)
// but with an equivalent priority
bool candidateStrong = ( priority >= CONNECTION_SUBGRAPH::PRIORITY::HIER_LABEL );
// Pick a better driving subgraph if it:
// a) has a power pin or global driver
// b) is a strong driver and we're a weak driver
// c) meets or exceeds our priority, is a strong driver, and has a shorter path
if( ( priority >= CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN ) ||
( priority >= highest && subgraph->m_sheet.size() < aSubgraph->m_sheet.size() ) )
( !originalStrong && candidateStrong ) ||
( priority >= highest && candidateStrong &&
subgraph->m_sheet.size() < aSubgraph->m_sheet.size() ) )
{
driver = subgraph;
}
}
}

4
qa/data/complex_hierarchy.kicad_prl

@ -2,6 +2,7 @@
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": true,
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
@ -60,7 +61,8 @@
37,
38
],
"visible_layers": "007ffff_ffffffff"
"visible_layers": "007ffff_ffffffff",
"zone_display_mode": 0
},
"meta": {
"filename": "complex_hierarchy.kicad_prl",

4
qa/data/complex_hierarchy.kicad_pro

@ -66,7 +66,7 @@
"courtyards_overlap": "error",
"diff_pair_gap_out_of_range": "error",
"diff_pair_uncoupled_length_too_long": "error",
"drill_too_small": "error",
"drill_out_of_range": "error",
"duplicate_footprints": "warning",
"extra_footprint": "warning",
"hole_clearance": "error",
@ -76,7 +76,7 @@
"items_not_allowed": "error",
"length_out_of_range": "error",
"malformed_courtyard": "error",
"microvia_drill_too_small": "error",
"microvia_drill_out_of_range": "error",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",

18
qa/eeschema/data/netlists/test_global_promotion_2/test_global_promotion_2.net

@ -120,21 +120,21 @@
(pin (num "2") (name "~") (type "passive")))))
(libraries)
(nets
(net (code "1") (name "/LIVE")
(node (ref "J2") (pin "1") (pinfunction "Pin_1"))
(node (ref "R1") (pin "1"))
(node (ref "R2") (pin "1")))
(net (code "2") (name "/LIVE_1")
(node (ref "J1") (pin "2") (pinfunction "Pin_2"))
(node (ref "R4") (pin "2")))
(net (code "3") (name "/LIVE_2")
(net (code "1") (name "/LIVE_2")
(node (ref "J2") (pin "2") (pinfunction "Pin_2"))
(node (ref "R3") (pin "1"))
(node (ref "R4") (pin "1")))
(net (code "4") (name "/NEUTRAL")
(net (code "2") (name "/Sheet5CC15EF8/LIVE")
(node (ref "J2") (pin "1") (pinfunction "Pin_1"))
(node (ref "R1") (pin "1"))
(node (ref "R2") (pin "1")))
(net (code "3") (name "/Sheet5CC15EF8/NEUTRAL")
(node (ref "J2") (pin "3") (pinfunction "Pin_3"))
(node (ref "R1") (pin "2"))
(node (ref "R3") (pin "2")))
(net (code "4") (name "/sheet5CC165F1/LIVE_1")
(node (ref "J1") (pin "2") (pinfunction "Pin_2"))
(node (ref "R4") (pin "2")))
(net (code "5") (name "LIVE")
(node (ref "J1") (pin "1") (pinfunction "Pin_1"))
(node (ref "R2") (pin "2")))

532
qa/eeschema/data/netlists/video/video.net
File diff suppressed because it is too large
View File

18
qa/eeschema/data/netlists/weak_vector_bus_disambiguation/weak_vector_bus_disambiguation.net

@ -117,15 +117,15 @@
(library (logical "Device")
(uri "/home/jon/kicad-library/kicad-symbols//Device.kicad_sym")))
(nets
(net (code "1") (name "/B1")
(node (ref "R2") (pin "1"))
(node (ref "R4") (pin "1")))
(net (code "2") (name "/B1_1")
(net (code "1") (name "/Merge/A1")
(node (ref "R1") (pin "1"))
(node (ref "R3") (pin "1")))
(net (code "3") (name "/B2")
(node (ref "R2") (pin "2"))
(node (ref "R4") (pin "2")))
(net (code "4") (name "/B2_1")
(net (code "2") (name "/Merge/A2")
(node (ref "R1") (pin "2"))
(node (ref "R3") (pin "2")))))
(node (ref "R3") (pin "2")))
(net (code "3") (name "/Sub2/B1")
(node (ref "R2") (pin "1"))
(node (ref "R4") (pin "1")))
(net (code "4") (name "/Sub2/B2")
(node (ref "R2") (pin "2"))
(node (ref "R4") (pin "2")))))
Loading…
Cancel
Save