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
This commit is contained in:
parent
24ff66f5a2
commit
b90e72ed07
|
@ -1806,6 +1806,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
|
||||||
CONNECTION_SUBGRAPH* driver = aSubgraph;
|
CONNECTION_SUBGRAPH* driver = aSubgraph;
|
||||||
CONNECTION_SUBGRAPH::PRIORITY highest =
|
CONNECTION_SUBGRAPH::PRIORITY highest =
|
||||||
CONNECTION_SUBGRAPH::GetDriverPriority( aSubgraph->m_driver );
|
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
|
// Check if a subsheet has a higher-priority connection to the same net
|
||||||
if( highest < CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN )
|
if( highest < CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN )
|
||||||
|
@ -1815,13 +1816,20 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
|
||||||
CONNECTION_SUBGRAPH::PRIORITY priority =
|
CONNECTION_SUBGRAPH::PRIORITY priority =
|
||||||
CONNECTION_SUBGRAPH::GetDriverPriority( subgraph->m_driver );
|
CONNECTION_SUBGRAPH::GetDriverPriority( subgraph->m_driver );
|
||||||
|
|
||||||
// Upgrade driver to be this subgraph if this subgraph has a power pin or global
|
bool candidateStrong = ( priority >= CONNECTION_SUBGRAPH::PRIORITY::HIER_LABEL );
|
||||||
// Also upgrade if we found something with a shorter sheet path (higher in hierarchy)
|
|
||||||
// but with an equivalent priority
|
// 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 ) ||
|
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;
|
driver = subgraph;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"board": {
|
"board": {
|
||||||
"active_layer": 0,
|
"active_layer": 0,
|
||||||
"active_layer_preset": "",
|
"active_layer_preset": "",
|
||||||
|
"auto_track_width": true,
|
||||||
"hidden_nets": [],
|
"hidden_nets": [],
|
||||||
"high_contrast_mode": 0,
|
"high_contrast_mode": 0,
|
||||||
"net_color_mode": 1,
|
"net_color_mode": 1,
|
||||||
|
@ -60,7 +61,8 @@
|
||||||
37,
|
37,
|
||||||
38
|
38
|
||||||
],
|
],
|
||||||
"visible_layers": "007ffff_ffffffff"
|
"visible_layers": "007ffff_ffffffff",
|
||||||
|
"zone_display_mode": 0
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"filename": "complex_hierarchy.kicad_prl",
|
"filename": "complex_hierarchy.kicad_prl",
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
"courtyards_overlap": "error",
|
"courtyards_overlap": "error",
|
||||||
"diff_pair_gap_out_of_range": "error",
|
"diff_pair_gap_out_of_range": "error",
|
||||||
"diff_pair_uncoupled_length_too_long": "error",
|
"diff_pair_uncoupled_length_too_long": "error",
|
||||||
"drill_too_small": "error",
|
"drill_out_of_range": "error",
|
||||||
"duplicate_footprints": "warning",
|
"duplicate_footprints": "warning",
|
||||||
"extra_footprint": "warning",
|
"extra_footprint": "warning",
|
||||||
"hole_clearance": "error",
|
"hole_clearance": "error",
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
"items_not_allowed": "error",
|
"items_not_allowed": "error",
|
||||||
"length_out_of_range": "error",
|
"length_out_of_range": "error",
|
||||||
"malformed_courtyard": "error",
|
"malformed_courtyard": "error",
|
||||||
"microvia_drill_too_small": "error",
|
"microvia_drill_out_of_range": "error",
|
||||||
"missing_courtyard": "ignore",
|
"missing_courtyard": "ignore",
|
||||||
"missing_footprint": "warning",
|
"missing_footprint": "warning",
|
||||||
"net_conflict": "warning",
|
"net_conflict": "warning",
|
||||||
|
|
|
@ -120,21 +120,21 @@
|
||||||
(pin (num "2") (name "~") (type "passive")))))
|
(pin (num "2") (name "~") (type "passive")))))
|
||||||
(libraries)
|
(libraries)
|
||||||
(nets
|
(nets
|
||||||
(net (code "1") (name "/LIVE")
|
(net (code "1") (name "/LIVE_2")
|
||||||
(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")
|
|
||||||
(node (ref "J2") (pin "2") (pinfunction "Pin_2"))
|
(node (ref "J2") (pin "2") (pinfunction "Pin_2"))
|
||||||
(node (ref "R3") (pin "1"))
|
(node (ref "R3") (pin "1"))
|
||||||
(node (ref "R4") (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 "J2") (pin "3") (pinfunction "Pin_3"))
|
||||||
(node (ref "R1") (pin "2"))
|
(node (ref "R1") (pin "2"))
|
||||||
(node (ref "R3") (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")
|
(net (code "5") (name "LIVE")
|
||||||
(node (ref "J1") (pin "1") (pinfunction "Pin_1"))
|
(node (ref "J1") (pin "1") (pinfunction "Pin_1"))
|
||||||
(node (ref "R2") (pin "2")))
|
(node (ref "R2") (pin "2")))
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -117,15 +117,15 @@
|
||||||
(library (logical "Device")
|
(library (logical "Device")
|
||||||
(uri "/home/jon/kicad-library/kicad-symbols//Device.kicad_sym")))
|
(uri "/home/jon/kicad-library/kicad-symbols//Device.kicad_sym")))
|
||||||
(nets
|
(nets
|
||||||
(net (code "1") (name "/B1")
|
(net (code "1") (name "/Merge/A1")
|
||||||
(node (ref "R2") (pin "1"))
|
|
||||||
(node (ref "R4") (pin "1")))
|
|
||||||
(net (code "2") (name "/B1_1")
|
|
||||||
(node (ref "R1") (pin "1"))
|
(node (ref "R1") (pin "1"))
|
||||||
(node (ref "R3") (pin "1")))
|
(node (ref "R3") (pin "1")))
|
||||||
(net (code "3") (name "/B2")
|
(net (code "2") (name "/Merge/A2")
|
||||||
(node (ref "R2") (pin "2"))
|
|
||||||
(node (ref "R4") (pin "2")))
|
|
||||||
(net (code "4") (name "/B2_1")
|
|
||||||
(node (ref "R1") (pin "2"))
|
(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…
Reference in New Issue