how to read the firrtl stack trace

60 views
Skip to first unread message

Jerry Ho

unread,
Oct 25, 2020, 11:00:43 AM10/25/20
to RISC-V HW Dev
I was learning chisel, and wrote some buggy code:
class Hello extends Module{

val io = IO(new Bundle() {
val in_1 = UInt(32.W)
val in_2 = UInt(32.W)
val out = UInt(64.W)

})
val reg_1 = RegInit(io.in_1)
val reg_2 = RegInit(io.in_2)

val result = Wire(UInt(64.W))
result := reg_1 * reg_2
io.out :=  result   

}


object Hello extends App{
chisel3.Driver.execute(Array[String](), () => new Hello())
}

and when I run the sbt run, the firrtl complains the following:



[info] running Hello [info] [0.003] Elaborating design... [error] (run-main-0) firrtl.options.OptionsException: Exception thrown when elaborating ChiselGeneratorAnnotation [error] firrtl.options.OptionsException: Exception thrown when elaborating ChiselGeneratorAnnotation [error] at chisel3.stage.ChiselGeneratorAnnotation.elaborate(ChiselAnnotations.scala:55) [error] at chisel3.stage.phases.Elaborate.$anonfun$transform$1(Elaborate.scala:19) [error] at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:244) [error] at scala.collection.immutable.List.foreach(List.scala:392) [error] at scala.collection.TraversableLike.flatMap(TraversableLike.scala:244) [error] at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:241) [error] at scala.collection.immutable.List.flatMap(List.scala:355) [error] at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:18) [error] at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:16) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:32) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:140) [error] at firrtl.options.Translator.transform$(Phase.scala:140) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at chisel3.stage.ChiselStage.$anonfun$run$2(ChiselStage.scala:33) [error] at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) [error] at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) [error] at scala.collection.immutable.List.foldLeft(List.scala:89) [error] at chisel3.stage.ChiselStage.run(ChiselStage.scala:33) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:32) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:140) [error] at firrtl.options.Translator.transform$(Phase.scala:140) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at firrtl.options.Stage.$anonfun$transform$5(Stage.scala:46) [error] at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) [error] at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) [error] at scala.collection.immutable.List.foldLeft(List.scala:89) [error] at firrtl.options.Stage.$anonfun$transform$3(Stage.scala:46) [error] at logger.Logger$.$anonfun$makeScope$2(Logger.scala:168) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) [error] at logger.Logger$.makeScope(Logger.scala:166) [error] at firrtl.options.Stage.transform(Stage.scala:46) [error] at firrtl.options.Stage.transform(Stage.scala:17) [error] at chisel3.Driver$.$anonfun$execute$1(Driver.scala:226) [error] at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) [error] at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) [error] at scala.collection.immutable.List.foldLeft(List.scala:89) [error] at chisel3.Driver$.execute(Driver.scala:226) [error] at chisel3.Driver$.execute(Driver.scala:249) [error] at Hello$.delayedEndpoint$Hello$1(Hello.scala:36) [error] at Hello$delayedInit$body.apply(Hello.scala:35) [error] at scala.Function0.apply$mcV$sp(Function0.scala:39) [error] at scala.Function0.apply$mcV$sp$(Function0.scala:39) [error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17) [error] at scala.App.$anonfun$main$1$adapted(App.scala:80) [error] at scala.collection.immutable.List.foreach(List.scala:392) [error] at scala.App.main(App.scala:80) [error] at scala.App.main$(App.scala:78) [error] at Hello$.main(Hello.scala:35) [error] at Hello.main(Hello.scala) [error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [error] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [error] Caused by: java.lang.RuntimeException: Unexpected port element direction 'Unspecified' [error] at chisel3.internal.BindingDirection$.from(Binding.scala:54) [error] at chisel3.internal.MonoConnect$.elemConnect(MonoConnect.scala:184) [error] at chisel3.internal.MonoConnect$.connect(MonoConnect.scala:83) [error] at chisel3.Data.connect(Data.scala:384) [error] at chisel3.Data.$colon$eq(Data.scala:475) [error] at Hello.<init>(Hello.scala:30) [error] at Hello$.$anonfun$new$1(Hello.scala:36) [error] at chisel3.Module$.do_apply(Module.scala:52) [error] at chisel3.stage.ChiselGeneratorAnnotation.$anonfun$elaborate$1(ChiselAnnotations.scala:50) [error] at chisel3.internal.Builder$.$anonfun$build$2(Builder.scala:406) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) [error] at chisel3.internal.Builder$.$anonfun$build$1(Builder.scala:404) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) [error] at chisel3.internal.Builder$.build(Builder.scala:404) [error] at chisel3.stage.ChiselGeneratorAnnotation.elaborate(ChiselAnnotations.scala:50) [error] at chisel3.stage.phases.Elaborate.$anonfun$transform$1(Elaborate.scala:19) [error] at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:244) [error] at scala.collection.immutable.List.foreach(List.scala:392) [error] at scala.collection.TraversableLike.flatMap(TraversableLike.scala:244) [error] at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:241) [error] at scala.collection.immutable.List.flatMap(List.scala:355) [error] at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:18) [error] at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:16) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:32) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:140) [error] at firrtl.options.Translator.transform$(Phase.scala:140) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at chisel3.stage.ChiselStage.$anonfun$run$2(ChiselStage.scala:33) [error] at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) [error] at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) [error] at scala.collection.immutable.List.foldLeft(List.scala:89) [error] at chisel3.stage.ChiselStage.run(ChiselStage.scala:33) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.Stage$$anon$1.transform(Stage.scala:43) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:32) [error] at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15) [error] at firrtl.options.Translator.transform(Phase.scala:140) [error] at firrtl.options.Translator.transform$(Phase.scala:140) [error] at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15) [error] at firrtl.options.Stage.$anonfun$transform$5(Stage.scala:46) [error] at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) [error] at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) [error] at scala.collection.immutable.List.foldLeft(List.scala:89) [error] at firrtl.options.Stage.$anonfun$transform$3(Stage.scala:46) [error] at logger.Logger$.$anonfun$makeScope$2(Logger.scala:168) [error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) [error] at logger.Logger$.makeScope(Logger.scala:166) [error] at firrtl.options.Stage.transform(Stage.scala:46) [error] at firrtl.options.Stage.transform(Stage.scala:17) [error] at chisel3.Driver$.$anonfun$execute$1(Driver.scala:226) [error] at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126) [error] at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122) [error] at scala.collection.immutable.List.foldLeft(List.scala:89) [error] at chisel3.Driver$.execute(Driver.scala:226) [error] at chisel3.Driver$.execute(Driver.scala:249) [error] at Hello$.delayedEndpoint$Hello$1(Hello.scala:36) [error] at Hello$delayedInit$body.apply(Hello.scala:35) [error] at scala.Function0.apply$mcV$sp(Function0.scala:39) [error] at scala.Function0.apply$mcV$sp$(Function0.scala:39) [error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17) [error] at scala.App.$anonfun$main$1$adapted(App.scala:80) [error] at scala.collection.immutable.List.foreach(List.scala:392) [error] at scala.App.main(App.scala:80) [error] at scala.App.main$(App.scala:78) [error] at Hello$.main(Hello.scala:35) [error] at Hello.main(Hello.scala) [error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [error] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [error] stack trace is suppressed; run 'last Compile / bgRun' for the full output [error] Nonzero exit code: 1 [error] (Compile / run) Nonzero exit code: 1 [error] Total time: 3 s


and it took me lots of time to figure out that I left out the Input() and Output()call inside the Iodef, but the firrtl's stack trace is very confusing for me to figure this simple mistake out.I wonder if there are some best practice for me to follow when reading the firrtl stack trace.

Jack Koenig

unread,
Oct 25, 2020, 3:39:02 PM10/25/20
to RISC-V HW Dev
I've answered this question on chisel-users which I feel is a better venue: https://groups.google.com/g/chisel-users/c/vHCA1YxN25Q/m/JC7zIkTWBAAJ

~Jack

--
You received this message because you are subscribed to the Google Groups "RISC-V HW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hw-dev+un...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/hw-dev/fd5ae20a-358f-4104-b6e2-4503b1ec92e9n%40groups.riscv.org.
Reply all
Reply to author
Forward
0 new messages