mirror of https://codeberg.org/topola/topola.git
refactor(autorouter/autorouter): Store ratlines in `BTreeSet` before ordering
This makes the purpose of the preconfiguration step clearer.
This commit is contained in:
parent
5c39bd60de
commit
8d0e524f75
|
|
@ -154,7 +154,9 @@ impl<M: AccessMesadata> Autorouter<M> {
|
||||||
M: Clone,
|
M: Clone,
|
||||||
{
|
{
|
||||||
self.topo_autoroute_ratlines(
|
self.topo_autoroute_ratlines(
|
||||||
self.selected_ratlines(selection, active_layer),
|
self.selected_ratlines(selection, active_layer)
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
allowed_edges,
|
allowed_edges,
|
||||||
active_layer,
|
active_layer,
|
||||||
width,
|
width,
|
||||||
|
|
@ -264,7 +266,7 @@ impl<M: AccessMesadata> Autorouter<M> {
|
||||||
&self,
|
&self,
|
||||||
selection: &PinSelection,
|
selection: &PinSelection,
|
||||||
principal_layer: usize,
|
principal_layer: usize,
|
||||||
) -> Vec<RatlineUid> {
|
) -> BTreeSet<RatlineUid> {
|
||||||
self.ratsnests()
|
self.ratsnests()
|
||||||
.on_principal_layer(principal_layer)
|
.on_principal_layer(principal_layer)
|
||||||
.graph()
|
.graph()
|
||||||
|
|
@ -302,7 +304,11 @@ impl<M: AccessMesadata> Autorouter<M> {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn selected_planar_ratlines(&self, selection: &PinSelection, layer: usize) -> Vec<RatlineUid> {
|
fn selected_planar_ratlines(
|
||||||
|
&self,
|
||||||
|
selection: &PinSelection,
|
||||||
|
layer: usize,
|
||||||
|
) -> BTreeSet<RatlineUid> {
|
||||||
self.selected_ratlines(selection, layer)
|
self.selected_ratlines(selection, layer)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|ratline| {
|
.filter(|ratline| {
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ impl<M: AccessMesadata + Clone> Invoker<M> {
|
||||||
// TODO: consider "presort by pairwise detours"
|
// TODO: consider "presort by pairwise detours"
|
||||||
|
|
||||||
ExecutionStepper::TopoAutoroute(self.autorouter.topo_autoroute_ratlines(
|
ExecutionStepper::TopoAutoroute(self.autorouter.topo_autoroute_ratlines(
|
||||||
ratlines,
|
ratlines.into_iter().collect(),
|
||||||
allowed_edges.clone(),
|
allowed_edges.clone(),
|
||||||
active_layer,
|
active_layer,
|
||||||
*routed_band_width,
|
*routed_band_width,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
|
||||||
use derive_getters::Getters;
|
use derive_getters::Getters;
|
||||||
use specctra_core::mesadata::AccessMesadata;
|
use specctra_core::mesadata::AccessMesadata;
|
||||||
|
|
@ -23,7 +23,7 @@ use crate::{
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct MultilayerAutoroutePreconfigurerInput {
|
pub struct MultilayerAutoroutePreconfigurerInput {
|
||||||
pub ratlines: Vec<RatlineUid>,
|
pub ratlines: BTreeSet<RatlineUid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Getters)]
|
#[derive(Getters)]
|
||||||
|
|
@ -50,7 +50,7 @@ impl MultilayerPreconfigurer {
|
||||||
|
|
||||||
pub fn new_from_layer_map(
|
pub fn new_from_layer_map(
|
||||||
autorouter: &Autorouter<impl AccessMesadata>,
|
autorouter: &Autorouter<impl AccessMesadata>,
|
||||||
ratlines: &[RatlineUid],
|
ratlines: &BTreeSet<RatlineUid>,
|
||||||
layer_map: BTreeMap<RatlineUid, usize>,
|
layer_map: BTreeMap<RatlineUid, usize>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut plan = AnterouterPlan {
|
let mut plan = AnterouterPlan {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
use std::time::SystemTime;
|
use std::{collections::BTreeSet, time::SystemTime};
|
||||||
|
|
||||||
use specctra_core::mesadata::AccessMesadata;
|
use specctra_core::mesadata::AccessMesadata;
|
||||||
|
|
||||||
|
|
@ -12,13 +12,13 @@ use crate::autorouter::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct MultilayerReconfigurer {
|
pub struct MultilayerReconfigurer {
|
||||||
original_ratlines: Vec<RatlineUid>,
|
original_ratlines: BTreeSet<RatlineUid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MultilayerReconfigurer {
|
impl MultilayerReconfigurer {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
autorouter: &Autorouter<impl AccessMesadata>,
|
autorouter: &Autorouter<impl AccessMesadata>,
|
||||||
ratlines: Vec<RatlineUid>,
|
ratlines: BTreeSet<RatlineUid>,
|
||||||
options: &MultilayerAutorouteOptions,
|
options: &MultilayerAutorouteOptions,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
use derive_getters::{Dissolve, Getters};
|
use derive_getters::{Dissolve, Getters};
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use petgraph::algo::tarjan_scc;
|
use petgraph::algo::tarjan_scc;
|
||||||
|
|
@ -14,7 +16,7 @@ use crate::autorouter::{
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct PlanarAutoroutePreconfigurerInput {
|
pub struct PlanarAutoroutePreconfigurerInput {
|
||||||
pub ratlines: Vec<RatlineUid>,
|
pub ratlines: BTreeSet<RatlineUid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PresortParams {
|
pub struct PresortParams {
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,14 @@ pub enum PlanarAutorouteReconfigurer {
|
||||||
impl PlanarAutorouteReconfigurer {
|
impl PlanarAutorouteReconfigurer {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
autorouter: &mut Autorouter<impl AccessMesadata>,
|
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
input_configuration: PlanarAutorouteConfiguration,
|
preconfiguration: PlanarAutorouteConfiguration,
|
||||||
presorter: SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer,
|
presorter: SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer,
|
||||||
options: &PlanarAutorouteOptions,
|
options: &PlanarAutorouteOptions,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
PlanarAutorouteReconfigurer::SccPermutations(
|
PlanarAutorouteReconfigurer::SccPermutations(
|
||||||
SccPermutationsPlanarAutorouteReconfigurer::new(
|
SccPermutationsPlanarAutorouteReconfigurer::new(
|
||||||
autorouter,
|
autorouter,
|
||||||
input_configuration,
|
preconfiguration,
|
||||||
presorter,
|
presorter,
|
||||||
options,
|
options,
|
||||||
),
|
),
|
||||||
|
|
@ -65,7 +65,7 @@ pub struct SccPermutationsPlanarAutorouteReconfigurer {
|
||||||
impl SccPermutationsPlanarAutorouteReconfigurer {
|
impl SccPermutationsPlanarAutorouteReconfigurer {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
_autorouter: &mut Autorouter<impl AccessMesadata>,
|
_autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
input_configuration: PlanarAutorouteConfiguration,
|
preconfiguration: PlanarAutorouteConfiguration,
|
||||||
presorter: SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer,
|
presorter: SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer,
|
||||||
_options: &PlanarAutorouteOptions,
|
_options: &PlanarAutorouteOptions,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
@ -76,7 +76,7 @@ impl SccPermutationsPlanarAutorouteReconfigurer {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
sccs_permutations_iter: sccs.into_iter().permutations(sccs_len).skip(1),
|
sccs_permutations_iter: sccs.into_iter().permutations(sccs_len).skip(1),
|
||||||
initial_configuration: input_configuration,
|
initial_configuration: preconfiguration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
use derive_getters::Getters;
|
use derive_getters::Getters;
|
||||||
use petgraph::{graph::NodeIndex, prelude::StableUnGraph};
|
use petgraph::{graph::NodeIndex, prelude::StableUnGraph};
|
||||||
use specctra_core::mesadata::AccessMesadata;
|
use specctra_core::mesadata::AccessMesadata;
|
||||||
|
|
@ -27,7 +29,7 @@ pub struct Scc {
|
||||||
impl Scc {
|
impl Scc {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
autorouter: &mut Autorouter<impl AccessMesadata>,
|
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||||
ratlines: &[RatlineUid],
|
ratlines: &BTreeSet<RatlineUid>,
|
||||||
filtered_ratsnest: &StableUnGraph<RatvertexWeight, RatlineWeight, usize>,
|
filtered_ratsnest: &StableUnGraph<RatvertexWeight, RatlineWeight, usize>,
|
||||||
node_indices: Vec<NodeIndex<usize>>,
|
node_indices: Vec<NodeIndex<usize>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue