Hi all,
As in the Chisel 3.5.0-RC1 release note https://github.com/chipsalliance/chisel3/releases,
the val io in Module is now deprecated, for solving issues with Scala 2.13 compatibility as discussed in https://github.com/chipsalliance/chisel3/pull/1550.
And it was mentioned in https://github.com/chipsalliance/chisel3/blob/8a73362bb6fe87817a1867cc2482c1841f95c077/core/src/main/scala/chisel3/RawModule.scala#L156
that the “val io” is now by Java or Scala reflection.
However, this reflection mechanism don’t seem to have worked for me and I got the error as titled for this code:
class PeArrayWithDelay[T <: chisel3.Data: Ring]( p: SsagParams[T]) extends Module {
val peArray = p.dx match {
case false => Module(new PeArraySx(p))
case true =>
val x = Module(new PeArrayDx(p))
x.io.clockDx := io.clockDx.get
x
}
dlyA.zipWithIndex.foreach { case (x, i) => peArray.io.inA(i) <> x } // <== error, io not a member
I did eventually figured out a workaround, since it was mentioned the original val io was a virtual method, I injected a method named io like this:
trait WithIO extends Module {
def io: Bundle
}
then in the instantiation lines:
val peArray = p.dx match {
case false => Module(new PeArraySx(p) with WithIO)
case true =>
val x = Module(new PeArrayDx(p) with WithIO)
x.io.clockDx := io.clockDx.get
x
}
Question is, is this even a proper workaround?
And why did the reflection not work in the first place?
(BTW if there’s no other workaround, maybe this should be in FAQ/Cookbook?)
Best regards,
Sam
--
You received this message because you are subscribed to the Google Groups "chisel-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/8264c38f-acff-4eec-ae3b-5e98378456d9n%40googlegroups.com.