Skip to content
Open
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
1,176 changes: 830 additions & 346 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bins/cdl2spice/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cdl2spice"
version = "0.2.2"
edition = "2021"
edition = "2024"

[dependencies]
anyhow = "1"
Expand Down
2 changes: 1 addition & 1 deletion bins/sky130spconv/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sky130spconv"
version = "0.1.0"
edition = "2021"
edition = "2024"
readme = "README.md"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion bins/spicemerge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "spicemerge"
version = "0.1.0"
edition = "2021"
edition = "2024"

[dependencies]
anyhow = "1"
Expand Down
2 changes: 1 addition & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "codegen"
version = "0.10.2"
edition = "2021"
edition = "2024"

[dependencies]
darling = "0.20"
Expand Down
2 changes: 1 addition & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "config"
version = "0.4.1"
edition = "2021"
edition = "2024"

[dependencies]
anyhow = "1"
Expand Down
2 changes: 1 addition & 1 deletion config/src/home/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub(crate) fn substrate_home_with_cwd_env(env: &dyn Env, cwd: &Path) -> io::Resu
_ => home_dir_with_env(env)
.map(|p| p.join(".substrate"))
.ok_or_else(|| {
io::Error::new(io::ErrorKind::Other, "could not find Substrate home dir")
io::Error::other("could not find Substrate home dir")
}),
}
}
5 changes: 2 additions & 3 deletions config/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ impl<'a> Iterator for PathAncestors<'a> {
if let Some(path) = self.current {
self.current = path.parent();

if let Some(ref stop_at) = self.stop_at {
if path == stop_at {
if let Some(ref stop_at) = self.stop_at
&& path == stop_at {
self.current = None;
}
}

Some(path)
} else {
Expand Down
10 changes: 1 addition & 9 deletions config/src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use anyhow::Result;

use self::ConfigValue as CV;
use crate::paths;
use anyhow::{anyhow, bail, Context as _};
use anyhow::{Context as _, anyhow, bail};
use lazycell::LazyCell;
use serde::Deserialize;

Expand Down Expand Up @@ -1018,11 +1018,3 @@ impl StringList {
&self.0
}
}

/// StringList automatically merges config values with environment values,
/// this instead follows the precedence rules, so that eg. a string list found
/// in the environment will be used instead of one in a config file.
///
/// This is currently only used by `PathAndArgs`
#[derive(Debug, Deserialize)]
pub(crate) struct UnmergedStringList(Vec<String>);
44 changes: 2 additions & 42 deletions config/src/raw/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Based on Cargo's [`config` module](https://github.com/rust-lang/cargo/tree/master/src/cargo/util/config)
// with substantial modifications.

use super::{RawConfig, UnmergedStringList, Value};
use serde::{de::Error, Deserialize};
use super::{RawConfig, Value};
use serde::Deserialize;
use std::path::PathBuf;

/// Use with the `get` API to fetch a string that will be converted to a
Expand Down Expand Up @@ -48,43 +48,3 @@ impl ConfigRelativePath {
config.string_to_path(&self.0.val, &self.0.definition)
}
}

/// A config type that is a program to run.
///
/// This supports a list of strings like `['/path/to/program', 'somearg']`
/// or a space separated string like `'/path/to/program somearg'`.
///
/// This expects the first value to be the path to the program to run.
/// Subsequent values are strings of arguments to pass to the program.
///
/// Typically you should use `ConfigRelativePath::resolve_program` on the path
/// to get the actual program.
#[derive(Debug, Clone)]
pub(crate) struct PathAndArgs {
#[allow(dead_code)]
pub(crate) path: ConfigRelativePath,
#[allow(dead_code)]
pub(crate) args: Vec<String>,
}

impl<'de> serde::Deserialize<'de> for PathAndArgs {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let vsl = Value::<UnmergedStringList>::deserialize(deserializer)?;
let mut strings = vsl.val.0;
if strings.is_empty() {
return Err(D::Error::invalid_length(0, &"at least one element"));
}
let first = strings.remove(0);
let crp = Value {
val: first,
definition: vsl.definition,
};
Ok(PathAndArgs {
path: ConfigRelativePath(crp),
args: strings,
})
}
}
2 changes: 1 addition & 1 deletion docs/snippets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "snippets"
version = "0.7.0"
edition = "2021"
edition = "2024"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "examples"
version = "0.2.0"
edition = "2021"
edition = "2024"
include = [
"**/*.rs",
"Cargo.toml",
Expand Down
2 changes: 1 addition & 1 deletion examples/latest/colbuf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "colbuf"
version = "0.0.0"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/latest/sky130_inverter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sky130_inverter"
version = "0.0.0"
edition = "2021"
edition = "2024"
publish = false

# begin-code-snippet dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/latest/spice_vdivider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "spice_vdivider"
version = "0.0.0"
edition = "2021"
edition = "2024"
publish = false

# begin-code-snippet dependencies
Expand Down
5 changes: 4 additions & 1 deletion examples/latest/strongarm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "strongarm"
version = "0.0.0"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand All @@ -24,3 +24,6 @@ itertools = "0.14"
spectre = { version = "0.11.2", registry = "substrate", path = "../../../tools/spectre" }
quantus = { version = "0.2.2", registry = "substrate", path = "../../../tools/quantus" }
pegasus = { version = "0.2.1", registry = "substrate", path = "../../../tools/pegasus" }

[dev-dependencies]
plotters = "0.3"
41 changes: 37 additions & 4 deletions examples/latest/strongarm/src/tb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use approx::abs_diff_eq;
use rust_decimal::prelude::ToPrimitive;
use rust_decimal::Decimal;
use rust_decimal_macros::dec;
use spectre::analysis::tran::Tran;
use spectre::analysis::tran::{OutputWaveform, Tran};
use spectre::blocks::{Pulse, Vsource};
use spectre::{ErrPreset, Spectre};
use std::any::Any;
Expand Down Expand Up @@ -122,7 +122,7 @@ where
val1,
period: Some(dec!(1000)),
width: Some(dec!(100)),
delay: Some(dec!(10e-9)),
delay: Some(dec!(1e-12)),
rise: Some(dec!(100e-12)),
fall: Some(dec!(100e-12)),
}));
Expand Down Expand Up @@ -172,12 +172,24 @@ pub enum ComparatorDecision {
Pos,
}

