summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3
diff options
context:
space:
mode:
authorJack Koenig2020-02-10 12:28:06 -0800
committerGitHub2020-02-10 20:28:06 +0000
commit9a209b82022a18542260715bc7db777f68ab079f (patch)
tree69baa49e59988b6eba3d1a4616e153fb01d2d202 /chiselFrontend/src/main/scala/chisel3
parent355d11eab572a28b6e010fbb8b13bc1568f5603a (diff)
Printf: Add support for tabs, and give helpful error messages (#1323) (#1326)
Co-authored-by: Megan Wachs <megan@sifive.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/Printf.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/Printf.scala b/chiselFrontend/src/main/scala/chisel3/Printf.scala
index b80d5eb5..0478e889 100644
--- a/chiselFrontend/src/main/scala/chisel3/Printf.scala
+++ b/chiselFrontend/src/main/scala/chisel3/Printf.scala
@@ -19,13 +19,15 @@ object printf { // scalastyle:ignore object.name
require(formatIn forall (c => c.toInt > 0 && c.toInt < 128),
"format strings must comprise non-null ASCII values")
def escaped(x: Char) = {
- require(x.toInt >= 0)
+ require(x.toInt >= 0, s"char ${x} to Int ${x.toInt} must be >= 0")
if (x == '"' || x == '\\') {
s"\\${x}"
} else if (x == '\n') {
"\\n"
+ } else if (x == '\t') {
+ "\\t"
} else {
- require(x.toInt >= 32) // TODO \xNN once FIRRTL issue #59 is resolved
+ require(x.toInt >= 32, s"char ${x} to Int ${x.toInt} must be >= 32") // TODO \xNN once FIRRTL issue #59 is resolved
x
}
}