You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Autoclonetype converts all hardware types to Chisel types. This can create a situation where the user wrote a Bundle in such a way that they need to have the hardware type preserved. If they rely on this, this can cause a runtime crash.
Consider the following example. Here, I have a tieoff() method in a Bundle named Bar. I chose to parameterize this with the value to tieoff the bundle with. However, if I clone that Bundle, the method no longer works. the tieoff value is now a bare Chisel type.
# scala-cli Bar.scala
Compiling project (Scala 2.13.10, JVM)
Compiled project (Scala 2.13.10, JVM)
default is a: Bool(true)
default is a: Bool
Exception in thread "main" chisel3.package$ExpectedHardwareException: data to be connected 'Bool' must be hardware, not a bare Chisel type. Perhaps you forgot to wrap it in Wire(_) or IO(_)?
at ... ()
at Bar.tieoff(Bar.scala:14)
at Foo.<init>(Bar.scala:22)
at Main$.$anonfun$new$1(Bar.scala:26)
at ... ()
at ... (Stack trace trimmed to user code only. Rerun with --full-stacktrace to see the full stack trace)
The text was updated successfully, but these errors were encountered:
We could probably change autoclonetype to insert a chiselTypeClone(...) (the equivalent of Aligned(...) or the old Field(...) proposal) around val foo = gen and around the implicit val bar = _bar in the case class. Then we would no longer need to clone the constructor arguments which would be more sound and fix this issue.
Autoclonetype converts all hardware types to Chisel types. This can create a situation where the user wrote a
Bundle
in such a way that they need to have the hardware type preserved. If they rely on this, this can cause a runtime crash.Consider the following example. Here, I have a
tieoff()
method in aBundle
namedBar
. I chose to parameterize this with the value to tieoff the bundle with. However, if I clone thatBundle
, the method no longer works. the tieoff value is now a bare Chisel type.The above errors with:
The text was updated successfully, but these errors were encountered: