I am fairly new to Chisel, and is currently attempting to rewrite a Chisel project from Chisel 3.4 to 3.5. The issue I have faced is the project initializes IO()'s with a custom class that extends a bundle like this:
Component with IO:
val io = IO(new GenericInterface(n) {
val input = Input(Bool())
})
Interface:
class GenericInterface(n: Int) extends Bundle {
val out = Output(UInt(n.W))
}
My issue is that I am unable to access io.input
in the component. My current workaround is creating two separate io's, but this seems like a suboptimal solution at best. Is there a more pleasing workaround than the one below?
val io = IO(new GenericInterface(n))
val io2 = IO(new Bundle {
val input = Input(Bool())
})
Can you try making the second bundle a non-anonymous class? More recent versions of Scala have less support for "structural types" which essentially means that it is often best to name all classes.
Try to see if the following works for you:
class GenericInterface(n: Int) extends Bundle {
val out = Output(UInt(n.W))
}
class MyModuleIO(n: Int) extends GenericInterface(n) {
val input = Input(Bool())
}
class MyModule extends Module {
val io = IO(new MyModuleIO(...))
}