Re: Are constants not locally static?



An indexed name is never locally static, nor is a selected name.
The name you have is a selected name of an indexed name, so it is not locally static. See 7.4.1 Locally static primaries
and 7.4.2 Globally static primaries. Subelements (that is,
indexed names and/or selected names) are on the list in 7.4.2
but not on the list in 7.4.1.

While what you have can be considered globally static, it is
never considered locally static. Since the compiler knows the
array length of the value it's allowed (but not compliant,
hence the warning).


M. Norton wrote:
Well this one was a new one on me. Granted this is a warning, but
thought it might be worth running down, as it seemed to be one of
those warnings I want to make certain disappear. From Modelsim:

** Warning: blah blah(183): Case choice must be a locally static
expression.

So, here's the structure I have. In a package I created an array of
records and defined them, like so:

type filt_record is record
name : string(1 to 18);
address : std_logic_vector(10 downto 0);
weight : integer;
a429_label : std_logic_vector(7 downto 0);
end record filt_record;

type filt_table is array (0 to NUM_CHANNELS-1) of filt record;

constant FILT_DATA : filt_table := (
0 => ("Display Brightness", "000--------", 1, "01000000"),
... yada yada ...
27 => ("Combiner +12V ", "111-----111", 16, "10110001"));

Okay, so far, so good. Also, so I could refer to the indicies by
name, I created a number of constants mapping name to integer, like
so:

constant DISPLAY_BRIGHTNESS : integer := 0;
...
constant COMB_P12V : integer := 27;

Seems fine. So onto the code that caused the warning. The package is
declared properly, and so forth earlier. The signal below
"label_value" is a signal and is a smaller slice of a larger input
std_logic_vector port. So it's well declared.

LABEL_CHECKING : process is
begin
loop
wait until some'event;

--
-- Perform some specific label checks
--
case label_value is
when FILT_DATA(COMB_BACKLIGHT).a429_label =>
-- Do some stuff
when others =>
null;
end case;
end loop;
end process LABEL_CHECKING;

The only thing I can think is that the compiler thinks
FILT_DATA(COMB_BACKLIGHT).a429_label is not locally static. However,
FILT_DATA is a constant array of records and COMB_BACKLIGHT is one of
those array index constants. It seems to me like everything in the
"when" statement should evaluate to something that cannot change.

So, is Modelsim throwing a warning about nothing, or is there
something I've missed?

Thanks for any help with this oddball warning.

Best regards,
Mark Norton
.



Relevant Pages

  • Re: fgets() - supposed to be simple :)
    ... shouldn't) use the macro with a semicolon. ... And you need an array of 100 floats for the amount of the purchase? ... >void menu; ... This is an error, not a warning. ...
    (comp.lang.c)
  • Re: Array of Pointers
    ... complex) data structure than a simple array to do this efficiently. ... int mainor int main ... bigarray.c:6: warning: ISO C89 forbids variable-size array `arrayofpointers' ...
    (comp.lang.c)
  • Re: HELP! Trying to add Email Notification to Download File Code
    ... This warning will go away once you get the headers sorted out. ... Invalid argument supplied for foreachin ... # verifies if the $filelist array has an element ... # builds an array with all valid files in the ...
    (comp.lang.php)
  • Re: Stack growth direction to thwart buffer overflow attacks
    ... > via SIGABRT or whatever when the buffer is exceeded, ... the MS compiler has an extension that lets you mark ... can insist that the warning count falls over time. ... For the wider problem of running off the ends of an array, ...
    (comp.security.misc)
  • Re: Stack growth direction to thwart buffer overflow attacks
    ... > via SIGABRT or whatever when the buffer is exceeded, ... the MS compiler has an extension that lets you mark ... can insist that the warning count falls over time. ... For the wider problem of running off the ends of an array, ...
    (comp.security.unix)