question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bad error reporting on wrong (subword) assignments

See original GitHub issue

Type of issue: other enhancement

Impact: no functional change

Development Phase: request

Other information This is more a meta-issue mostly related to the beginners user experience. I think most of these issues are not done by more experienced devs.

If the current behavior is a bug, please provide the steps to reproduce the problem:

  1. Start with chisel-template (commit 11f6ca470120908d167cb8dc3241953eb31d0acb was used for this experiment)
  2. Create a new file in src/main/scala/gcd/Bug.scala (see content below)
  3. Run sbt "runMain gcd.BugDriver" to reproduce the output.
  4. See how the error reporting explain (or does not explain) the bad assignment.

What is the current behavior?

These are examples where the error reporting is (IMHO) bad / misleading.


Wrong transfer direction:

package gcd

import chisel3._
import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage}

class BugModule extends Module {
  val io = IO(new Bundle {
    val in  = Input(UInt(16.W))
    val out = Output(UInt(16.W))
  })

  io.in := io.out
}


object BugDriver extends App {
  (new ChiselStage).execute(args, Seq(ChiselGeneratorAnnotation(() => new BugModule)))
}
[info] Loading settings for project chisel_bad_error-build from plugins.sbt ...
[info] Loading project definition from /home/tom/src/bugs/chisel_bad_error/project
[info] Loading settings for project chisel_bad_error from build.sbt ...
[info] Set current project to chisel-module-template (in build file:/home/tom/src/bugs/chisel_bad_error/)
[info] Compiling 1 Scala source to /home/tom/src/bugs/chisel_bad_error/target/scala-2.12/classes ...
[warn] there were two feature warnings; re-run with -feature for details
[warn] one warning found
[info] Done compiling.
[info] running gcd.BugDriver 
[info] [0.002] Elaborating design...
[error] chisel3.internal.ChiselException: Connection between sink (UInt<16>(IO in unelaborated BugModule)) and source (UInt<16>(IO in unelaborated BugModule)) failed @: Sink is unwriteable by current module.
[error] 	...
[error] 	at gcd.BugModule.<init>(Bug.scala:14)
[error] 	at gcd.BugDriver$.$anonfun$new$1(Bug.scala:19)
[error] 	... (Stack trace trimmed to user code only, rerun with --full-stacktrace if you wish to see the full stack trace)
[error] (run-main-0) firrtl.options.StageError: 
[error] firrtl.options.StageError: 
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:49)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] Caused by: chisel3.internal.ChiselException: Connection between sink (UInt<16>(IO in unelaborated BugModule)) and source (UInt<16>(IO in unelaborated BugModule)) failed @: Sink is unwriteable by current module.
[error] 	at chisel3.internal.throwException$.apply(Error.scala:85)
[error] 	at chisel3.Data.connect(Data.scala:406)
[error] 	at chisel3.Data.$colon$eq(Data.scala:494)
[error] 	at gcd.BugModule.<init>(Bug.scala:14)
[error] 	at gcd.BugDriver$.$anonfun$new$1(Bug.scala:19)
[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$1(Builder.scala:408)
[error] 	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
[error] 	at chisel3.internal.Builder$.build(Builder.scala:406)
[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:245)
[error] 	at scala.collection.immutable.List.foreach(List.scala:392)
[error] 	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:245)
[error] 	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:242)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[error] 	at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:262)
[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.DependencyManager.transform(DependencyManager.scala:255)
[error] 	at firrtl.options.DependencyManager.transform$(DependencyManager.scala:240)
[error] 	at firrtl.options.PhaseManager.transform(DependencyManager.scala:419)
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:35)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] stack trace is suppressed; run 'last Compile / bgRunMain' for the full output
[error] Nonzero exit code: 1
[error] (Compile / runMain) Nonzero exit code: 1
[error] Total time: 8 s, completed Jun 6, 2020 1:59:07 PM

Flipped bounds:

package gcd

import chisel3._
import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage}

class BugModule extends Module {
  val io = IO(new Bundle {
    val in  = Input(UInt(16.W))
    val out = Output(UInt(16.W))
  })

  io.out := io.in(0, 15)
}


