Don't instantiate Module()s inside when() statements

4 views
Skip to first unread message

Øyvind Harboe

unread,
Dec 16, 2021, 12:02:57 PM12/16/21
to chisel-users
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.
Reply all
Reply to author
Forward
0 new messages