diff --git a/src/autorouter/autorouter.rs b/src/autorouter/autorouter.rs index 70e1fc1..b0e041b 100644 --- a/src/autorouter/autorouter.rs +++ b/src/autorouter/autorouter.rs @@ -154,7 +154,9 @@ impl Autorouter { M: Clone, { self.topo_autoroute_ratlines( - self.selected_ratlines(selection, active_layer), + self.selected_ratlines(selection, active_layer) + .into_iter() + .collect(), allowed_edges, active_layer, width, @@ -264,7 +266,7 @@ impl Autorouter { &self, selection: &PinSelection, principal_layer: usize, - ) -> Vec { + ) -> BTreeSet { self.ratsnests() .on_principal_layer(principal_layer) .graph() @@ -302,7 +304,11 @@ impl Autorouter { .collect() } - fn selected_planar_ratlines(&self, selection: &PinSelection, layer: usize) -> Vec { + fn selected_planar_ratlines( + &self, + selection: &PinSelection, + layer: usize, + ) -> BTreeSet { self.selected_ratlines(selection, layer) .into_iter() .filter(|ratline| { diff --git a/src/autorouter/invoker.rs b/src/autorouter/invoker.rs index 4fb6e1f..10a3f41 100644 --- a/src/autorouter/invoker.rs +++ b/src/autorouter/invoker.rs @@ -192,7 +192,7 @@ impl Invoker { // TODO: consider "presort by pairwise detours" ExecutionStepper::TopoAutoroute(self.autorouter.topo_autoroute_ratlines( - ratlines, + ratlines.into_iter().collect(), allowed_edges.clone(), active_layer, *routed_band_width, diff --git a/src/autorouter/multilayer_preconfigurer.rs b/src/autorouter/multilayer_preconfigurer.rs index 66b8728..cfd65dd 100644 --- a/src/autorouter/multilayer_preconfigurer.rs +++ b/src/autorouter/multilayer_preconfigurer.rs @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -use std::collections::BTreeMap; +use std::collections::{BTreeMap, BTreeSet}; use derive_getters::Getters; use specctra_core::mesadata::AccessMesadata; @@ -23,7 +23,7 @@ use crate::{ #[derive(Clone, Debug)] pub struct MultilayerAutoroutePreconfigurerInput { - pub ratlines: Vec, + pub ratlines: BTreeSet, } #[derive(Getters)] @@ -50,7 +50,7 @@ impl MultilayerPreconfigurer { pub fn new_from_layer_map( autorouter: &Autorouter, - ratlines: &[RatlineUid], + ratlines: &BTreeSet, layer_map: BTreeMap, ) -> Self { let mut plan = AnterouterPlan { diff --git a/src/autorouter/multilayer_reconfigurer.rs b/src/autorouter/multilayer_reconfigurer.rs index d01d393..8f17fed 100644 --- a/src/autorouter/multilayer_reconfigurer.rs +++ b/src/autorouter/multilayer_reconfigurer.rs @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -use std::time::SystemTime; +use std::{collections::BTreeSet, time::SystemTime}; use specctra_core::mesadata::AccessMesadata; @@ -12,13 +12,13 @@ use crate::autorouter::{ }; pub struct MultilayerReconfigurer { - original_ratlines: Vec, + original_ratlines: BTreeSet, } impl MultilayerReconfigurer { pub fn new( autorouter: &Autorouter, - ratlines: Vec, + ratlines: BTreeSet, options: &MultilayerAutorouteOptions, ) -> Self { Self { diff --git a/src/autorouter/planar_preconfigurer.rs b/src/autorouter/planar_preconfigurer.rs index 20dd912..a2dfce5 100644 --- a/src/autorouter/planar_preconfigurer.rs +++ b/src/autorouter/planar_preconfigurer.rs @@ -2,6 +2,8 @@ // // SPDX-License-Identifier: MIT +use std::collections::BTreeSet; + use derive_getters::{Dissolve, Getters}; use enum_dispatch::enum_dispatch; use petgraph::algo::tarjan_scc; @@ -14,7 +16,7 @@ use crate::autorouter::{ #[derive(Clone, Debug)] pub struct PlanarAutoroutePreconfigurerInput { - pub ratlines: Vec, + pub ratlines: BTreeSet, } pub struct PresortParams { diff --git a/src/autorouter/planar_reconfigurer.rs b/src/autorouter/planar_reconfigurer.rs index ccbe7ea..b9e5215 100644 --- a/src/autorouter/planar_reconfigurer.rs +++ b/src/autorouter/planar_reconfigurer.rs @@ -39,14 +39,14 @@ pub enum PlanarAutorouteReconfigurer { impl PlanarAutorouteReconfigurer { pub fn new( autorouter: &mut Autorouter, - input_configuration: PlanarAutorouteConfiguration, + preconfiguration: PlanarAutorouteConfiguration, presorter: SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer, options: &PlanarAutorouteOptions, ) -> Self { PlanarAutorouteReconfigurer::SccPermutations( SccPermutationsPlanarAutorouteReconfigurer::new( autorouter, - input_configuration, + preconfiguration, presorter, options, ), @@ -65,7 +65,7 @@ pub struct SccPermutationsPlanarAutorouteReconfigurer { impl SccPermutationsPlanarAutorouteReconfigurer { pub fn new( _autorouter: &mut Autorouter, - input_configuration: PlanarAutorouteConfiguration, + preconfiguration: PlanarAutorouteConfiguration, presorter: SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer, _options: &PlanarAutorouteOptions, ) -> Self { @@ -76,7 +76,7 @@ impl SccPermutationsPlanarAutorouteReconfigurer { Self { sccs_permutations_iter: sccs.into_iter().permutations(sccs_len).skip(1), - initial_configuration: input_configuration, + initial_configuration: preconfiguration, } } } diff --git a/src/autorouter/scc.rs b/src/autorouter/scc.rs index 28d2e8e..c7e176e 100644 --- a/src/autorouter/scc.rs +++ b/src/autorouter/scc.rs @@ -2,6 +2,8 @@ // // SPDX-License-Identifier: MIT +use std::collections::BTreeSet; + use derive_getters::Getters; use petgraph::{graph::NodeIndex, prelude::StableUnGraph}; use specctra_core::mesadata::AccessMesadata; @@ -27,7 +29,7 @@ pub struct Scc { impl Scc { pub fn new( autorouter: &mut Autorouter, - ratlines: &[RatlineUid], + ratlines: &BTreeSet, filtered_ratsnest: &StableUnGraph, node_indices: Vec>, ) -> Self {