So I did this and I got no compilation error, but of course it didn't work.
This made me curious: what does the below mean?
What are the inputs to this module outside of the when() clause?
when (foo) {
val bar = Module(Bar())
bar.xxx := true.B
...
}
A bit more backround:
I have a def validate() function which expands to an assert(), where I wanted to place the assert and the code into a Validate() module to clean up RTL views. Hence I inadvertedly ended up with the module instantiation inside the when() statement.