Open bpfoley opened 4 years ago
I think there were a few other example of unnecessarily repetitive code (as opposed to the necessarily centralized schedule), beyond the clock and reset handling, but I can't see them when generating C++ code from this example. I don't know if that means something was fixed or if there's another wrinkle that comes up in more complex designs so I'd suggest keeping a eye out for things like that.
As an example, compile the attached test.
It consists of a top level
mkTest
module, which instantiates 4mkB
modules, each of which in turn instantiates 2mkA
modules.In the generated C++, the code to wire up the clocks and trigger the reset for every single module is put in the top level, giving us 4(2+1) clock wiring statements, and 42 reset clock ticking statements.
This is problematic with compilers like clang which compile slowly when there are large numbers of live values in a single block.
When the system consists of a large number of modules with nested layers of submodules, this creates a list of statements in the top level that's the product each of the layers of instantiation.
If instead each module is responsible for its own
schedule_posedge_CLK
andcreate_model
, then each module would only have as many statements as modules that it directly instantiates, and the total number of statements would be reduced to the sum of each of the layers of instantiation. This would both compile faster and produce smaller binaries. Quadratic.bs.txt