aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJack Koenig2017-09-29 15:43:15 -0700
committerGitHub2017-09-29 15:43:15 -0700
commit5e23294dc6ac3c1937c9f071f970178c9f724037 (patch)
treeb7f16f9895154ed9bed6dab389793b5731825dee /src/main
parentcd8542d31f20511844c59e08527af73d1e3f6ae1 (diff)
StringLit.verilogEscape should support all printable ASCII chars (#668)
Defined as the range from ' ' to '~' [0x20, 0x7e]
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/firrtl/ir/IR.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/ir/IR.scala b/src/main/scala/firrtl/ir/IR.scala
index 2f37b05a..f2c39f8d 100644
--- a/src/main/scala/firrtl/ir/IR.scala
+++ b/src/main/scala/firrtl/ir/IR.scala
@@ -69,12 +69,12 @@ object StringLit {
/** Maps characters to ASCII for Verilog emission */
private def toASCII(char: Char): List[Char] = char match {
case nonASCII if !nonASCII.isValidByte => List('?')
- case letter if letter.isLetter => List(letter)
- case '\n' => List('\\', 'n')
+ case '"' => List('\\', '"')
case '\\' => List('\\', '\\')
+ case c if c >= ' ' && c <= '~' => List(c)
+ case '\n' => List('\\', 'n')
case '\t' => List('\\', 't')
- case '"' => List('\\', '"')
- case other => List('?')
+ case _ => List('?')
}
/** Create a StringLit from a raw parsed String */