mirror of https://codeberg.org/topola/topola.git
fix(autorouter/autorouter): Skip translayer ratlines in planar autorouting
This prevents planar autorouting from crashing.
This commit is contained in:
parent
8f59319902
commit
3d55d1a81e
|
|
@ -18,7 +18,8 @@ use crate::{
|
||||||
ratsnests::Ratsnests,
|
ratsnests::Ratsnests,
|
||||||
},
|
},
|
||||||
board::{AccessMesadata, Board},
|
board::{AccessMesadata, Board},
|
||||||
drawing::band::BandTermsegIndex,
|
drawing::{band::BandTermsegIndex, graph::MakePrimitiveRef},
|
||||||
|
geometry::GetLayer,
|
||||||
graph::MakeRef,
|
graph::MakeRef,
|
||||||
layout::{via::ViaWeight, LayoutEdit, LayoutException},
|
layout::{via::ViaWeight, LayoutEdit, LayoutException},
|
||||||
router::{navmesh::NavmeshError, ng, thetastar::ThetastarError, RouterOptions},
|
router::{navmesh::NavmeshError, ng, thetastar::ThetastarError, RouterOptions},
|
||||||
|
|
@ -139,7 +140,7 @@ impl<M: AccessMesadata> Autorouter<M> {
|
||||||
) -> Result<PlanarAutorouteExecutionPermutator, AutorouterError> {
|
) -> Result<PlanarAutorouteExecutionPermutator, AutorouterError> {
|
||||||
PlanarAutorouteExecutionPermutator::new(
|
PlanarAutorouteExecutionPermutator::new(
|
||||||
self,
|
self,
|
||||||
self.selected_ratlines(selection, options.principal_layer),
|
self.selected_planar_ratlines(selection, options.principal_layer),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -348,6 +349,24 @@ impl<M: AccessMesadata> Autorouter<M> {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn selected_planar_ratlines(&self, selection: &PinSelection, layer: usize) -> Vec<RatlineUid> {
|
||||||
|
self.selected_ratlines(selection, layer)
|
||||||
|
.into_iter()
|
||||||
|
.filter(|ratline| {
|
||||||
|
let (endpoint_dot1, endpoint_dot2) = ratline.ref_(self).endpoint_dots();
|
||||||
|
|
||||||
|
endpoint_dot1
|
||||||
|
.primitive_ref(self.board().layout().drawing())
|
||||||
|
.layer()
|
||||||
|
== layer
|
||||||
|
&& endpoint_dot2
|
||||||
|
.primitive_ref(self.board().layout().drawing())
|
||||||
|
.layer()
|
||||||
|
== layer
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
fn find_selected_ratvertex(
|
fn find_selected_ratvertex(
|
||||||
&self,
|
&self,
|
||||||
selection: &PinSelection,
|
selection: &PinSelection,
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ impl PlanarAutorouteExecutionPermutator {
|
||||||
intersector_count_weight: 1.0,
|
intersector_count_weight: 1.0,
|
||||||
length_weight: 0.001,
|
length_weight: 0.001,
|
||||||
},
|
},
|
||||||
|
&options,
|
||||||
);
|
);
|
||||||
let initially_sorted_ratlines = presorter.presort_ratlines(autorouter, &ratlines);
|
let initially_sorted_ratlines = presorter.presort_ratlines(autorouter, &ratlines);
|
||||||
/*let permuter = RatlinesPermuter::SccPermutations(SccPermutationsRatlinePermuter::new(
|
/*let permuter = RatlinesPermuter::SccPermutations(SccPermutationsRatlinePermuter::new(
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use enum_dispatch::enum_dispatch;
|
||||||
use petgraph::algo::tarjan_scc;
|
use petgraph::algo::tarjan_scc;
|
||||||
use specctra_core::mesadata::AccessMesadata;
|
use specctra_core::mesadata::AccessMesadata;
|
||||||
|
|
||||||
use crate::autorouter::{ratline::RatlineUid, scc::Scc, Autorouter};
|
use crate::autorouter::{ratline::RatlineUid, scc::Scc, Autorouter, PlanarAutorouteOptions};
|
||||||
|
|
||||||
pub struct PresortParams {
|
pub struct PresortParams {
|
||||||
pub intersector_count_weight: f64,
|
pub intersector_count_weight: f64,
|
||||||
|
|
@ -38,11 +38,12 @@ impl SccIntersectionsAndLengthPresorter {
|
||||||
autorouter: &mut Autorouter<impl AccessMesadata>,
|
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
ratlines: &[RatlineUid],
|
ratlines: &[RatlineUid],
|
||||||
params: &PresortParams,
|
params: &PresortParams,
|
||||||
|
options: &PlanarAutorouteOptions,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// FIXME: Unnecessary copy.
|
// FIXME: Unnecessary copy.
|
||||||
let mut filtered_ratsnest = autorouter
|
let mut filtered_ratsnest = autorouter
|
||||||
.ratsnests()
|
.ratsnests()
|
||||||
.on_principal_layer(ratlines[0].principal_layer)
|
.on_principal_layer(options.principal_layer)
|
||||||
.graph()
|
.graph()
|
||||||
.clone();
|
.clone();
|
||||||
filtered_ratsnest.retain_edges(|_g, i| ratlines.iter().any(|ratline| ratline.index == i));
|
filtered_ratsnest.retain_edges(|_g, i| ratlines.iter().any(|ratline| ratline.index == i));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue