Skip to content

Commit

Permalink
feat(conv): better error messages in schema conversions (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulk29 authored Aug 4, 2024
1 parent a6ffd9a commit bad9503
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions libs/spice/src/netlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ impl HasSpiceLikeNetlist for Spice {
let name = arcstr::format!("R{}", name);
write!(out, "{}", name)?;
for port in ["1", "2"] {
for part in connections.remove(port).unwrap() {
for part in connections
.remove(port)
.unwrap_or_else(|| panic!("res2 instance `{name}` must connect to all ports; missing connection to port `{port}`"))
{
write!(out, " {}", part)?;
}
}
Expand Down Expand Up @@ -411,7 +414,10 @@ impl HasSpiceLikeNetlist for Spice {
let name = arcstr::format!("D{}", name);
write!(out, "{}", name)?;
for port in ["1", "2"] {
for part in connections.remove(port).unwrap() {
for part in connections
.remove(port)
.unwrap_or_else(|| panic!("diode2 instance `{name}` must connect to all ports; missing connection to port `{port}`"))
{
write!(out, " {}", part)?;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/spectre/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ impl HasSpiceLikeNetlist for Spectre {
} => {
let connections = ports
.iter()
.flat_map(|port| connections.remove(port).unwrap())
.flat_map(|port| connections.remove(port).unwrap_or_else(|| panic!("raw instance `{name}` must connect to all ports; missing connection to port `{port}`")))
.collect();
let name = self.write_instance(out, name, connections, cell)?;
for (key, value) in params.iter().sorted_by_key(|(key, _)| *key) {
Expand Down

0 comments on commit bad9503

Please sign in to comment.