Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,64 @@ members = [
"scripts/mergegds",
"substrate",
]

[workspace.dependencies]
# Workspace crates
codegen = { path = "codegen" }
empty_pdk = { path = "pdks/empty_pdk" }
gds21 = { path = "libs/gds21" }
ngspice = { path = "plugins/ngspice" }
sky130_common_pdk = { path = "pdks/sky130_common_pdk" }
sky130_open_pdk = { path = "pdks/sky130_open_pdk" }
spice_rawfile = { path = "plugins/spice_rawfile" }
subgates = { path = "libs/subgates" }
subgeom = { path = "libs/subgeom" }
sublut = { path = "libs/sublut" }
subspice = { path = "plugins/subspice" }
substrate = { path = "substrate" }

# External crates
anyhow = "1"
approx = "0.5"
arcstr = "1"
array_map = "0.4"
bitvec = "1"
byteorder = "1"
chrono = "0.4"
clap = "4"
csv = "1"
darling = "0.24"
derivative = "2"
derive_builder = "0.20"
derive_more = "2"
enum_dispatch = "0.3"
flexbuffers = "25"
float_eq = "1"
grid = "1"
itertools = "0.15"
lazy_static = "1"
log = "0.4"
nom = "8"
num-derive = "0.5"
num-traits = "0.2"
paste = "1"
pathfinding = "4"
proc-macro-crate = "3"
proc-macro2 = "1"
psfparser = { git = "https://github.com/ucb-substrate/substrate2", branch = "main" }
quote = "1"
regex = "1"
serde = "1"
serde_derive = "1"
serde_json = "1"
serde_yaml = "0.9"
slotmap = "1"
splines = "5"
state = "0.6"
statrs = "0.19"
syn = "3"
tempfile = "3.10"
tera = "2"
textwrap = "0.16"
thiserror = "2"
toml = "1"
14 changes: 7 additions & 7 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
darling = "0.14.4"
syn = "1.0.91"
quote = "1.0.26"
paste = "1.0.12"
proc-macro2 = "1.0.37"
proc-macro-crate = "1.3.1"
itertools = "0.10.5"
darling = { workspace = true }
syn = { workspace = true }
quote = { workspace = true }
paste = { workspace = true }
proc-macro2 = { workspace = true }
proc-macro-crate = { workspace = true }
itertools = { workspace = true }

