I want to handle 2 scenarios in a module. The difference is very minimal, few lines at worst. The scenario depends on the instantiation and I would like to avoid having to have 2 separate files for it.
I can't use V/SV parameter because it would change the scope of the variables (scenarios using different types).
// Following breaks the scope
if (SCENARIO=1) begin
mystruct_scenario1 myvar; // Scenario 1
end else begin
mystruct_scenario2 myvar; // Scenario 2
end
Using different values for case depending on a SV parameter is impossible.
case (select_type)
if (SCENARIO=1) begin
sc1_A: begin end
end else begin
sc2_B: begin end
end
endcase
Using a macro here would solve all my problems but I don't know how to properly do it.
I'd be fine generating 2 different modules from the same file but I don't know how to tell Vivado to build 2 different modules with 2 different macros.
For Questa/Modelsim, I believe I'd just need to compile twice with 2 different +define+.