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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ the authoritative record.

### Added

- **`JACQUARD_VENDOR_DIR`** env var to override the vendored-PDK root used
for cell-library decomposition (`gf180mcu_fd_sc_mcu7t5v0` /
`sky130_fd_sc_hd` functional models). Previously the path was hardcoded
to `vendor/` relative to the process CWD, so a consumer running
`jacquard` from another working directory had to symlink `vendor/` into
place. Now it defaults to `vendor/` (unchanged behaviour) and honours
`JACQUARD_VENDOR_DIR` when set. Follows the existing `JACQUARD_*`
runtime-knob convention.
- **Multi-corner support** (WS2.4, commits `5822343` / `530bb36` /
`59fde04`). `opensta-to-ir` accepts `--liberty NAME=PATH` to attach
Liberty files to named PVT corners (bare paths still go to a
Expand Down
52 changes: 49 additions & 3 deletions src/aig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ use indexmap::{IndexMap, IndexSet};
use netlistdb::{Direction, GeneralPinName, NetlistDB};
use smallvec::SmallVec;

/// Root directory under which the vendored PDK cell libraries live —
/// `<root>/gf180mcu_fd_sc_mcu7t5v0` and `<root>/sky130_fd_sc_hd`.
///
/// Defaults to `vendor` (the in-repo submodule layout, resolved relative
/// to the process CWD). Set `JACQUARD_VENDOR_DIR` to override it so a
/// caller that runs jacquard from a different working directory can point
/// at the vendored PDKs directly instead of symlinking `vendor/` into its
/// CWD. Follows the existing `JACQUARD_*` runtime-knob convention.
fn pdk_vendor_root() -> std::path::PathBuf {
pdk_vendor_root_from(std::env::var_os("JACQUARD_VENDOR_DIR"))
}

/// Pure core of [`pdk_vendor_root`], split out so the env-independent
/// resolution logic is unit-testable without mutating process env.
fn pdk_vendor_root_from(override_dir: Option<std::ffi::OsString>) -> std::path::PathBuf {
override_dir
.map(std::path::PathBuf::from)
.unwrap_or_else(|| std::path::PathBuf::from("vendor"))
}

/// Work item for iterative DFS traversal.
/// Using two-phase approach: Visit pushes dependencies, Process computes outputs.
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -1732,7 +1752,9 @@ impl AIG {

let pdk = gf180_pdk.expect(
"GF180 PDK models required for gf180mcu cell decomposition. \
Ensure vendor/gf180mcu_fd_sc_mcu7t5v0 submodule is initialized.",
Ensure the gf180mcu_fd_sc_mcu7t5v0 PDK is present under the \
vendor root (the vendor/ submodule by default, or \
$JACQUARD_VENDOR_DIR if set).",
);
let model = pdk.models.get(cell_type).unwrap_or_else(|| {
panic!(
Expand Down Expand Up @@ -1853,7 +1875,7 @@ impl AIG {
});

if has_sky130 {
let pdk_path = std::path::PathBuf::from("vendor/sky130_fd_sc_hd/cells");
let pdk_path = pdk_vendor_root().join("sky130_fd_sc_hd/cells");
let mut cell_types: Vec<String> = Vec::new();
for cellid in 1..netlistdb.num_cells {
let celltype = netlistdb.celltypes[cellid].as_str();
Expand All @@ -1868,7 +1890,7 @@ impl AIG {
let pdk_models = crate::sky130_pdk::load_pdk_models(&pdk_path, &cell_types);
Self::from_netlistdb_impl(netlistdb, Some(&pdk_models), None, cell_library)
} else if has_gf180mcu {
let pdk_path = std::path::PathBuf::from("vendor/gf180mcu_fd_sc_mcu7t5v0");
let pdk_path = pdk_vendor_root().join("gf180mcu_fd_sc_mcu7t5v0");
let mut cell_types: Vec<String> = Vec::new();
for cellid in 1..netlistdb.num_cells {
let celltype = netlistdb.celltypes[cellid].as_str();
Expand Down Expand Up @@ -3365,6 +3387,30 @@ impl AIG {
}
}

#[cfg(test)]
mod pdk_vendor_root_tests {
use super::*;
use std::path::PathBuf;

#[test]
fn defaults_to_vendor_when_unset() {
assert_eq!(pdk_vendor_root_from(None), PathBuf::from("vendor"));
}

#[test]
fn honours_override_dir() {
assert_eq!(
pdk_vendor_root_from(Some("/opt/pdks".into())),
PathBuf::from("/opt/pdks"),
);
// Relative overrides are taken verbatim (joined against CWD at use).
assert_eq!(
pdk_vendor_root_from(Some("some/submodule/vendor".into())),
PathBuf::from("some/submodule/vendor"),
);
}
}

#[cfg(test)]
mod xprop_tests {
use super::*;
Expand Down
Loading