mirror of https://codeberg.org/topola/topola.git
cleanup: cargo fix, cargo fmt
This commit is contained in:
parent
6d66558a72
commit
cff6b5aaf6
|
|
@ -1,14 +1,4 @@
|
||||||
use std::{
|
use petgraph::graph::EdgeIndex;
|
||||||
collections::HashSet,
|
|
||||||
iter::Peekable,
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
};
|
|
||||||
|
|
||||||
use geo::Point;
|
|
||||||
use petgraph::{
|
|
||||||
graph::{EdgeIndex, EdgeIndices},
|
|
||||||
visit::{EdgeRef, IntoEdgeReferences},
|
|
||||||
};
|
|
||||||
use spade::InsertionError;
|
use spade::InsertionError;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
|
@ -20,17 +10,9 @@ use crate::{
|
||||||
selection::Selection,
|
selection::Selection,
|
||||||
},
|
},
|
||||||
board::{mesadata::MesadataTrait, Board},
|
board::{mesadata::MesadataTrait, Board},
|
||||||
drawing::{
|
drawing::{dot::FixedDotIndex, Infringement},
|
||||||
dot::FixedDotIndex,
|
layout::via::ViaWeight,
|
||||||
graph::{GetLayer, GetMaybeNet},
|
router::{navmesh::NavmeshError, RouterError, RouterObserverTrait},
|
||||||
Infringement,
|
|
||||||
},
|
|
||||||
layout::{via::ViaWeight, Layout},
|
|
||||||
math::Circle,
|
|
||||||
router::{
|
|
||||||
navmesh::{Navmesh, NavmeshError},
|
|
||||||
Router, RouterError, RouterObserverTrait,
|
|
||||||
},
|
|
||||||
triangulation::GetTrianvertexIndex,
|
triangulation::GetTrianvertexIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
use geo::Point;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
autorouter::{Autorouter, AutorouterError},
|
autorouter::{Autorouter, AutorouterError},
|
||||||
board::mesadata::MesadataTrait,
|
board::mesadata::MesadataTrait,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
use petgraph::{
|
use petgraph::{
|
||||||
data::{Element, FromElements},
|
data::Element,
|
||||||
graph::{EdgeIndex, NodeIndex, UnGraph},
|
graph::{EdgeIndex, NodeIndex, UnGraph},
|
||||||
unionfind::UnionFind,
|
unionfind::UnionFind,
|
||||||
visit::{EdgeRef, IntoEdgeReferences, NodeIndexable},
|
visit::{EdgeRef, IntoEdgeReferences, NodeIndexable},
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
board::{mesadata::MesadataTrait, Board},
|
board::{mesadata::MesadataTrait, Board},
|
||||||
drawing::graph::{GetLayer, MakePrimitive, PrimitiveIndex},
|
drawing::graph::{GetLayer, MakePrimitive},
|
||||||
geometry::compound::CompoundManagerTrait,
|
geometry::compound::CompoundManagerTrait,
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::{zone::ZoneWeight, CompoundWeight, NodeIndex},
|
layout::{zone::ZoneWeight, CompoundWeight, NodeIndex},
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@ use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
band::BandIndex,
|
band::BandIndex,
|
||||||
dot::{FixedDotIndex, FixedDotWeight},
|
dot::{FixedDotIndex, FixedDotWeight},
|
||||||
graph::{GetLayer, GetMaybeNet, PrimitiveIndex},
|
graph::{GetLayer, GetMaybeNet},
|
||||||
seg::{FixedSegIndex, FixedSegWeight},
|
seg::{FixedSegIndex, FixedSegWeight},
|
||||||
Infringement,
|
|
||||||
},
|
},
|
||||||
geometry::{shape::ShapeTrait, GenericNode},
|
geometry::{shape::ShapeTrait, GenericNode},
|
||||||
graph::GenericIndex,
|
graph::GenericIndex,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::{drawing::rules::RulesTrait, layout::NodeIndex};
|
use crate::drawing::rules::RulesTrait;
|
||||||
|
|
||||||
pub trait MesadataTrait: RulesTrait {
|
pub trait MesadataTrait: RulesTrait {
|
||||||
fn bename_layer(&mut self, layer: u64, layername: String);
|
fn bename_layer(&mut self, layer: u64, layername: String);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use contracts::debug_ensures;
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
|
|
||||||
use rstar::{RTree, RTreeObject, AABB};
|
use rstar::{RTree, AABB};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::drawing::{
|
use crate::drawing::{
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,8 @@ use crate::{
|
||||||
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
bend::{BendIndex, FixedBendWeight, LooseBendIndex, LooseBendWeight},
|
||||||
dot::{DotIndex, DotWeight, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, DotWeight, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
graph::{GetLayer, GetMaybeNet, PrimitiveIndex, PrimitiveWeight, Retag},
|
graph::{GetLayer, GetMaybeNet, PrimitiveIndex, PrimitiveWeight, Retag},
|
||||||
loose::LooseIndex,
|
|
||||||
rules::{Conditions, GetConditions, RulesTrait},
|
rules::{Conditions, GetConditions, RulesTrait},
|
||||||
seg::{
|
seg::{FixedSegWeight, LoneLooseSegWeight, SegIndex, SeqLooseSegIndex, SeqLooseSegWeight},
|
||||||
FixedSegWeight, LoneLooseSegIndex, LoneLooseSegWeight, SegIndex, SeqLooseSegIndex,
|
|
||||||
SeqLooseSegWeight,
|
|
||||||
},
|
|
||||||
Drawing,
|
Drawing,
|
||||||
},
|
},
|
||||||
geometry::GenericNode,
|
geometry::GenericNode,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
use dsn_derive::ReadDsn;
|
use super::read::ParseError;
|
||||||
|
|
||||||
use super::structure2::*;
|
|
||||||
use super::read::{ListTokenizer, ReadDsn, ParseError};
|
|
||||||
use super::write::{ListWriter, WriteDsn};
|
|
||||||
|
|
||||||
pub enum ListToken {
|
pub enum ListToken {
|
||||||
Start { name: String },
|
Start { name: String },
|
||||||
|
|
@ -55,4 +51,3 @@ impl ListToken {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use geo::{point, Point, Rotate, Translate};
|
use geo::{point, Point, Rotate};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -11,8 +11,6 @@ use crate::{
|
||||||
mesadata::DsnMesadata,
|
mesadata::DsnMesadata,
|
||||||
structure::{self, DsnFile, Layer, Pcb, Shape},
|
structure::{self, DsnFile, Layer, Pcb, Shape},
|
||||||
},
|
},
|
||||||
geometry::compound::CompoundManagerTrait,
|
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
|
||||||
layout::{zone::SolidZoneWeight, Layout},
|
layout::{zone::SolidZoneWeight, Layout},
|
||||||
math::Circle,
|
math::Circle,
|
||||||
};
|
};
|
||||||
|
|
@ -32,12 +30,11 @@ pub struct DsnDesign {
|
||||||
|
|
||||||
impl DsnDesign {
|
impl DsnDesign {
|
||||||
pub fn load_from_file(filename: &str) -> Result<Self, LoadingError> {
|
pub fn load_from_file(filename: &str) -> Result<Self, LoadingError> {
|
||||||
|
|
||||||
let file = std::fs::File::open(filename)?;
|
let file = std::fs::File::open(filename)?;
|
||||||
let reader = std::io::BufReader::new(file);
|
let reader = std::io::BufReader::new(file);
|
||||||
let mut list_reader = super::read::ListTokenizer::new(reader);
|
let mut list_reader = super::read::ListTokenizer::new(reader);
|
||||||
|
|
||||||
let mut dsn = list_reader.read_value::<super::structure2::DsnFile>();
|
let dsn = list_reader.read_value::<super::structure2::DsnFile>();
|
||||||
|
|
||||||
// TODO: make_board() still uses the old version of structure.rs
|
// TODO: make_board() still uses the old version of structure.rs
|
||||||
// so we can't pass the data to topola for real
|
// so we can't pass the data to topola for real
|
||||||
|
|
@ -62,22 +59,28 @@ impl DsnDesign {
|
||||||
if let Some(net) = net_outs.get_mut(&wire.net) {
|
if let Some(net) = net_outs.get_mut(&wire.net) {
|
||||||
net.wire.push(wire);
|
net.wire.push(wire);
|
||||||
} else {
|
} else {
|
||||||
net_outs.insert(wire.net.clone(), NetOut {
|
net_outs.insert(
|
||||||
|
wire.net.clone(),
|
||||||
|
NetOut {
|
||||||
name: wire.net.clone(),
|
name: wire.net.clone(),
|
||||||
wire: vec!(wire),
|
wire: vec![wire],
|
||||||
via: Vec::new()
|
via: Vec::new(),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for via in dsn.pcb.wiring.vias {
|
for via in dsn.pcb.wiring.vias {
|
||||||
if let Some(net) = net_outs.get_mut(&via.net) {
|
if let Some(net) = net_outs.get_mut(&via.net) {
|
||||||
net.via.push(via);
|
net.via.push(via);
|
||||||
} else {
|
} else {
|
||||||
net_outs.insert(via.net.clone(), NetOut {
|
net_outs.insert(
|
||||||
|
via.net.clone(),
|
||||||
|
NetOut {
|
||||||
name: via.net.clone(),
|
name: via.net.clone(),
|
||||||
wire: Vec::new(),
|
wire: Vec::new(),
|
||||||
via: vec!(via)
|
via: vec![via],
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +92,7 @@ impl DsnDesign {
|
||||||
resolution: Resolution {
|
resolution: Resolution {
|
||||||
unit: "um".into(),
|
unit: "um".into(),
|
||||||
// TODO: why does resolution need to be adjusted from what was imported?
|
// TODO: why does resolution need to be adjusted from what was imported?
|
||||||
value: 1.0
|
value: 1.0,
|
||||||
},
|
},
|
||||||
library_out: Library {
|
library_out: Library {
|
||||||
images: Vec::new(),
|
images: Vec::new(),
|
||||||
|
|
@ -98,8 +101,8 @@ impl DsnDesign {
|
||||||
network_out: NetworkOut {
|
network_out: NetworkOut {
|
||||||
net: net_outs.into_values().collect(),
|
net: net_outs.into_values().collect(),
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("{:?}", list_writer.write_value(&ses));
|
println!("{:?}", list_writer.write_value(&ses));
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
mod common;
|
||||||
mod de;
|
mod de;
|
||||||
pub mod design;
|
pub mod design;
|
||||||
pub mod mesadata;
|
pub mod mesadata;
|
||||||
mod structure;
|
|
||||||
mod common;
|
|
||||||
mod structure2;
|
|
||||||
mod read;
|
mod read;
|
||||||
|
mod structure;
|
||||||
|
mod structure2;
|
||||||
mod write;
|
mod write;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use thiserror::Error;
|
|
||||||
use utf8_chars::BufReadCharsExt;
|
|
||||||
use super::common::ListToken;
|
use super::common::ListToken;
|
||||||
use super::structure2::Parser;
|
use super::structure2::Parser;
|
||||||
|
use thiserror::Error;
|
||||||
|
use utf8_chars::BufReadCharsExt;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
|
|
@ -34,7 +34,6 @@ impl<R: std::io::BufRead> ReadDsn<R> for Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<R: std::io::BufRead> ReadDsn<R> for String {
|
impl<R: std::io::BufRead> ReadDsn<R> for String {
|
||||||
fn read_dsn(tokenizer: &mut ListTokenizer<R>) -> Result<Self, ParseError> {
|
fn read_dsn(tokenizer: &mut ListTokenizer<R>) -> Result<Self, ParseError> {
|
||||||
Ok(tokenizer.consume_token()?.expect_leaf()?)
|
Ok(tokenizer.consume_token()?.expect_leaf()?)
|
||||||
|
|
@ -236,12 +235,16 @@ impl<R: std::io::BufRead> ListTokenizer<R> {
|
||||||
Ok(if chr == '(' {
|
Ok(if chr == '(' {
|
||||||
self.next_char().unwrap();
|
self.next_char().unwrap();
|
||||||
self.skip_whitespace()?;
|
self.skip_whitespace()?;
|
||||||
ListToken::Start { name: self.read_string()? }
|
ListToken::Start {
|
||||||
|
name: self.read_string()?,
|
||||||
|
}
|
||||||
} else if chr == ')' {
|
} else if chr == ')' {
|
||||||
self.next_char().unwrap();
|
self.next_char().unwrap();
|
||||||
ListToken::End
|
ListToken::End
|
||||||
} else {
|
} else {
|
||||||
ListToken::Leaf { value: self.read_string()? }
|
ListToken::Leaf {
|
||||||
|
value: self.read_string()?,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,9 +259,15 @@ impl<R: std::io::BufRead> ListTokenizer<R> {
|
||||||
Ok(value)
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_optional<T: ReadDsn<R>>(&mut self, name: &'static str) -> Result<Option<T>, ParseError> {
|
pub fn read_optional<T: ReadDsn<R>>(
|
||||||
|
&mut self,
|
||||||
|
name: &'static str,
|
||||||
|
) -> Result<Option<T>, ParseError> {
|
||||||
let token = self.consume_token()?;
|
let token = self.consume_token()?;
|
||||||
if let ListToken::Start { name: ref actual_name } = token {
|
if let ListToken::Start {
|
||||||
|
name: ref actual_name,
|
||||||
|
} = token
|
||||||
|
{
|
||||||
if actual_name == name {
|
if actual_name == name {
|
||||||
let value = self.read_value::<T>()?;
|
let value = self.read_value::<T>()?;
|
||||||
self.consume_token()?.expect_end()?;
|
self.consume_token()?.expect_end()?;
|
||||||
|
|
@ -282,31 +291,36 @@ impl<R: std::io::BufRead> ListTokenizer<R> {
|
||||||
array.push(self.read_value::<T>()?);
|
array.push(self.read_value::<T>()?);
|
||||||
} else {
|
} else {
|
||||||
self.return_token(token);
|
self.return_token(token);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(array)
|
Ok(array)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_named_array<T: ReadDsn<R>>(&mut self, name: &'static str) -> Result<Vec<T>, ParseError> {
|
pub fn read_named_array<T: ReadDsn<R>>(
|
||||||
|
&mut self,
|
||||||
|
name: &'static str,
|
||||||
|
) -> Result<Vec<T>, ParseError> {
|
||||||
let mut array = Vec::<T>::new();
|
let mut array = Vec::<T>::new();
|
||||||
loop {
|
loop {
|
||||||
let token = self.consume_token()?;
|
let token = self.consume_token()?;
|
||||||
if let ListToken::Start { name: ref actual_name } = token {
|
if let ListToken::Start {
|
||||||
|
name: ref actual_name,
|
||||||
|
} = token
|
||||||
|
{
|
||||||
if actual_name == name {
|
if actual_name == name {
|
||||||
let value = self.read_value::<T>()?;
|
let value = self.read_value::<T>()?;
|
||||||
self.consume_token()?.expect_end()?;
|
self.consume_token()?.expect_end()?;
|
||||||
array.push(value);
|
array.push(value);
|
||||||
} else {
|
} else {
|
||||||
self.return_token(token);
|
self.return_token(token);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.return_token(token);
|
self.return_token(token);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(array)
|
Ok(array)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
use super::common::ListToken;
|
||||||
use super::read::ReadDsn;
|
use super::read::ReadDsn;
|
||||||
|
use super::read::{ListTokenizer, ParseError};
|
||||||
|
use super::write::ListWriter;
|
||||||
use super::write::WriteDsn;
|
use super::write::WriteDsn;
|
||||||
use dsn_derive::ReadDsn;
|
use dsn_derive::ReadDsn;
|
||||||
use dsn_derive::WriteDsn;
|
use dsn_derive::WriteDsn;
|
||||||
use super::common::ListToken;
|
|
||||||
use super::read::{ListTokenizer, ParseError};
|
|
||||||
use super::write::ListWriter;
|
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Dummy {}
|
pub struct Dummy {}
|
||||||
|
|
@ -16,7 +16,8 @@ pub struct SesFile {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Session {
|
pub struct Session {
|
||||||
#[anon] pub id: String,
|
#[anon]
|
||||||
|
pub id: String,
|
||||||
pub routes: Routes,
|
pub routes: Routes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,7 +36,8 @@ pub struct NetworkOut {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct NetOut {
|
pub struct NetOut {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
#[vec("wire")]
|
#[vec("wire")]
|
||||||
pub wire: Vec<Wire>,
|
pub wire: Vec<Wire>,
|
||||||
#[vec("via")]
|
#[vec("via")]
|
||||||
|
|
@ -49,7 +51,8 @@ pub struct DsnFile {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Pcb {
|
pub struct Pcb {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
pub parser: Parser,
|
pub parser: Parser,
|
||||||
pub resolution: Resolution,
|
pub resolution: Resolution,
|
||||||
pub unit: String,
|
pub unit: String,
|
||||||
|
|
@ -70,8 +73,10 @@ pub struct Parser {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Resolution {
|
pub struct Resolution {
|
||||||
#[anon] pub unit: String,
|
#[anon]
|
||||||
#[anon] pub value: f32,
|
pub unit: String,
|
||||||
|
#[anon]
|
||||||
|
pub value: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
|
|
@ -87,7 +92,8 @@ pub struct Structure {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Layer {
|
pub struct Layer {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
pub r#type: String,
|
pub r#type: String,
|
||||||
pub property: Property,
|
pub property: Property,
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +110,8 @@ pub struct Boundary {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Plane {
|
pub struct Plane {
|
||||||
#[anon] pub net: String,
|
#[anon]
|
||||||
|
pub net: String,
|
||||||
pub polygon: Polygon,
|
pub polygon: Polygon,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,7 +129,8 @@ pub struct Placement {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Component {
|
pub struct Component {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
#[vec("place")]
|
#[vec("place")]
|
||||||
pub places: Vec<Place>,
|
pub places: Vec<Place>,
|
||||||
}
|
}
|
||||||
|
|
@ -130,11 +138,16 @@ pub struct Component {
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub struct Place {
|
pub struct Place {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
#[anon] pub x: f32,
|
pub name: String,
|
||||||
#[anon] pub y: f32,
|
#[anon]
|
||||||
#[anon] pub side: String,
|
pub x: f32,
|
||||||
#[anon] pub rotation: f32,
|
#[anon]
|
||||||
|
pub y: f32,
|
||||||
|
#[anon]
|
||||||
|
pub side: String,
|
||||||
|
#[anon]
|
||||||
|
pub rotation: f32,
|
||||||
pub PN: Option<String>,
|
pub PN: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +161,8 @@ pub struct Library {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
#[vec("outline")]
|
#[vec("outline")]
|
||||||
pub outlines: Vec<Outline>,
|
pub outlines: Vec<Outline>,
|
||||||
#[vec("pin")]
|
#[vec("pin")]
|
||||||
|
|
@ -164,11 +178,15 @@ pub struct Outline {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Pin {
|
pub struct Pin {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
pub rotate: Option<f32>,
|
pub rotate: Option<f32>,
|
||||||
#[anon] pub id: String,
|
#[anon]
|
||||||
#[anon] pub x: f32,
|
pub id: String,
|
||||||
#[anon] pub y: f32,
|
#[anon]
|
||||||
|
pub x: f32,
|
||||||
|
#[anon]
|
||||||
|
pub y: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
|
|
@ -178,13 +196,16 @@ pub struct Rotate {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Keepout {
|
pub struct Keepout {
|
||||||
#[anon] pub idk: String,
|
#[anon]
|
||||||
#[anon] pub shape: Shape,
|
pub idk: String,
|
||||||
|
#[anon]
|
||||||
|
pub shape: Shape,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Padstack {
|
pub struct Padstack {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
#[vec("shape")]
|
#[vec("shape")]
|
||||||
pub shapes: Vec<Shape>,
|
pub shapes: Vec<Shape>,
|
||||||
pub attach: bool,
|
pub attach: bool,
|
||||||
|
|
@ -227,9 +248,12 @@ impl<W: std::io::Write> WriteDsn<W> for Shape {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Circle {
|
pub struct Circle {
|
||||||
#[anon] pub layer: String,
|
#[anon]
|
||||||
#[anon] pub diameter: u32,
|
pub layer: String,
|
||||||
#[anon] pub offset: Option<Point>,
|
#[anon]
|
||||||
|
pub diameter: u32,
|
||||||
|
#[anon]
|
||||||
|
pub offset: Option<Point>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
|
|
@ -243,7 +267,8 @@ pub struct Network {
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
// dsn names this "net", but it's a structure unrelated to "net" in wiring or elsewhere
|
// dsn names this "net", but it's a structure unrelated to "net" in wiring or elsewhere
|
||||||
pub struct NetPinAssignments {
|
pub struct NetPinAssignments {
|
||||||
#[anon] pub name: String,
|
#[anon]
|
||||||
|
pub name: String,
|
||||||
pub pins: Pins,
|
pub pins: Pins,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,7 +334,7 @@ impl<R: std::io::BufRead> ReadDsn<R> for Vec<Point> {
|
||||||
array.push(Point { x, y });
|
array.push(Point { x, y });
|
||||||
} else {
|
} else {
|
||||||
tokenizer.return_token(token);
|
tokenizer.return_token(token);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(array)
|
Ok(array)
|
||||||
|
|
@ -352,25 +377,36 @@ impl<W: std::io::Write> WriteDsn<W> for Option<Point> {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Polygon {
|
pub struct Polygon {
|
||||||
#[anon] pub layer: String,
|
#[anon]
|
||||||
#[anon] pub width: f32,
|
pub layer: String,
|
||||||
#[anon] pub coords: Vec<Point>,
|
#[anon]
|
||||||
|
pub width: f32,
|
||||||
|
#[anon]
|
||||||
|
pub coords: Vec<Point>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
#[anon] pub layer: String,
|
#[anon]
|
||||||
#[anon] pub width: f32,
|
pub layer: String,
|
||||||
#[anon] pub coords: Vec<Point>,
|
#[anon]
|
||||||
|
pub width: f32,
|
||||||
|
#[anon]
|
||||||
|
pub coords: Vec<Point>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Rect {
|
pub struct Rect {
|
||||||
#[anon] pub layer: String,
|
#[anon]
|
||||||
#[anon] pub x1: f32,
|
pub layer: String,
|
||||||
#[anon] pub y1: f32,
|
#[anon]
|
||||||
#[anon] pub x2: f32,
|
pub x1: f32,
|
||||||
#[anon] pub y2: f32,
|
#[anon]
|
||||||
|
pub y1: f32,
|
||||||
|
#[anon]
|
||||||
|
pub x2: f32,
|
||||||
|
#[anon]
|
||||||
|
pub y2: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
|
|
@ -394,6 +430,7 @@ pub struct Rule {
|
||||||
|
|
||||||
#[derive(ReadDsn, WriteDsn, Debug)]
|
#[derive(ReadDsn, WriteDsn, Debug)]
|
||||||
pub struct Clearance {
|
pub struct Clearance {
|
||||||
#[anon] pub value: f32,
|
#[anon]
|
||||||
|
pub value: f32,
|
||||||
pub r#type: Option<String>,
|
pub r#type: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
|
|
||||||
match token {
|
match token {
|
||||||
ListToken::Start { name } => {
|
ListToken::Start { name } => {
|
||||||
write!(self.writable,
|
write!(
|
||||||
|
self.writable,
|
||||||
"\n{}({}",
|
"\n{}({}",
|
||||||
" ".repeat(self.indent_level),
|
" ".repeat(self.indent_level),
|
||||||
name
|
name
|
||||||
|
|
@ -101,10 +102,7 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
if self.indent_level <= self.multiline_level {
|
if self.indent_level <= self.multiline_level {
|
||||||
self.indent_level -= 1;
|
self.indent_level -= 1;
|
||||||
self.line_len = 2 * self.indent_level + len;
|
self.line_len = 2 * self.indent_level + len;
|
||||||
write!(self.writable,
|
write!(self.writable, "\n{})", " ".repeat(self.indent_level))
|
||||||
"\n{})",
|
|
||||||
" ".repeat(self.indent_level)
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
self.indent_level -= 1;
|
self.indent_level -= 1;
|
||||||
self.line_len += len;
|
self.line_len += len;
|
||||||
|
|
@ -118,10 +116,7 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
self.write_token(ListToken::Leaf { value })
|
self.write_token(ListToken::Leaf { value })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_value<T: WriteDsn<W>>(
|
pub fn write_value<T: WriteDsn<W>>(&mut self, value: &T) -> Result<(), io::Error> {
|
||||||
&mut self,
|
|
||||||
value: &T,
|
|
||||||
) -> Result<(), io::Error> {
|
|
||||||
value.write_dsn(self)
|
value.write_dsn(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,10 +124,10 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
&mut self,
|
&mut self,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
value: &T,
|
value: &T,
|
||||||
)
|
) -> Result<(), io::Error> {
|
||||||
-> Result<(), io::Error>
|
self.write_token(ListToken::Start {
|
||||||
{
|
name: name.to_string(),
|
||||||
self.write_token(ListToken::Start { name: name.to_string() } )?;
|
})?;
|
||||||
self.write_value(value)?;
|
self.write_value(value)?;
|
||||||
self.write_token(ListToken::End)?;
|
self.write_token(ListToken::End)?;
|
||||||
|
|
||||||
|
|
@ -143,9 +138,7 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
&mut self,
|
&mut self,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
optional: &Option<T>,
|
optional: &Option<T>,
|
||||||
)
|
) -> Result<(), io::Error> {
|
||||||
-> Result<(), io::Error>
|
|
||||||
{
|
|
||||||
if let Some(value) = optional {
|
if let Some(value) = optional {
|
||||||
self.write_named(name, value)?;
|
self.write_named(name, value)?;
|
||||||
}
|
}
|
||||||
|
|
@ -153,12 +146,7 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_array<T: WriteDsn<W>>(
|
pub fn write_array<T: WriteDsn<W>>(&mut self, array: &Vec<T>) -> Result<(), io::Error> {
|
||||||
&mut self,
|
|
||||||
array: &Vec<T>,
|
|
||||||
)
|
|
||||||
-> Result<(), io::Error>
|
|
||||||
{
|
|
||||||
for elem in array {
|
for elem in array {
|
||||||
self.write_value(elem)?;
|
self.write_value(elem)?;
|
||||||
}
|
}
|
||||||
|
|
@ -170,9 +158,7 @@ impl<W: io::Write> ListWriter<W> {
|
||||||
&mut self,
|
&mut self,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
array: &Vec<T>,
|
array: &Vec<T>,
|
||||||
)
|
) -> Result<(), io::Error> {
|
||||||
-> Result<(), io::Error>
|
|
||||||
{
|
|
||||||
for elem in array {
|
for elem in array {
|
||||||
self.write_named(name, elem)?;
|
self.write_named(name, elem)?;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ use geo::Point;
|
||||||
use petgraph::{
|
use petgraph::{
|
||||||
stable_graph::{NodeIndex, StableDiGraph},
|
stable_graph::{NodeIndex, StableDiGraph},
|
||||||
visit::EdgeRef,
|
visit::EdgeRef,
|
||||||
Direction::{Incoming, Outgoing},
|
Direction::Incoming,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
bend::{BendWeight, FixedBendWeight, LooseBendWeight},
|
bend::BendWeight,
|
||||||
dot::{DotWeight, FixedDotWeight, LooseDotWeight},
|
dot::DotWeight,
|
||||||
graph::{PrimitiveWeight, Retag},
|
graph::{PrimitiveWeight, Retag},
|
||||||
primitive::Primitive,
|
primitive::Primitive,
|
||||||
rules::RulesTrait,
|
rules::RulesTrait,
|
||||||
seg::{FixedSegWeight, LoneLooseSegWeight, SegWeight, SeqLooseSegWeight},
|
seg::SegWeight,
|
||||||
},
|
},
|
||||||
geometry::{
|
geometry::{
|
||||||
compound::CompoundManagerTrait,
|
compound::CompoundManagerTrait,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use enum_dispatch::enum_dispatch;
|
|
||||||
use geo::{Centroid, Contains, Point, Polygon};
|
use geo::{Centroid, Contains, Point, Polygon};
|
||||||
|
|
||||||
use crate::geometry::shape::ShapeTrait;
|
use crate::geometry::shape::ShapeTrait;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
use geo::Point;
|
use geo::Point;
|
||||||
use petgraph::stable_graph::StableDiGraph;
|
|
||||||
use rstar::AABB;
|
use rstar::AABB;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -10,7 +7,7 @@ use crate::{
|
||||||
band::BandIndex,
|
band::BandIndex,
|
||||||
bend::LooseBendWeight,
|
bend::LooseBendWeight,
|
||||||
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
dot::{DotIndex, FixedDotIndex, FixedDotWeight, LooseDotIndex, LooseDotWeight},
|
||||||
graph::{GetLayer, GetMaybeNet, PrimitiveIndex, PrimitiveWeight, Retag},
|
graph::{GetMaybeNet, PrimitiveIndex},
|
||||||
primitive::{GetJoints, GetOtherJoint},
|
primitive::{GetJoints, GetOtherJoint},
|
||||||
rules::RulesTrait,
|
rules::RulesTrait,
|
||||||
seg::{
|
seg::{
|
||||||
|
|
@ -21,17 +18,12 @@ use crate::{
|
||||||
wraparoundable::WraparoundableIndex,
|
wraparoundable::WraparoundableIndex,
|
||||||
Drawing, Infringement, LayoutException,
|
Drawing, Infringement, LayoutException,
|
||||||
},
|
},
|
||||||
geometry::{
|
geometry::{compound::CompoundManagerTrait, primitive::PrimitiveShapeTrait, GenericNode},
|
||||||
compound::CompoundManagerTrait, poly::PolyShape, primitive::PrimitiveShapeTrait,
|
|
||||||
shape::ShapeTrait, BendWeightTrait, DotWeightTrait, GenericNode, Geometry, GeometryLabel,
|
|
||||||
GetWidth, SegWeightTrait,
|
|
||||||
},
|
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
layout::{
|
layout::{
|
||||||
via::{Via, ViaWeight},
|
via::{Via, ViaWeight},
|
||||||
zone::{GetMaybeApex, MakePolyShape, Zone, ZoneWeight},
|
zone::{Zone, ZoneWeight},
|
||||||
},
|
},
|
||||||
math::Circle,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
|
@ -207,9 +199,9 @@ impl<R: RulesTrait> Layout<R> {
|
||||||
pub fn band_length(&self, band: BandIndex) -> f64 {
|
pub fn band_length(&self, band: BandIndex) -> f64 {
|
||||||
match band {
|
match band {
|
||||||
BandIndex::Straight(seg) => self.drawing.geometry().seg_shape(seg.into()).length(),
|
BandIndex::Straight(seg) => self.drawing.geometry().seg_shape(seg.into()).length(),
|
||||||
BandIndex::Bended(mut start_seg) => {
|
BandIndex::Bended(start_seg) => {
|
||||||
let mut length = self.drawing.geometry().seg_shape(start_seg.into()).length();
|
let mut length = self.drawing.geometry().seg_shape(start_seg.into()).length();
|
||||||
let mut start_dot = self.drawing.primitive(start_seg).joints().1;
|
let start_dot = self.drawing.primitive(start_seg).joints().1;
|
||||||
|
|
||||||
let bend = self.drawing.primitive(start_dot).bend();
|
let bend = self.drawing.primitive(start_dot).bend();
|
||||||
length += self.drawing.geometry().bend_shape(bend.into()).length();
|
length += self.drawing.geometry().bend_shape(bend.into()).length();
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,14 @@
|
||||||
use enum_dispatch::enum_dispatch;
|
use enum_dispatch::enum_dispatch;
|
||||||
|
|
||||||
use geo::{LineString, Point, Polygon};
|
use geo::{LineString, Point, Polygon};
|
||||||
use petgraph::stable_graph::NodeIndex;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
dot::{DotIndex, FixedDotIndex},
|
dot::FixedDotIndex,
|
||||||
graph::{GetLayer, GetMaybeNet, MakePrimitive, PrimitiveIndex, PrimitiveWeight, Retag},
|
graph::{GetLayer, GetMaybeNet, MakePrimitive, PrimitiveIndex},
|
||||||
primitive::{GenericPrimitive, GetLimbs, Primitive},
|
primitive::GetLimbs,
|
||||||
rules::RulesTrait,
|
rules::RulesTrait,
|
||||||
seg::SegIndex,
|
seg::SegIndex,
|
||||||
Drawing,
|
|
||||||
},
|
},
|
||||||
geometry::{compound::CompoundManagerTrait, poly::PolyShape, GetPos},
|
geometry::{compound::CompoundManagerTrait, poly::PolyShape, GetPos},
|
||||||
graph::{GenericIndex, GetNodeIndex},
|
graph::{GenericIndex, GetNodeIndex},
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
|
|
||||||
use geo::geometry::Point;
|
|
||||||
use geo::EuclideanDistance;
|
use geo::EuclideanDistance;
|
||||||
use petgraph::visit::EdgeRef;
|
use petgraph::visit::EdgeRef;
|
||||||
use spade::InsertionError;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -11,7 +7,6 @@ use crate::{
|
||||||
band::BandIndex,
|
band::BandIndex,
|
||||||
dot::FixedDotIndex,
|
dot::FixedDotIndex,
|
||||||
graph::{MakePrimitive, PrimitiveIndex},
|
graph::{MakePrimitive, PrimitiveIndex},
|
||||||
guide::HeadTrait,
|
|
||||||
primitive::MakePrimitiveShape,
|
primitive::MakePrimitiveShape,
|
||||||
rules::RulesTrait,
|
rules::RulesTrait,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
|
|
||||||
use contracts::debug_ensures;
|
use contracts::debug_ensures;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -13,7 +11,7 @@ use crate::{
|
||||||
layout::Layout,
|
layout::Layout,
|
||||||
router::{
|
router::{
|
||||||
draw::{Draw, DrawException},
|
draw::{Draw, DrawException},
|
||||||
navmesh::{Navmesh, NavvertexIndex},
|
navmesh::NavvertexIndex,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,11 @@
|
||||||
use std::fs::File;
|
|
||||||
|
|
||||||
use petgraph::{
|
|
||||||
unionfind::UnionFind,
|
|
||||||
visit::{EdgeRef, IntoEdgeReferences, NodeIndexable},
|
|
||||||
};
|
|
||||||
use topola::{
|
use topola::{
|
||||||
autorouter::{
|
autorouter::{
|
||||||
invoker::{Command, Invoker, InvokerError},
|
invoker::{Command, Invoker, InvokerError},
|
||||||
Autorouter, AutorouterError,
|
AutorouterError,
|
||||||
},
|
},
|
||||||
drawing::{
|
layout::via::ViaWeight,
|
||||||
graph::{GetLayer, GetMaybeNet},
|
|
||||||
primitive::GetInnerOuter,
|
|
||||||
},
|
|
||||||
dsn::design::DsnDesign,
|
|
||||||
graph::GetNodeIndex,
|
|
||||||
layout::{via::ViaWeight, NodeIndex},
|
|
||||||
math::Circle,
|
math::Circle,
|
||||||
router::EmptyRouterObserver,
|
router::EmptyRouterObserver,
|
||||||
triangulation::GetTrianvertexIndex,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue