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,
|
||||
{
|
||||
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<M: AccessMesadata> Autorouter<M> {
|
|||
&self,
|
||||
selection: &PinSelection,
|
||||
principal_layer: usize,
|
||||
) -> Vec<RatlineUid> {
|
||||
) -> BTreeSet<RatlineUid> {
|
||||
self.ratsnests()
|
||||
.on_principal_layer(principal_layer)
|
||||
.graph()
|
||||
|
|
@ -302,7 +304,11 @@ impl<M: AccessMesadata> Autorouter<M> {
|
|||
.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)
|
||||
.into_iter()
|
||||
.filter(|ratline| {
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ impl<M: AccessMesadata + Clone> Invoker<M> {
|
|||
// 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,
|
||||
|
|
|
|||
|
|
@ -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<RatlineUid>,
|
||||
pub ratlines: BTreeSet<RatlineUid>,
|
||||
}
|
||||
|
||||
#[derive(Getters)]
|
||||
|
|
@ -50,7 +50,7 @@ impl MultilayerPreconfigurer {
|
|||
|
||||
pub fn new_from_layer_map(
|
||||
autorouter: &Autorouter<impl AccessMesadata>,
|
||||
ratlines: &[RatlineUid],
|
||||
ratlines: &BTreeSet<RatlineUid>,
|
||||
layer_map: BTreeMap<RatlineUid, usize>,
|
||||
) -> Self {
|
||||
let mut plan = AnterouterPlan {
|
||||
|
|
|
|||
|
|
@ -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<RatlineUid>,
|
||||
original_ratlines: BTreeSet<RatlineUid>,
|
||||
}
|
||||
|
||||
impl MultilayerReconfigurer {
|
||||
pub fn new(
|
||||
autorouter: &Autorouter<impl AccessMesadata>,
|
||||
ratlines: Vec<RatlineUid>,
|
||||
ratlines: BTreeSet<RatlineUid>,
|
||||
options: &MultilayerAutorouteOptions,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -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<RatlineUid>,
|
||||
pub ratlines: BTreeSet<RatlineUid>,
|
||||
}
|
||||
|
||||
pub struct PresortParams {
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ pub enum PlanarAutorouteReconfigurer {
|
|||
impl PlanarAutorouteReconfigurer {
|
||||
pub fn new(
|
||||
autorouter: &mut Autorouter<impl AccessMesadata>,
|
||||
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<impl AccessMesadata>,
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<impl AccessMesadata>,
|
||||
ratlines: &[RatlineUid],
|
||||
ratlines: &BTreeSet<RatlineUid>,
|
||||
filtered_ratsnest: &StableUnGraph<RatvertexWeight, RatlineWeight, usize>,
|
||||
node_indices: Vec<NodeIndex<usize>>,
|
||||
) -> Self {
|
||||
|
|
|
|||
Loading…
Reference in New Issue