Combination of generate and macro

Macros are pre-processor compiler directives. That means macros are processed before any Verilog syntax is parsed - before the compile knows about the generate statement.

Your choices are:

  • fix the ddrN code to be an array in the first place
  • manually write the code
  • find another pre-processor that can handle the looping macro code.