summaryrefslogtreecommitdiff
path: root/docs/src/explanations
diff options
context:
space:
mode:
authorAditya Naik2022-11-10 13:41:00 -0800
committerGitHub2022-11-10 21:41:00 +0000
commitc51fcfea32b6c73e623657442460fb782ff0733b (patch)
treee4719e6423be01014a6256ff2493039cd66e4cfd /docs/src/explanations
parent17c04998d8cd5eeb4eff9506465fd2d6892793d2 (diff)
Warn on S-interpolator usage for assert, assume and printf (backport #2751) (#2757)
* Add internal methods to maintain binary compatibility Co-authored-by: Megan Wachs <megan@sifive.com> Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'docs/src/explanations')
-rw-r--r--docs/src/explanations/printing.md14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/src/explanations/printing.md b/docs/src/explanations/printing.md
index 71a6f5cf..80e9ec70 100644
--- a/docs/src/explanations/printing.md
+++ b/docs/src/explanations/printing.md
@@ -13,11 +13,23 @@ Chisel provides the `printf` function for debugging purposes. It comes in two fl
### Scala-style
-Chisel also supports printf in a style similar to [Scala's String Interpolation](http://docs.scala-lang.org/overviews/core/string-interpolation.html). Chisel provides a custom string interpolator `cf` which follows C-style format specifiers (see section [C-style](#c-style) below). Here's a few examples of using the `cf` interpolator:
+Chisel also supports printf in a style similar to [Scala's String Interpolation](http://docs.scala-lang.org/overviews/core/string-interpolation.html). Chisel provides a custom string interpolator `cf` which follows C-style format specifiers (see section [C-style](#c-style) below).
+
+Note that the Scala s-interpolator is not supported in Chisel constructs and will issue a compile-time warning:
```scala mdoc:invisible
import chisel3._
```
+
+```scala mdoc:warn
+class MyModule extends Module {
+ val in = IO(Input(UInt(8.W)))
+ printf(s"in = $in\n")
+}
+```
+
+Instead, use Chisel's `cf` interpolator as in the following examples:
+
```scala mdoc:compile-only
val myUInt = 33.U
printf(cf"myUInt = $myUInt") // myUInt = 33