I was writing code like :
`define SUB(x) reg_ctrl_x_0
genvar num;
generate for (num = 0; num < 10; num = num + 1) begin : myGen
assign mySignal [num] = `SUB (num)
end
endgenerate
I thought it would be alright and guess what, it resulted in a compilation error.
I tried the following things and I was still getting error.
`define _SUB_(X) reg_ctrl_X_0
`define sub(num) reg_ctrl_num_0
`define sub(num) {reg_ctrl, “num”, _0}
and then I realized it. This is taken like a string and it finally worked with
`define sub(num) “reg_ctrl_num_0”