diff --git a/src/rtlil.rs b/src/rtlil.rs index 29519ca..083deb2 100644 --- a/src/rtlil.rs +++ b/src/rtlil.rs @@ -63,7 +63,7 @@ impl SigSpec { impl std::fmt::Display for SigSpec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - SigSpec::Const(val, width) => write!(f, "{}'{}", width, val)?, + SigSpec::Const(val, width) => write!(f, "{0}'{2:01$b}", width, *width as usize, val)?, SigSpec::Wire(id) => write!(f, "{}", id)?, }; Ok(())