[lib]
proc-macro = true
7 changes: 5 additions & 2 deletions codegen/src/derive_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ pub(crate) fn derive_interface_inner(item: TokenStream) -> TokenStream {
.named
.into_iter()
.map(|field| {
let is_input = field.attrs.iter().any(|attr| attr.path.is_ident("input"));
let is_output = field.attrs.iter().any(|attr| attr.path.is_ident("output"));
let is_input = field.attrs.iter().any(|attr| attr.path().is_ident("input"));
let is_output = field
.attrs
.iter()
.any(|attr| attr.path().is_ident("output"));
if is_input ^ is_output {
Ok((field, is_input))
} else {
Expand Down
10 changes: 8 additions & 2 deletions codegen/src/hard_macro.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use darling::ast::NestedMeta;
use darling::FromMeta;
use proc_macro::TokenStream;
use proc_macro2::Span;
use proc_macro_crate::{crate_name, FoundCrate};
use quote::quote;
use syn::spanned::Spanned;
use syn::{parse_macro_input, AttributeArgs, Error, Fields, Ident, ItemStruct};
use syn::{parse_macro_input, Error, Fields, Ident, ItemStruct};

#[derive(Debug, FromMeta)]
struct HardMacroArgs {
Expand All @@ -17,7 +18,12 @@ struct HardMacroArgs {
}

pub(crate) fn hard_macro_inner(args: TokenStream, input: TokenStream) -> TokenStream {
let attr_args = parse_macro_input!(args as AttributeArgs);
let attr_args = match NestedMeta::parse_meta_list(args.into()) {
Ok(v) => v,
Err(e) => {
return TokenStream::from(darling::Error::from(e).write_errors());
}
};
let input = parse_macro_input!(input as ItemStruct);

let args = match HardMacroArgs::from_list(&attr_args) {
Expand Down
6 changes: 3 additions & 3 deletions examples/tut01_getting_started/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
substrate = { path = "../../substrate" }
empty_pdk = { path = "../../pdks/empty_pdk" }
arcstr = "1"
substrate = { workspace = true }
empty_pdk = { workspace = true }
arcstr = { workspace = true }
30 changes: 15 additions & 15 deletions libs/gds21/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ workspace = "../../"
exclude = ["resources",]

[dependencies]
byteorder = "1.4.3"
chrono = { version = "0.4.24", features = ["serde"] }
derive_builder = "0.9.0"
derive_more = "0.99.17"
num-derive = "0.4"
num-traits = "0.2.15"
serde = { version = "1.0.159", features = ["derive"] }
serde_derive = "1.0.159"
serde_json = "1.0"
serde_yaml = "0.8"
toml = "0.7.3"
tempfile = { version = "3", optional = true }
arcstr = { version = "1.1.5", features = ["serde"] }
textwrap = "0.14.2"
byteorder = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
derive_builder = { workspace = true }
derive_more = { workspace = true, features = ["add", "add_assign", "from"] }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_derive = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
toml = { workspace = true }
tempfile = { workspace = true, optional = true }
arcstr = { workspace = true, features = ["serde"] }
textwrap = { workspace = true }

[dev-dependencies]
tempfile = {version = "3"}
tempfile = { workspace = true }

[features]
selftest = ["tempfile"]
14 changes: 14 additions & 0 deletions libs/gds21/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ pub struct GdsProperty {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsPath {
// Required Fields
Expand Down Expand Up @@ -559,6 +560,7 @@ pub struct GdsPath {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsBoundary {
// Required Fields
Expand Down Expand Up @@ -594,6 +596,7 @@ pub struct GdsBoundary {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsStructRef {
// Required Fields
Expand Down Expand Up @@ -628,6 +631,7 @@ pub struct GdsStructRef {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsArrayRef {
// Required Fields
Expand Down Expand Up @@ -663,6 +667,7 @@ pub struct GdsArrayRef {
/// TEXTTYPE [PRESENTATION] [PATHTYPE] [WIDTH] [<strans>] XY STRING
/// ```
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsTextElem {
// Required Fields
Expand Down Expand Up @@ -708,6 +713,7 @@ pub struct GdsTextElem {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsNode {
// Required Fields
Expand Down Expand Up @@ -738,6 +744,7 @@ pub struct GdsNode {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsBox {
// Required Fields
Expand Down Expand Up @@ -837,6 +844,7 @@ impl Default for GdsDateTimes {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsStruct {
/// Struct Name
Expand Down Expand Up @@ -892,6 +900,7 @@ impl GdsStruct {
/// ```
///
#[derive(Default, Clone, Builder, Debug, Deserialize, Serialize, PartialEq)]
#[builder(build_fn(error = "GdsError"))]
#[builder(pattern = "owned", setter(into), private)]
pub struct GdsLibrary {
// Required fields
Expand Down Expand Up @@ -1102,6 +1111,11 @@ impl From<String> for GdsError {
GdsError::Str(e)
}
}
impl From<derive_builder::UninitializedFieldError> for GdsError {
fn from(e: derive_builder::UninitializedFieldError) -> Self {
GdsError::Str(e.to_string())
}
}
impl From<&str> for GdsError {
fn from(e: &str) -> Self {
GdsError::Str(e.to_string())
Expand Down
2 changes: 1 addition & 1 deletion libs/gds21/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ impl GdsParser {
}
// Add the Vec of structs, and create the Library from its builder
lib = lib.structs(structs);
Ok(lib.build()?)
lib.build()
}
/// Parse a cell ([GdsStruct])
fn parse_struct(&mut self, dates: Vec<i16>) -> GdsResult<GdsStruct> {
Expand Down
8 changes: 4 additions & 4 deletions libs/subgates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
substrate = { path = "../../substrate" }
subgeom = { path = "../subgeom" }
arcstr = { version = "1.1.5", features = ["serde"] }
serde = { version = "1", features = ["derive", "rc"] }
substrate = { workspace = true }
subgeom = { workspace = true }
arcstr = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["derive", "rc"] }
10 changes: 5 additions & 5 deletions libs/subgeom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1", features = ["derive", "rc"] }
enum_dispatch = "0.3.11"
array_map = { version = "0.4", features = ["derive", "serde", "std"] }
thiserror = "1.0.40"
gds21 = { path = "../../libs/gds21" }
serde = { workspace = true, features = ["derive", "rc"] }
enum_dispatch = { workspace = true }
array_map = { workspace = true, features = ["derive", "serde", "std"] }
thiserror = { workspace = true }
gds21 = { workspace = true }
10 changes: 5 additions & 5 deletions libs/sublut/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
derive_builder = { version = "0.12.0", features = ["clippy"] }
serde = { version = "1", features = ["derive", "rc"] }
splines = "4.2.0"
derive_builder = { workspace = true, features = ["clippy"] }
serde = { workspace = true, features = ["derive", "rc"] }
splines = { workspace = true }

[dev-dependencies]
float_eq = "1"
serde = { version = "1", features = ["derive", "rc"] }
float_eq = { workspace = true }
serde = { workspace = true, features = ["derive", "rc"] }
4 changes: 2 additions & 2 deletions pdks/empty_pdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ edition = "2021"
authors = ["Rahul Kumar <rahulkumar@berkeley.edu>"]

[dependencies]
substrate = { path = "../../substrate" }
arcstr = "1"
substrate = { workspace = true }
arcstr = { workspace = true }
6 changes: 3 additions & 3 deletions pdks/sky130_commercial_pdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"
authors = ["Rahul Kumar <rahulkumar@berkeley.edu>"]

[dependencies]
substrate = { path = "../../substrate" }
arcstr = "1"
sky130_common_pdk = { path = "../sky130_common_pdk" }
substrate = { workspace = true }
arcstr = { workspace = true }
sky130_common_pdk = { workspace = true }
6 changes: 3 additions & 3 deletions pdks/sky130_common_pdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"
authors = ["Rahul Kumar <rahulkumar@berkeley.edu>", "Rohan Kumar <rohankumar@berkeley.edu>"]

[dependencies]
substrate = { path = "../../substrate" }
subgeom = { path = "../../libs/subgeom" }
arcstr = "1"
substrate = { workspace = true }
subgeom = { workspace = true }
arcstr = { workspace = true }
6 changes: 3 additions & 3 deletions pdks/sky130_open_pdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"
authors = ["Rahul Kumar <rahulkumar@berkeley.edu>"]

[dependencies]
substrate = { path = "../../substrate" }
arcstr = "1"
sky130_common_pdk = { path = "../sky130_common_pdk" }
substrate = { workspace = true }
arcstr = { workspace = true }
sky130_common_pdk = { workspace = true }
12 changes: 6 additions & 6 deletions plugins/ngspice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ license = "MIT"
description = "Substrate plugin for Ngspice"

[dependencies]
lazy_static = "1.4.0"
serde = { version = "1.0.159", features = ["derive"] }
substrate = { path = "../../substrate" }
tera = "1.18.1"
spice_rawfile = { path = "../spice_rawfile" }
anyhow = "1.0.70"
lazy_static = { workspace = true }
serde = { workspace = true, features = ["derive"] }
substrate = { workspace = true }
tera = { workspace = true, features = ["glob_fs"] }
spice_rawfile = { workspace = true }
anyhow = { workspace = true }
11 changes: 5 additions & 6 deletions plugins/ngspice/src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ pub(crate) const TEMPLATES_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/te

lazy_static! {
pub(crate) static ref TEMPLATES: Tera = {
match Tera::new(&format!("{TEMPLATES_PATH}/*")) {
Ok(t) => t,
Err(e) => {
panic!("Encountered errors while parsing Tera templates: {e}");
}
let mut tera = Tera::new();
if let Err(e) = tera.load_from_glob(&format!("{TEMPLATES_PATH}/*")) {
panic!("Encountered errors while parsing Tera templates: {e}");
}
tera
};
}

Expand All @@ -29,7 +28,7 @@ pub(crate) struct NetlistCtx<'a> {

pub(crate) fn render_netlist(ctx: NetlistCtx<'_>, work_dir: impl AsRef<Path>) -> Result<PathBuf> {
let path = work_dir.as_ref().join("netlist.spice");
let ctx = Context::from_serialize(ctx)
let ctx = Context::from_serialize(&ctx)
.map_err(|e| ErrorSource::Internal(format!("template error: {e}")))?;

let mut file = std::fs::File::create(&path)?;
Expand Down
Loading