sifive / chisel-circt

Library to compile Chisel circuits using LLVM/MLIR (CIRCT)
Apache License 2.0
70 stars 10 forks source link

No error message when using BoringUtils #24

Closed oharboe closed 1 year ago

oharboe commented 2 years ago

I don't get these error messages from firtool displayed on the command line, only an exception dump when I run my design through chisel-circt:

circuit AptosNode :
^
<stdin>:1:1: warning: Unhandled annotation: {class = "firrtl.passes.wiring.SinkAnnotation", pin = "bore_120", target = "FooNode.Injector_Anon_1.wire.bar[2]"}
seldridge commented 2 years ago

This is firtool's standard, "I don't know what this annotation is" error message. Similar to #23, this should look better on top-of-tree chisel-circt:

[info] running circt.stage.phases.Foo 
Running CIRCT: 'firtool -format=fir -warn-on-unprocessed-annotations -verify-each=false -disable-infer-rw -annotation-file Foo.anno.json < $input'
------------------------------------------------------------------------------
Error: firtool failed.
ExitCode:
1
STDOUT:

STDERR:
<stdin>:1:1: error: Unhandled annotation: {class = "firrtl.passes.wiring.SourceAnnotation", pin = "bore", target = "Foo.Foo.a"}
circuit Foo :
^
<stdin>:1:1: error: Unhandled annotation: {class = "firrtl.passes.wiring.SinkAnnotation", pin = "bore", target = "Foo.Foo.b"}
circuit Foo :
^

------------------------------------------------------------------------------
[error] (run-main-2) firrtl.options.StageError: 
[error] firrtl.options.StageError: 
[error]     at circt.stage.phases.CIRCT.transform(CIRCT.scala:179)
[error]     at circt.stage.phases.CIRCT.transform(CIRCT.scala:45)

For:

object Foo extends App {
  import chisel3._

  class Foo extends RawModule {
    val a = Wire(Bool())
    val b = Wire(Bool())

    chisel3.util.experimental.BoringUtils.bore(a, Seq(b))
  }

  (new circt.stage.ChiselStage)
    .execute(
      Array("--target", "systemverilog"),
      Seq(chisel3.stage.ChiselGeneratorAnnotation(() => new Foo))
    )

}

I admit that this error message isn't amazing and could be improved. As old APIs start to get deprecated, we can improve this by catching (in chisel-circt) when we see Annotations that are known to be used by deprecated APIs and error out. That should enable a better debug loop than having firtool say, "I don't know what this is", while also not having to teach firtool about every deprecated Annotation.

seldridge commented 1 year ago

BoringUtils was fully migrated to CIRCT and this should now work.