Bad error reporting on wrong (subword) assignments
See original GitHub issueType 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:
- Start with chisel-template (commit
11f6ca470120908d167cb8dc3241953eb31d0acb
was used for this experiment) - Create a new file in
src/main/scala/gcd/Bug.scala
(see content below) - Run
sbt "runMain gcd.BugDriver"
to reproduce the output. - 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
[[35minfo[0m] [0.002] Elaborating design...
[[31merror[0m] 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.
[[31merror[0m] ...
[[31merror[0m] at gcd.BugModule.<init>(Bug.scala:14)
[[31merror[0m] at gcd.BugDriver$.$anonfun$new$1(Bug.scala:19)
[[31merror[0m] ... (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
[[35minfo[0m] [0.002] Elaborating design...
[[31merror[0m] java.lang.IllegalArgumentException: requirement failed
[[31merror[0m] ...
[[31merror[0m] at gcd.BugModule.<init>(Bug.scala:14)
[[31merror[0m] at gcd.BugDriver$.$anonfun$new$1(Bug.scala:19)
[[31merror[0m] ... (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
[[35minfo[0m] [0.002] Elaborating design...
[[31merror[0m] Bits.scala:160: Invalid bit range (15,-1) in class chisel3.Bits
[[31merror[0m] There were [31m1 error(s)[0m during hardware elaboration.
[[31merror[0m] chisel3.internal.ChiselException: Fatal errors during hardware elaboration
[[31merror[0m] ...
[[31merror[0m] ... (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
[[35minfo[0m] [0.002] Elaborating design...
[[35minfo[0m] [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:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
This was discussed in the developer meeting today with two proposals put forward:
ChiselMain
to allow for users to pass annotationsInt
andString
) 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.I search for documents and finally found usage of
ChiselMain
here. I suggest add this to the tutorial documents.