I want to conditionally include one of three files if the respective macro for that file has been defined. Normally I would define the macros in a separate file, say defines.v
, and then include that in the top module.
The top module file would look something like this:
`include "defines.v"
`ifdef CONDITION_1
`include "file1.v"
`elsif CONDITION_2
`include "file2.v"
`elsif CONDITION_3
`include "file3.v"
`endif
module top;
...
...
endmodule
and this would be the defines.v
file:
`define CONDITION_1
// `define CONDITION_2
// `define CONDITION_3
To implement the same in Vivado, I added file1.v
, file2.v
, file3.v
, defines.v
along with the top module file
in sources. But in this way, the top module includes all the other files present in sources automatically.
So I want to know what's the right way.
EDIT- By "added", I mean I added those files in the design sources folder: