diff options
| author | Kevin Laeufer | 2020-07-15 12:21:26 -0700 |
|---|---|---|
| committer | GitHub | 2020-07-15 19:21:26 +0000 |
| commit | 24be0ac3121e8f5d7b4bf8d6247e305ed0f0a656 (patch) | |
| tree | 9acbdf85c86985921a84fa329838062a78e71588 /src/main/scala/firrtl/Emitter.scala | |
| parent | 005a3d1644742029e744a64c2d9c452969bc64ff (diff) | |
ir: store FileInfo string in escaped format (#1690)
This should speed up the common case
as the compiler never operates on the
unescaped string.
The new escape function also fixes a bug
where ']' was not escaped even though it
is the delimiting character for FileInfo.
In order to maintain backwards
compatibility for the ProtoBuf format,
this patch adds escape/unescape calls
when going from/to protobuf format.
For better performance we should consider
changing the protobuf format.
Diffstat (limited to 'src/main/scala/firrtl/Emitter.scala')
| -rw-r--r-- | src/main/scala/firrtl/Emitter.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/Emitter.scala b/src/main/scala/firrtl/Emitter.scala index 1044f047..b5474769 100644 --- a/src/main/scala/firrtl/Emitter.scala +++ b/src/main/scala/firrtl/Emitter.scala @@ -265,7 +265,12 @@ class VerilogEmitter extends SeqTransform with Emitter { case (i: BigInt) => w write i.toString case (i: Info) => i match { case NoInfo => // Do nothing - case ix => w.write(s" //$ix") + case f: FileInfo => + val escaped = FileInfo.escapedToVerilog(f.escaped) + w.write(s" // @[$escaped]") + case m: MultiInfo => + val escaped = FileInfo.escapedToVerilog(m.flatten.map(_.escaped).mkString(" ")) + w.write(s" // @[$escaped]") } case (s: Seq[Any]) => s foreach (emit(_, top + 1)) |
