and what I want to do in generate for loop is something like this.
Code:
b[0] = in0;
b[1] = in1;
b[2] = in2;
... and so on.
The problem is I cant index the inputs using the variable 'i' in the generate for loop. How can I do this easily with a for loop?
Note: I don't want to use in[N-1:0], I want to keep them as in0, in1...
For what its worth macros can manipulate signal names using ``. See how this creates two signals based on the string passed as "OUT". You could unroll your generate loop and replace it with one line macros.
Code:
`define SYNC(CLK_EN, IN, OUT, INVERT, DFLT)\
wire OUT, ``OUT``_posedge, ``OUT``_negedge;\
For what its worth macros can manipulate signal names using ``. See how this creates two signals based on the string passed as "OUT". You could unroll your generate loop and replace it with one line macros.
Code:
`define SYNC(CLK_EN, IN, OUT, INVERT, DFLT)\
wire OUT, ``OUT``_posedge, ``OUT``_negedge;\
Do you compete in Verilog obfuscation competitions?
Stuff like this is going to reduce maintainability, which to me is far more important than trying to avoid typing something out explicitly.
I only use for loops if I've already code everything else with parametrized widths and loop counts. Having a fixed number of inputs like the OP's first post would require a fixed loop count and I would avoid the loop altogether and just use what dave_59 suggested in post #2.