#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
pub struct ComparatorDecisionInfo {
pub decision: ComparatorDecision,
pub tclkq: f64,
}

pub struct StrongArmTranTbOutput {
pub decision: Option<ComparatorDecisionInfo>,
pub vop: OutputWaveform,
pub von: OutputWaveform,
}

impl<T, S, C: SimOption<Spectre> + Copy> StrongArmTranTb<T, S, C>
where
StrongArmTranTb<T, S, C>:
Block<Io = TestbenchIo> + Schematic<Schema = Spectre, NestedData = StrongArmTranTbNodes>,
{
pub fn run(&self, sim: SimController<Spectre, Self>) -> Option<ComparatorDecision> {
pub fn run(&self, sim: SimController<Spectre, Self>) -> StrongArmTranTbOutput {
let mut opts = spectre::Options::default();
sim.set_option(self.pvt.corner, &mut opts);
sim.set_option(Temperature::from(self.pvt.temp), &mut opts);
Expand All @@ -198,7 +210,15 @@ where

let vdd = self.pvt.voltage.to_f64().unwrap();
let epsilon = vdd * 0.05;
if abs_diff_eq!(von, 0.0, epsilon = epsilon) && abs_diff_eq!(vop, vdd, epsilon = epsilon) {

let transition = wav
.von
.transitions(0.2 * vdd, 0.8 * vdd)
.next()
.or_else(|| wav.vop.transitions(0.2 * vdd, 0.8 * vdd).next());
let decision = if abs_diff_eq!(von, 0.0, epsilon = epsilon)
&& abs_diff_eq!(vop, vdd, epsilon = epsilon)
{
Some(ComparatorDecision::Pos)
} else if abs_diff_eq!(von, vdd, epsilon = epsilon)
&& abs_diff_eq!(vop, 0.0, epsilon = epsilon)
Expand All @@ -207,6 +227,19 @@ where
} else {
None
}
.and_then(|decision| {
let transition = transition?;
Some(ComparatorDecisionInfo {
decision,
tclkq: transition.center_time(),
})
});

StrongArmTranTbOutput {
decision,
vop: wav.vop,
von: wav.von,
}
}
}

Expand Down
Loading
Loading