Hi! I have some use cases where I do customization on instantiated objects by changing a default parameter and then I get parts of the code disabled inside “if” blocks. So far this has worked fine because converted “if False” (ie. testing the constant parameter) blocks supposedly get removed by synthesis optimizations.
Now I have a more complicated customization that switches the assignment of a certain signal between combinational and clock’ed process. The old “if constant-parameter” trick fails in this case with “myhdl.ConversionError: … Signal has multiple drivers”. I understand the parameter value is not being evaluated on conversion, so both processes are converted thus the multiple drivers problem.
Is it possible to achieve a working “conditional conversion” (disabling parts of code on instantiation) another way?
I’ve manage to fix conversion in my project by conditionally changing the usage of the signal, choosing between comb/clocked versions later, instead of multiple conditional assignments. But I still wonder if there is any kind of trick to achieve conditional conversion. 
Hi,
one thing to keep in mind with myhdl and HDL conversion is, that direct children statements of a @block function body are run, and @always process style elements are AST-translated. So for procedural stuff, best strategy is probably to try conditional stuff in the @block body and go for selective if cond: return logic1, process2; else: return process2 approaches to explicitely infer logic.
For more complex procedural stuff, you might run into limitations, but typical conditional compilation scenarios can be solved with MyHDL inside the @block body, such that only used code is created, which could be important if design rules forbid uncovered (never visited) code elements.
Thanks for the tip @hackfin ! I didn’t thought of that difference about what is been run and what is been translated.