Skip to content

Commit

Permalink
fix instance names
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanku committed Oct 26, 2023
1 parent 4696289 commit 152b86f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tools/spectre/src/netlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ impl HasSpiceLikeNetlist for Spectre {
connections: impl Iterator<Item = ArcStr>,
child: &ArcStr,
) -> std::io::Result<ArcStr> {
write!(out, "x{} (", name)?;
let name = arcstr::format!("x{}", name);
write!(out, "{} (", name)?;

for connection in connections {
write!(out, " {}", connection)?;
}

write!(out, " ) {}", child)?;

Ok(name.clone())
Ok(name)
}

fn write_primitive_subckt<W: Write>(
Expand Down Expand Up @@ -108,7 +109,7 @@ impl HasSpiceLikeNetlist for Spectre {
mut connections: HashMap<ArcStr, impl Iterator<Item = ArcStr>>,
primitive: &<Self as Schema>::Primitive,
) -> std::io::Result<ArcStr> {
match primitive {
Ok(match primitive {
SpectrePrimitive::RawInstance {
cell,
ports,
Expand All @@ -117,20 +118,19 @@ impl HasSpiceLikeNetlist for Spectre {
let connections = ports
.iter()
.flat_map(|port| connections.remove(port).unwrap());
self.write_instance(out, name, connections, cell)?;
let name = self.write_instance(out, name, connections, cell)?;
for (key, value) in params.iter().sorted_by_key(|(key, _)| *key) {
write!(out, " {key}={value}")?;
}
name
}
SpectrePrimitive::ExternalModule { cell, ports, .. } => {
let connections = ports
.iter()
.flat_map(|port| connections.remove(port).unwrap());
self.write_instance(out, name, connections, cell)?;
self.write_instance(out, name, connections, cell)?
}
}

Ok(name.clone())
})
}

fn write_slice<W: Write>(&self, out: &mut W, slice: Slice, info: &SignalInfo) -> Result<()> {
Expand Down

0 comments on commit 152b86f

Please sign in to comment.