I would like to write a Verilog module such that it can instantiate the module named in its parameter.
module parent();
parameter MODULE = "missing_module";
initial $display("I want to instantiate %s", MODULE);
endmodule
module top();
parent #(.MODULE("child_1")) p();
endmodule
Except that instead of that $display
, a module instantiation of child_1
as that was the name passed in via the MODULE
parameter.