diff --git a/Cargo.lock b/Cargo.lock index 03f9dd9..fe8a079 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -799,12 +799,6 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" -[[package]] -name = "by_address" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" - [[package]] name = "bytemuck" version = "1.24.0" @@ -890,7 +884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" dependencies = [ "heck 0.4.1", - "indexmap 2.12.1", + "indexmap", "log", "proc-macro2", "quote", @@ -940,7 +934,7 @@ version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fe45e18904af7af10e4312df7c97251e98af98c70f42f1f2587aecfcbee56bf" dependencies = [ - "indexmap 2.12.1", + "indexmap", "lazy_static", "num-traits", "regex", @@ -1018,7 +1012,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -1115,7 +1109,7 @@ name = "collections" version = "0.1.0" source = "git+https://github.com/ucb-substrate/zed?branch=argon-dev#88651f66a37f5447a607a13325b3a6be24b2135a" dependencies = [ - "indexmap 2.12.1", + "indexmap", "rustc-hash 2.1.1", ] @@ -1152,9 +1146,9 @@ dependencies = [ "const_format", "derive-where", "enumify", - "gds21", + "gds", "geometry", - "indexmap 2.12.1", + "indexmap", "itertools 0.14.0", "klayout-lyp", "lrlex", @@ -1251,6 +1245,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1512,38 +1515,14 @@ version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2" -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - [[package]] name = "darling" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.11", - "darling_macro 0.20.11", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.9.3", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -1556,28 +1535,17 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.111", ] -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core 0.10.2", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.20.11", + "darling_core", "quote", "syn 2.0.111", ] @@ -1630,27 +1598,33 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.9.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ - "darling 0.10.2", - "derive_builder_core", - "proc-macro2", - "quote", - "syn 1.0.109", + "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.9.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ - "darling 0.10.2", + "darling", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.111", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn 2.0.111", ] [[package]] @@ -1666,6 +1640,29 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case 0.10.0", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.111", + "unicode-xid", +] + [[package]] name = "derive_refineable" version = "0.1.0" @@ -1913,7 +1910,7 @@ source = "registry+https://github.com/substrate-labs/crates-index" checksum = "484635cd3671edaad6957453aaed210981d3fb2d539c3f8e5a1761377fba24e9" dependencies = [ "convert_case 0.7.1", - "darling 0.20.11", + "darling", "macrotools", "proc-macro-error", "proc-macro2", @@ -2384,21 +2381,23 @@ dependencies = [ ] [[package]] -name = "gds21" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052f049eeb6d2edba9bf69bf17bb55ae4a4ac28c8b712d88c9b71027910eaadb" +name = "gds" +version = "0.4.1" +source = "git+https://github.com/ucb-substrate/substrate2.git?branch=main#7a55f753c14efd0d973d8ebca147991ed8b2030c" dependencies = [ + "arcstr", "byteorder", "chrono", "derive_builder", - "derive_more", - "layout21utils", - "num-derive 0.3.3", + "derive_more 2.1.1", + "num-derive", "num-traits", "serde", "serde_derive", "serde_json", + "serde_yaml", + "textwrap", + "toml 0.8.23", ] [[package]] @@ -2430,7 +2429,7 @@ version = "0.1.1" source = "registry+https://github.com/substrate-labs/crates-index" checksum = "3cbbf7b225696d90a525af8b80368b6bad57e2230265e0a218ebea8b2d2d4984" dependencies = [ - "darling 0.20.11", + "darling", "macrotools", "proc-macro-crate", "proc-macro2", @@ -2693,7 +2692,7 @@ dependencies = [ "core-video", "cosmic-text", "ctor", - "derive_more", + "derive_more 0.99.20", "embed-resource", "etagere", "filedescriptor", @@ -2794,7 +2793,7 @@ dependencies = [ "futures", "geometry", "gpui", - "indexmap 2.12.1", + "indexmap", "itertools 0.14.0", "lang-server", "lazy_static", @@ -2823,7 +2822,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.12.1", + "indexmap", "slab", "tokio", "tokio-util", @@ -2842,12 +2841,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.5" @@ -2992,7 +2985,7 @@ dependencies = [ "async-fs", "async-tar", "bytes", - "derive_more", + "derive_more 0.99.20", "futures", "http", "http-body", @@ -3269,16 +3262,6 @@ dependencies = [ "syn 2.0.111", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.12.1" @@ -3468,7 +3451,7 @@ dependencies = [ "compiler", "futures", "homedir", - "indexmap 2.12.1", + "indexmap", "itertools 0.14.0", "lrlex", "lrpar", @@ -3484,20 +3467,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "layout21utils" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1737e7a5d11b2c4535a0c2606c4a2c7709d4d83c1028ec4e0d7ee52159bad33e" -dependencies = [ - "by_address", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "toml 0.5.11", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -3571,12 +3540,6 @@ dependencies = [ "redox_syscall 0.5.18", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.4.15" @@ -3651,7 +3614,7 @@ dependencies = [ "cactus", "cfgrammar", "filetime", - "indexmap 2.12.1", + "indexmap", "lazy_static", "lrtable", "num-traits", @@ -3791,7 +3754,7 @@ version = "0.2.0" source = "registry+https://github.com/substrate-labs/crates-index" checksum = "169f0bd5dc34dbfe8567cc1d567b47b27f73050a92a2c7ef4d563538932ec5f7" dependencies = [ - "darling 0.20.11", + "darling", "proc-macro2", "quote", "syn 2.0.111", @@ -3972,7 +3935,7 @@ dependencies = [ "half", "hashbrown 0.15.5", "hexf-parse", - "indexmap 2.12.1", + "indexmap", "log", "num-traits", "once_cell", @@ -4165,17 +4128,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "num-derive" version = "0.4.2" @@ -5045,7 +4997,7 @@ dependencies = [ "maybe-rayon", "new_debug_unreachable", "noop_proc_macro", - "num-derive 0.4.2", + "num-derive", "num-traits", "paste", "profiling", @@ -5475,7 +5427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" dependencies = [ "dyn-clone", - "indexmap 2.12.1", + "indexmap", "ref-cast", "schemars_derive", "serde", @@ -5642,7 +5594,7 @@ version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ - "indexmap 2.12.1", + "indexmap", "itoa", "memchr", "ryu", @@ -5656,7 +5608,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e033097bf0d2b59a62b42c18ebbb797503839b26afdda2c4e1415cb6c813540" dependencies = [ - "indexmap 2.12.1", + "indexmap", "itoa", "memchr", "ryu", @@ -5706,14 +5658,15 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.26" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 1.9.3", + "indexmap", + "itoa", "ryu", "serde", - "yaml-rust", + "unsafe-libyaml", ] [[package]] @@ -5831,6 +5784,12 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + [[package]] name = "smol" version = "2.0.2" @@ -5958,12 +5917,6 @@ dependencies = [ "float-cmp", ] -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - [[package]] name = "strsim" version = "0.11.1" @@ -6319,6 +6272,17 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -6555,15 +6519,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.8.23" @@ -6582,7 +6537,7 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" dependencies = [ - "indexmap 2.12.1", + "indexmap", "serde_core", "serde_spanned 1.0.3", "toml_datetime 0.7.3", @@ -6615,7 +6570,7 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.12.1", + "indexmap", "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", @@ -6629,7 +6584,7 @@ version = "0.23.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" dependencies = [ - "indexmap 2.12.1", + "indexmap", "toml_datetime 0.7.3", "toml_parser", "winnow", @@ -6938,6 +6893,12 @@ dependencies = [ "serde", ] +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" @@ -8107,15 +8068,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "yazi" version = "0.2.1" diff --git a/core/compiler/Cargo.toml b/core/compiler/Cargo.toml index e49da68..c7335b9 100644 --- a/core/compiler/Cargo.toml +++ b/core/compiler/Cargo.toml @@ -7,7 +7,8 @@ edition = "2024" derive-where = { version = "1", features = ["serde"] } nalgebra = { version = "0.34", features = ["sparse"] } klayout-lyp = "0.1.1" -gds21 = "0.2" +gds = { git = "https://github.com/ucb-substrate/substrate2.git", branch = "main" } + anyhow = { workspace = true } cfgrammar = { workspace = true } diff --git a/core/compiler/src/gds.rs b/core/compiler/src/gds.rs index b4fb287..484f62d 100644 --- a/core/compiler/src/gds.rs +++ b/core/compiler/src/gds.rs @@ -1,10 +1,11 @@ use std::{io::BufReader, ops::Deref, path::Path}; -use anyhow::{Result, anyhow}; -use gds21::{ +use ::gds::{ GdsBoundary, GdsElement, GdsLayerSpec, GdsLibrary, GdsPoint, GdsStrans, GdsStruct, GdsStructRef, GdsTextElem, GdsUnits, }; +use anyhow::{Result, anyhow}; +use arcstr::ArcStr; use indexmap::IndexMap; use regex::Regex; use tracing::trace; @@ -23,7 +24,7 @@ struct GdsExporter { } impl GdsExporter { - fn new(name: impl Into, map: GdsMap, units: GdsUnits) -> Self { + fn new(name: impl Into, map: GdsMap, units: GdsUnits) -> Self { let mut lib = GdsLibrary::new(name); lib.units = units; Self { @@ -156,7 +157,7 @@ impl CompiledData { let x = text.x as i32; let y = text.y as i32; ocell.elems.push(GdsElement::GdsTextElem(GdsTextElem { - string: text.text.clone(), + string: ArcStr::from(&text.text), layer, texttype, xy: GdsPoint::new(x, y), @@ -166,7 +167,7 @@ impl CompiledData { SolvedValue::Instance(i) => { self.cell_to_gds(exporter, i.cell)?; ocell.elems.push(GdsElement::GdsStructRef(GdsStructRef { - name: exporter.names.name(&i.cell).unwrap().to_string(), + name: exporter.names.name(&i.cell).unwrap().clone(), xy: GdsPoint::new(exporter.coord_to_gds(i.x), exporter.coord_to_gds(i.y)), strans: Some(GdsStrans { reflected: i.reflect, diff --git a/core/compiler/src/lib.rs b/core/compiler/src/lib.rs index c32e666..07ce479 100644 --- a/core/compiler/src/lib.rs +++ b/core/compiler/src/lib.rs @@ -16,9 +16,9 @@ mod tests { gds::GdsMap, parse::parse_workspace_with_std, }; + use ::gds::GdsUnits; use approx::assert_relative_eq; use const_format::concatcp; - use gds21::GdsUnits; use crate::compile::{CellArg, CompileInput, compile}; const EPSILON: f64 = 1e-10;