Detecting edges of array elements

Discussion in 'VHDL' started by hssig, Dec 3, 2009.

  1. hssig

    hssig Guest

    Hello,

    I have a testbench module with the following input:

    iEnableArray : in type_array;


    The type declaration is the following:

    type type_array is array(15 downto 0) of std_logic;


    Now I want to detect transitions in the elements of that array:


    process
    variable L : line;
    begin
    wait on iEnableArray'transaction;

    for i in 15 downto 0 loop

    if falling_edge(iEnableArray(i)) then --
    compilation error
    write(L, string'("falling edge of element ");
    write(L, integer'image(i));
    write(output, L);
    end if;

    if rising_edge(iEnableArray(i)) then
    write(L, string'("rising edge of element ");
    write(L, integer'image(i));
    write(output, L);
    end if;
    end loop;


    end process;


    When compiling that description Modelsim complains about "not static
    expression".
    How can I describe it alternatively ?


    Thank you for your opinions.

    Cheers,
    hssig
    hssig, Dec 3, 2009
    #1
    1. Advertising

  2. hssig

    Andy Guest

    On Dec 3, 2:41 pm, hssig <> wrote:
    > Hello,
    >
    > I have a testbench module with the following input:
    >
    > iEnableArray : in type_array;
    >
    > The type declaration is the following:
    >
    > type type_array is array(15 downto 0) of std_logic;
    >
    > Now I want to detect transitions in the elements of that array:
    >
    > process
    > variable L : line;
    > begin
    >    wait on iEnableArray'transaction;
    >
    >    for i in 15 downto 0 loop
    >
    >       if falling_edge(iEnableArray(i)) then                   --
    > compilation error
    >          write(L, string'("falling edge of element ");
    >          write(L, integer'image(i));
    >          write(output, L);
    >       end if;
    >
    >       if rising_edge(iEnableArray(i)) then
    >          write(L, string'("rising edge of element ");
    >          write(L, integer'image(i));
    >          write(output, L);
    >       end if;
    >    end loop;
    >
    > end process;
    >
    > When compiling that description Modelsim complains about "not static
    > expression".
    > How can I describe it alternatively ?
    >
    > Thank you for your opinions.
    >
    > Cheers,
    > hssig


    I assume it is referring to referencing i in the call to rising_edge
    or falling_edge?

    You could use a for-generate (outside the process) and then remove the
    loop from the process. Not sure if the generate index is "static
    enough" or not.

    Or maybe something totally different...

    BTW, for safety and maintainability use "for i in iEnableArray'range
    generate"

    Andy
    Andy, Dec 3, 2009
    #2
    1. Advertising

  3. hssig

    Tricky Guest

    On 3 Dec, 22:59, Andy <> wrote:
    > On Dec 3, 2:41 pm, hssig <> wrote:
    >
    >
    >
    > > Hello,

    >
    > > I have a testbench module with the following input:

    >
    > > iEnableArray : in type_array;

    >
    > > The type declaration is the following:

    >
    > > type type_array is array(15 downto 0) of std_logic;

    >
    > > Now I want to detect transitions in the elements of that array:

    >
    > > process
    > > variable L : line;
    > > begin
    > >    wait on iEnableArray'transaction;

    >
    > >    for i in 15 downto 0 loop

    >
    > >       if falling_edge(iEnableArray(i)) then                   --
    > > compilation error
    > >          write(L, string'("falling edge of element ");
    > >          write(L, integer'image(i));
    > >          write(output, L);
    > >       end if;

    >
    > >       if rising_edge(iEnableArray(i)) then
    > >          write(L, string'("rising edge of element ");
    > >          write(L, integer'image(i));
    > >          write(output, L);
    > >       end if;
    > >    end loop;

    >
    > > end process;

    >
    > > When compiling that description Modelsim complains about "not static
    > > expression".
    > > How can I describe it alternatively ?

    >
    > > Thank you for your opinions.

    >
    > > Cheers,
    > > hssig

    >
    > I assume it is referring to referencing i in the call to rising_edge
    > or falling_edge?
    >
    > You could use a for-generate (outside the process) and then remove the
    > loop from the process. Not sure if the generate index is "static
    > enough" or not.
    >
    > Or maybe something totally different...
    >
    > BTW, for safety and maintainability use "for i in iEnableArray'range
    > generate"
    >
    > Andy


    Id suggest a generate loop too.

    Currently, waiting on 'transaction will fire off whenever ANY
    assignment is made to iEnableArray. So even it all bits are '0', and
    you assign (others => '0') to it, it will stop waiting.

    Id probably wrap it up in a generate loop and then just wait on
    rising_edge(ienableArray(i)) or falling_edge(iEnableArray(i)) and then
    do an if/elsif decision for the printout.
    Tricky, Dec 4, 2009
    #3
  4. hssig

    hssig Guest

    Hi,

    thank you for your suggestions.

    cheers,
    hssig
    hssig, Dec 7, 2009
    #4
    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. Steve

    Both clock edges

    Steve, Oct 1, 2004, in forum: VHDL
    Replies:
    2
    Views:
    990
    rickman
    Oct 2, 2004
  2. Mike

    Question about clock edges

    Mike, Oct 6, 2004, in forum: VHDL
    Replies:
    6
    Views:
    898
    Raghavendra
    Oct 11, 2004
  3. Tobias Merler
    Replies:
    1
    Views:
    499
  4. -
    Replies:
    14
    Views:
    590
    Chris Uppal
    Mar 26, 2005
  5. puzzled
    Replies:
    20
    Views:
    1,424
    Thomas Mlynarczyk
    Jan 16, 2004
Loading...

Share This Page