chipsalliance / chipsalliance/chisel

Error Message Unhelpful When Annotating Literals

Open
#2,145 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

**Type of issue**: bug report

**Impact**: no functional change

**Development Phase**: request

**Other information**

```
firrtl.annotations.AnnotationException: Illegal component name: UInt<2>("h03")
at firrtl.annotations.ComponentName.(Target.scala:839)
at chisel3.internal.NamedComponent.toNamed(Builder.scala:300)
at chisel3.internal.NamedComponent.toNamed$(Builder.scala:299)
at chisel3.Data.toNamed(Data.scala:339)
at chisel3.dontTouch$$anon$1.toFirrtl(dontTouch.scala:39)
at chisel3.dontTouch$$anon$1.toFirrtl(dontTouch.scala:39)
at chisel3.internal.firrtl.Circuit.$anonfun$firrtlAnnotations$1(IR.scala:806)
at scala.collection.immutable.List.flatMap(List.scala:293)
at scala.collection.immutable.List.flatMap(List.scala:79)
at chisel3.internal.firrtl.Circuit.firrtlAnnotations(IR.scala:806)
at chisel3.stage.phases.Convert.$anonfun$transform$1(Convert.scala:30)
at scala.collection.immutable.List.flatMap(List.scala:293)
at scala.collection.immutable.List.flatMap(List.scala:79)
at chisel3.stage.phases.Convert.transform(Convert.scala:24)
at chisel3.stage.phases.Convert.transform(Convert.scala:17)
at firrtl.options.DependencyManager.$anonfun$transform$5(DependencyManager.scala:280)
at firrtl.Utils$.time(Utils.scala:181)
at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:280)
at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
at scala.collection.immutable.List.foldLeft(List.scala:79)
at firrtl.options.DependencyManager.transform(DependencyManager.scala:269)
at firrtl.options.DependencyManager.transform$(DependencyManager.scala:255)
at firrtl.options.PhaseManager.transform(DependencyManager.scala:443)
at chisel3.stage.ChiselStage$.emitVerilog(ChiselStage.scala:240)
at chisel3.getVerilogString$.apply(verilog.scala:7)
at Playground$.delayedEndpoint$Playground$1(main.scala:15)
at Playground$delayedInit$body.apply(main.scala:2)
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at scala.Function0.apply$mcV$sp$(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.App.$anonfun$main$1(App.scala:76)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at Playground$.main(main.scala:2)
at Main$.main(main.scala:21)
at Main.main(main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.Run.invokeMain(Run.scala:133)
at sbt.Run.execute$1(Run.scala:82)
at sbt.Run.$anonfun$runWithLoader$5(Run.scala:110)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:17)
at sbt.TrapExit$App.run(TrapExit.scala:258)
at java.lang.Thread.run(Thread.java:748)
```

**If the current behavior is a bug, please provide the steps to reproduce the problem:**
https://scastie.scala-lang.org/Yp73iZvSSaaQiViJAHyAZQ

**What is the current behavior?**
Annotating a literal value does not provide a helpful enough error message to pinpoint the offending code.

**What is the expected behavior?**
The error message should give the file and line number of the offending code.

**Please tell us about your environment:**

**What is the use case for changing the behavior?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.