object BugDriver extends App {
  (new ChiselStage).execute(args, Seq(ChiselGeneratorAnnotation(() => new BugModule)))
}
[info] Loading settings for project chisel_bad_error-build from plugins.sbt ...
[info] Loading project definition from /home/tom/src/bugs/chisel_bad_error/project
[info] Loading settings for project chisel_bad_error from build.sbt ...
[info] Set current project to chisel-module-template (in build file:/home/tom/src/bugs/chisel_bad_error/)
[info] running gcd.BugDriver 
[info] [0.002] Elaborating design...
[error] java.lang.IllegalArgumentException: requirement failed
[error] 	...
[error] 	at gcd.BugModule.<init>(Bug.scala:14)
[error] 	at gcd.BugDriver$.$anonfun$new$1(Bug.scala:19)
[error] 	... (Stack trace trimmed to user code only, rerun with --full-stacktrace if you wish to see the full stack trace)
[error] (run-main-0) firrtl.options.StageError: 
[error] firrtl.options.StageError: 
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:49)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] Caused by: chisel3.internal.ChiselException: 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:245)
[error] 	at scala.collection.immutable.List.foreach(List.scala:392)
[error] 	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:245)
[error] 	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:242)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[error] 	at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:262)
[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.DependencyManager.transform(DependencyManager.scala:255)
[error] 	at firrtl.options.DependencyManager.transform$(DependencyManager.scala:240)
[error] 	at firrtl.options.PhaseManager.transform(DependencyManager.scala:419)
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:35)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] Caused by: java.lang.IllegalArgumentException: requirement failed
[error] 	at scala.Predef$.require(Predef.scala:268)
[error] 	at chisel3.internal.firrtl.KnownWidth.<init>(IR.scala:182)
[error] 	at chisel3.internal.firrtl.Width$.apply(IR.scala:156)
[error] 	at chisel3.Bits.$anonfun$do_apply$6(Bits.scala:169)
[error] 	at scala.Option.getOrElse(Option.scala:189)
[error] 	at chisel3.Bits.do_apply(Bits.scala:167)
[error] 	at gcd.BugModule.<init>(Bug.scala:14)
[error] 	at gcd.BugDriver$.$anonfun$new$1(Bug.scala:19)
[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$1(Builder.scala:408)
[error] 	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
[error] 	at chisel3.internal.Builder$.build(Builder.scala:406)
[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:245)
[error] 	at scala.collection.immutable.List.foreach(List.scala:392)
[error] 	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:245)
[error] 	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:242)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[error] 	at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:262)
[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.DependencyManager.transform(DependencyManager.scala:255)
[error] 	at firrtl.options.DependencyManager.transform$(DependencyManager.scala:240)
[error] 	at firrtl.options.PhaseManager.transform(DependencyManager.scala:419)
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:35)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] stack trace is suppressed; run 'last Compile / bgRunMain' for the full output
[error] Nonzero exit code: 1
[error] (Compile / runMain) Nonzero exit code: 1
[error] Total time: 5 s, completed Jun 6, 2020 2:06:53 PM

Negative bounds:

package gcd

import chisel3._
import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage}

class BugModule extends Module {
  val io = IO(new Bundle {
    val in  = Input(UInt(16.W))
    val out = Output(UInt(16.W))
  })

  io.out := io.in(15, -1)
}


