For Loop Generate Statement

Discussion in 'VHDL' started by Roman Zeilinger, Sep 23, 2004.

  1. Hello

    I have the following problem:

    I want to generate a module consisting of single bit modules. The problem is
    now that I want to increase the index i of the for loop by 2 in each
    interation.

    So can someone please tell me how I have to modify this for loop so that i
    is incremented by 2 after each interation? I tried i := i+2 but this doesent
    work

    gen_modul: for i in 0 to 6 generate
    .....
    end generate gen_modul

    Thanks a lot

    Roman
    Roman Zeilinger, Sep 23, 2004
    #1
    1. Advertising

  2. Roman Zeilinger

    jandc Guest

    > Hello
    >
    > I have the following problem:
    >
    > I want to generate a module consisting of single bit modules. The problem is
    > now that I want to increase the index i of the for loop by 2 in each
    > interation.
    >
    > So can someone please tell me how I have to modify this for loop so that i
    > is incremented by 2 after each interation? I tried i := i+2 but this doesent
    > work
    >
    > gen_modul: for i in 0 to 6 generate
    > .....
    > end generate gen_modul


    Why not do

    gen_modul: for i in 0 to 3 generate
    ...
    end generate gen_modul

    and use i*2 instead of i everywhere you use i...
    jandc, Sep 23, 2004
    #2
    1. Advertising

  3. On Thu, 23 Sep 2004 15:46:28 +0100, "Roman Zeilinger"
    <> wrote:

    >Hello
    >
    >I have the following problem:
    >
    >I want to generate a module consisting of single bit modules. The problem is
    >now that I want to increase the index i of the for loop by 2 in each
    >interation.
    >
    >So can someone please tell me how I have to modify this for loop so that i
    >is incremented by 2 after each interation? I tried i := i+2 but this doesent
    >work
    >
    >gen_modul: for i in 0 to 6 generate
    > .....
    >end generate gen_modul


    You can't. However, you can use 2*i instead of i inside the loop,
    which acheives the same thing.

    Regards,
    Allan
    Allan Herriman, Sep 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Isaac

    Error Generate Statement

    Isaac, Aug 7, 2003, in forum: VHDL
    Replies:
    3
    Views:
    2,379
    Keith Williams
    Aug 7, 2003
  2. Weng Tianxiang
    Replies:
    5
    Views:
    1,295
    Christophe
    Feb 16, 2006
  3. Replies:
    3
    Views:
    395
    red floyd
    Apr 7, 2006
  4. Harlan Messinger
    Replies:
    2
    Views:
    2,277
    John Bell
    Mar 28, 2010
  5. Isaac Won
    Replies:
    9
    Views:
    348
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page