Detecting edges of array elements

H

hssig

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
 
A

Andy

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
 
T

Tricky

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top