-
Notifications
You must be signed in to change notification settings - Fork 76
fix: S-interpolator for assert, assume and printf #558
Conversation
Unfortunately this changes the functionality of the code since it will now print out |
val msg = s"Expected $expected, got %x.\n" // this works around the fact that s".." is forbidden in the assert | ||
assert(reader.io.out === expected.U, msg, reader.io.out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val msg = s"Expected $expected, got %x.\n" // this works around the fact that s".." is forbidden in the assert | |
assert(reader.io.out === expected.U, msg, reader.io.out) | |
assert(reader.io.out === expected.U, cf"Expected ${expected.toString}, got ${reader.io.out}%x.\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot
You can either split out the |
I would prefer not to call |
Never mind, I found it: https://www.chisel-lang.org/chisel3/docs/explanations/printing.html |
Until fairly recently, |
Hi Jack, thanks for your help. But there is one thing that I'm quite confused about. Why do we need to explicitly In that case, is the following code correct? val intA: Int = 10
val uIntB: UInt = intA.U
print(cf"intA=${intA.toString} and uIntB=$uIntB")
printf(cf"" + s"intA=$intA and " + cf"uIntB=$uIntB") // the first cf is used to avoid compile error |
To fix the errors in chipsalliance/chisel#2751.