object BugDriver extends App {
  (new ChiselStage).execute(args, Seq(ChiselGeneratorAnnotation(() => new BugModule)))
}
[info] Loading settings for project chisel_bad_error-build from plugins.sbt ...
[info] Loading project definition from /home/tom/src/bugs/chisel_bad_error/project
[info] Loading settings for project chisel_bad_error from build.sbt ...
[info] Set current project to chisel-module-template (in build file:/home/tom/src/bugs/chisel_bad_error/)
[info] running gcd.BugDriver 
[info] [0.002] Elaborating design...
[error] Bits.scala:160: Invalid bit range (15,-1) in class chisel3.Bits
[error] There were 1 error(s) during hardware elaboration.
[error] chisel3.internal.ChiselException: Fatal errors during hardware elaboration
[error] 	...
[error] 	... (Stack trace trimmed to user code only, rerun with --full-stacktrace if you wish to see the full stack trace)
[error] (run-main-0) firrtl.options.StageError: 
[error] firrtl.options.StageError: 
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:49)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] Caused by: chisel3.internal.ChiselException: Fatal errors during hardware elaboration
[error] 	at chisel3.internal.throwException$.apply(Error.scala:85)
[error] 	at chisel3.internal.ErrorLog.checkpoint(Error.scala:152)
[error] 	at chisel3.internal.Builder$.$anonfun$build$1(Builder.scala:410)
[error] 	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
[error] 	at chisel3.internal.Builder$.build(Builder.scala:406)
[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:245)
[error] 	at scala.collection.immutable.List.foreach(List.scala:392)
[error] 	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:245)
[error] 	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:242)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[error] 	at firrtl.options.phases.DeletedWrapper.transform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:262)
[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.DependencyManager.transform(DependencyManager.scala:255)
[error] 	at firrtl.options.DependencyManager.transform$(DependencyManager.scala:240)
[error] 	at firrtl.options.PhaseManager.transform(DependencyManager.scala:419)
[error] 	at chisel3.stage.ChiselStage.run(ChiselStage.scala:35)
[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:37)
[error] 	at firrtl.options.phases.DeletedWrapper.internalTransform(DeletedWrapper.scala:15)
[error] 	at firrtl.options.Translator.transform(Phase.scala:240)
[error] 	at firrtl.options.Translator.transform$(Phase.scala:240)
[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.execute(Stage.scala:57)
[error] 	at gcd.BugDriver$.delayedEndpoint$gcd$BugDriver$1(Bug.scala:19)
[error] 	at gcd.BugDriver$delayedInit$body.apply(Bug.scala:18)
[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 gcd.BugDriver$.main(Bug.scala:18)
[error] 	at gcd.BugDriver.main(Bug.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] stack trace is suppressed; run 'last Compile / bgRunMain' for the full output
[error] Nonzero exit code: 1
[error] (Compile / runMain) Nonzero exit code: 1
[error] Total time: 4 s, completed Jun 6, 2020 2:09:08 PM

What is the expected behavior?

These are examples where the error reporting (IMHO) is clear and precise.


High bit out of bounds:

package gcd

import chisel3._
import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage}

class BugModule extends Module {
  val io = IO(new Bundle {
    val in  = Input(UInt(16.W))
    val out = Output(UInt(16.W))
  })

  io.out := io.in(16, 0)
}


object BugDriver extends App {
  (new ChiselStage).execute(args, Seq(ChiselGeneratorAnnotation(() => new BugModule)))
}
[info] Loading settings for project chisel_bad_error-build from plugins.sbt ...
[info] Loading project definition from /home/tom/src/bugs/chisel_bad_error/project
[info] Loading settings for project chisel_bad_error from build.sbt ...
[info] Set current project to chisel-module-template (in build file:/home/tom/src/bugs/chisel_bad_error/)
[info] running gcd.BugDriver 
[info] [0.002] Elaborating design...
[info] [0.097] Done elaborating.
Computed transform order in: 397.3 ms
[error] (run-main-0) firrtl.passes.CheckWidths$BitsWidthException:  @[Bug.scala 14:18]: [target ~BugModule|BugModule] High bit 16 in bits operator is larger than input width 16 in bits(io.in, 16, 0).
[error] firrtl.passes.CheckWidths$BitsWidthException:  @[Bug.scala 14:18]: [target ~BugModule|BugModule] High bit 16 in bits operator is larger than input width 16 in bits(io.in, 16, 0).
[error] stack trace is suppressed; run 'last Compile / bgRunMain' for the full output
[error] Nonzero exit code: 1
[error] (Compile / runMain) Nonzero exit code: 1
[error] Total time: 4 s, completed Jun 6, 2020 2:02:18 PM

Please tell us about your environment: See linked chisel-template commit.

What is the use case for changing the behavior? New-user experience.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
seldridgecommented, Jun 8, 2020

This was discussed in the developer meeting today with two proposals put forward:

  1. One or more new methods should be added to ChiselMain to allow for users to pass annotations
  2. Add the ability for passing module construction parameters (for at least Int and String) on the command line to enable, e.g., runMain chisel3.stage.ChiselMain --module gcd.BugModule --parameters 8,"foo". Automatic serialization libraries, like json4s may provide serialization/deserialization abilities.
0reactions
kele14xcommented, Nov 26, 2021

I search for documents and finally found usage of ChiselMain here. I suggest add this to the tutorial documents.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving error messages with pyparsing - Stack Overflow
1 Answer 1 ... Pyparsing will always have somewhat bad error messages, because it backtracks. The error message is generated in the last...
Read more >
Java Software Errors: How to Avoid 50 Code Issues in Java
We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common...
Read more >
Bug Patterns - Error Prone
Each bug pattern includes code examples of both positive and negative cases; these examples are used in our regression test suite.
Read more >
Compiler Error Messages Considered Unhelpful
Undefined behaviour can include data corruption, arbitrary program behaviour, simply returning incorrect results, or crashing without a message reporting the ...
Read more >
Compile and Runtime Errors in Java
Chapter 2 lists the error messages from the compiler and describes typical mistakes that give rise to them. Chapter 3 does the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found