View Single Post
  #2 (permalink)  
Old 02-02-2010, 11:09 PM
Cary R.
Guest
 
Posts: n/a
Default Re: concatenation with a for loop

fpgaasicdesigner wrote:
> Hi all,
>
> How can I write more with more elegance this:
>
> header={register[0],register[1],register[2]}.
>
> Meaning having a for loop to concatenate these bus ?
>
> Thanks


localparam max = 2;
for (idx=0; idx<=max; idx=idx+1)
header[(max-idx)*<width> +: <width>] = register[idx];

<width> is the width of the register words.

Cary
Reply With Quote