Skip to content

Commit

Permalink
fix substrate doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanku committed Oct 30, 2023
1 parent c23c1b7 commit dfc7560
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde = { version = "1", features = ["derive"] }
substrate = { version = "<=0.6.1", registry = "substrate", path = "../substrate" }
sky130pdk = { version = "<=0.6.1", registry = "substrate", path = "../pdks/sky130pdk" }
spectre = { version = "<=0.6.1", registry = "substrate", path = "../tools/spectre" }
spice = { version = "<=0.4.0", registry = "substrate", path = "../libs/spice" }

[lib]
proc-macro = true
2 changes: 1 addition & 1 deletion libs/scir/src/netlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl<'a, S: HasSpiceLikeNetlist, W: Write> NetlisterInstance<'a, S, W> {
if signal == &sig_info.name && slice.range().is_none() {
// Ground renaming cannot apply to buses.
// TODO assert that the ground port has width 1.
return Ok(arcstr::format!("{}", replace_with));
return Ok(replace_with.clone());
}
}
let mut buf = Vec::new();
Expand Down
1 change: 1 addition & 0 deletions substrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ toml = "0.8"
approx = "0.5"
sky130pdk = { version = "<=0.6.1", registry = "substrate", path = "../pdks/sky130pdk" }
spectre = { version = "<=0.6.1", registry = "substrate", path = "../tools/spectre" }
spice = { version = "<=0.4.0", registry = "substrate", path = "../libs/spice" }

33 changes: 22 additions & 11 deletions substrate/src/schematic/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,28 @@ impl<S: Schema> RawLib<S> {
};

if let Some(concat_index) = concat_index {
// TODO: Handle primitive case.
let child_cell = self.scir.cell(inst.child().into_cell()?);
let port = child_cell.port(name);
let port_slice = child_cell.signal(port.signal()).slice();
let tail = port_slice
.slice_one()
.unwrap_or_else(|| port_slice.index(concat_index));
signals.push(ConvertedNodePath::Cell(scir::SliceOnePath::new(
instances.clone(),
tail,
)));
match inst.child() {
ChildId::Cell(id) => {
let child_cell = self.scir.cell(id);
let port = child_cell.port(name);
let port_slice = child_cell.signal(port.signal()).slice();
let tail = port_slice
.slice_one()
.unwrap_or_else(|| port_slice.index(concat_index));
signals.push(ConvertedNodePath::Cell(scir::SliceOnePath::new(
instances.clone(),
tail,
)));
}
ChildId::Primitive(id) => {
signals.push(ConvertedNodePath::Primitive {
id,
instances: instances.clone(),
port: name.clone(),
index: concat_index,
});
}
}
}
}
port_index += part.width();
Expand Down

0 comments on commit dfc7560

Please sign in to comment.