From 26564304e028a015bdcb9f1a6889f7847a3a5140 Mon Sep 17 00:00:00 2001 From: Kevin Laeufer Date: Tue, 7 Jul 2020 16:09:39 -0700 Subject: verification: emit mesage as Verilog comment (#1712) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>--- src/main/scala/firrtl/Emitter.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/scala/firrtl/Emitter.scala b/src/main/scala/firrtl/Emitter.scala index 47d8c7d1..1044f047 100644 --- a/src/main/scala/firrtl/Emitter.scala +++ b/src/main/scala/firrtl/Emitter.scala @@ -459,7 +459,7 @@ class VerilogEmitter extends SeqTransform with Emitter { def addFormalStatement(formals: mutable.Map[Expression, ArrayBuffer[Seq[Any]]], clk: Expression, en: Expression, - stmt: Seq[Any], info: Info): Unit = { + stmt: Seq[Any], info: Info, msg: StringLit): Unit = { throw EmitterException("Cannot emit verification statements in Verilog" + "(2001). Use the SystemVerilog emitter instead.") } @@ -828,8 +828,8 @@ class VerilogEmitter extends SeqTransform with Emitter { lines += Seq("`endif // SYNTHESIS") } - def addFormal(clk: Expression, en: Expression, stmt: Seq[Any], info: Info) = { - addFormalStatement(formals, clk, en, stmt, info) + def addFormal(clk: Expression, en: Expression, stmt: Seq[Any], info: Info, msg: StringLit): Unit = { + addFormalStatement(formals, clk, en, stmt, info, msg) } def formalStatement(op: Formal.Value, cond: Expression): Seq[Any] = { @@ -940,7 +940,7 @@ class VerilogEmitter extends SeqTransform with Emitter { case sx: Print => simulate(sx.clk, sx.en, printf(sx.string, sx.args), Some("PRINTF_COND"), sx.info) case sx: Verification => - addFormal(sx.clk, sx.en, formalStatement(sx.op, sx.pred), sx.info) + addFormal(sx.clk, sx.en, formalStatement(sx.op, sx.pred), sx.info, sx.msg) // If we are emitting an Attach, it must not have been removable in VerilogPrep case sx: Attach => // For Synthesis @@ -1260,8 +1260,9 @@ class SystemVerilogEmitter extends VerilogEmitter { override def addFormalStatement(formals: mutable.Map[Expression, ArrayBuffer[Seq[Any]]], clk: Expression, en: Expression, - stmt: Seq[Any], info: Info): Unit = { + stmt: Seq[Any], info: Info, msg: StringLit): Unit = { val lines = formals.getOrElseUpdate(clk, ArrayBuffer[Seq[Any]]()) + lines += Seq("// ", msg.serialize) lines += Seq("if (", en, ") begin") lines += Seq(tab, stmt, info) lines += Seq("end") -- cgit v1.2.3