Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Are constants not locally static?

Reply
Thread Tools

Are constants not locally static?

 
 
M. Norton
Guest
Posts: n/a
 
      10-16-2008
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 1;
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
 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      10-16-2008
M. Norton wrote:

> The only thing I can think is that the compiler thinks
> FILT_DATA(COMB_BACKLIGHT).a429_label is not locally static.


It's not.
Either simplify the condition or use if/then/elsif...

-- Mike Treseler

___________________
57 Thu Oct 16 /evtfs/home/tres> verror 1186
vcom Message # 1186:
When the expression is of an array type, the length of the array must
be known at compile time. The simulator is less restrictive than the
LRM requires as long as the array length of the expression can be
determined in the compiler.
IEEE Std 1076-1993, 8.8 Case statement:

If the expression is of a one-dimensional character array type, then
the expression must be one of the following:
-- The name of an object whose subtype is locally static
-- An indexed name whose prefix is one of the members of this list
and whose indexing expressions are locally static expressions
-- A slice name whose prefix is one of the members of this list and
whose discrete range is a locally static discrete range
-- A function call whose return type mark denotes a locally static
subtype
-- A qualified expression or type conversion whose type mark
denotes a locally static subtype

It is an error if the element subtype of the one-dimensional character
array type is not a locally static subtype.
 
Reply With Quote
 
 
 
 
M. Norton
Guest
Posts: n/a
 
      10-16-2008
On Oct 16, 2:37*pm, Mike Treseler <(E-Mail Removed)> wrote:
> M. Norton wrote:
> > The only thing I can think is that the compiler thinks
> > FILT_DATA(COMB_BACKLIGHT).a429_label is not locally static.

>
> It's not.
> Either simplify the condition or use if/then/elsif...


Thank you. I had thought you couldn't get much more static than a
constant array with a constant index, but perhaps there's a granite or
bedrock declaration someplace . I'll just chalk it up to a quirk
of the language.

Mark
 
Reply With Quote
 
James Unterburger
Guest
Posts: n/a
 
      10-17-2008
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 1;
> 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

 
Reply With Quote
 
M. Norton
Guest
Posts: n/a
 
      10-20-2008
On Oct 16, 5:19*pm, James Unterburger <(E-Mail Removed)> wrote:
> 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).


Thank you. I suppose I don't truly comprehend the distinction between
globally and locally static. The question I ask myself is, if
something is globally static, how could it be less static at a lower
level of scope?

However, it's a language definition thing and that's not really my
forte. It's sufficient to understand that even though everything is a
constant, I can't use anything with an index or a record selection as
an expression in a case statement, but would be valid for an if/then
logic expression.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data table displays locally but "Could Not Start Session" on server? keekaye ASP .Net 0 12-27-2004 06:04 PM
Unsupported Feature Error: non-locally-static attributes names are not supported jesse_j VHDL 2 12-12-2004 08:53 PM
Domain controller GPO does not deny logon locally right to IWAM_machinename when running aspnet.wp.exe \Rob\ ASP .Net 4 05-12-2004 12:13 AM
Why is this not a locally static choice? Charles M. Elias VHDL 2 06-26-2003 06:15 PM



Advertisments