I'm trying to instantiate one of two chisel Module according to boolean parameter.
val useLib = true
val myModule = if(useLib) Module(new MyModule1()) else Module (new MyModule2())
But that doesn't work. Chisel doesn't recognize io interface :
[error] /path/to/source/mysource.scala:59:13: value io is not a member of Any
[error] myModule.io.pdm <> io.pdm
[error] ^
And of course, MyModule1() and MyModule2() have same io interfaces.
Is it possible to conditionally instantiate Module() as we do with preprocessor in C or C++ ?