Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   warning message for case statements where the selector signal is of type std_logic_vector (http://www.velocityreviews.com/forums/t23339-warning-message-for-case-statements-where-the-selector-signal-is-of-type-std_logic_vector.html)

profpenguin@shaw.ca 02-05-2005 12:57 AM

warning message for case statements where the selector signal is of type std_logic_vector
 
I have had to compile some VHDL code using "Modelsim". For all the
"case" statements in the code that where the selector signal is of type
"std_logic_vector", I get the following warning:

"Array type case expression must be of a locally static subtype"

I only see this type of warning from Modelsim. Cadence's NCVHDL, never
complained. Normally I have used NCVHDL, and have just recently needed
to use Modelsim for a customer.

I googled searched the warning, and came across several similar
questions posted. After looking at them all, I couldn't find one that
addressed why I got this warning or how to avoid it.

I created a simple example, in order to see if I could get rid of the
warning by trying several ideas, some coming from the other postings.
For example, I tried type qualification. Also defining a type array
inside the architecture and using a signal of that type as the
selector, thinking that that should be locally static. Using
bit_vector instead of std_logic_vector. Nothing I do seems to get rid
of the warning.

Here is my very simple base example file that I tried all sorts of
modifications too.
-----------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY case_example IS
PORT(
sel_sig : in std_logic_vector(3 downto 0);
output : out std_logic
);
END ENTITY case_example;

ARCHITECTURE rtl OF case_example IS

type sel_sig_t is array (3 downto 0) of bit;
signal sel_sig_i : sel_sig_t;

BEGIN

case_example_proc:
PROCESS(sel_sig)
BEGIN
CASE (sel_sig) IS
WHEN "0000" => output <= '1';
WHEN OTHERS => output <= '0';
END CASE;
END PROCESS case_example_proc;
END ARCHITECTURE rtl;

--------------------------------------------------------------

I can accept the idea that since std_logic_vector type is unbounded,
that by the strictest interpretation of the LRM, the sel_sig type is
not locally static hence the warning, but since the file actually
provides bounds to the array, Modelsim is smart enough to be able to
compile, and maybe that is what is happening. But if I use sel_sig_i
as the selector signal, why doesn't the warning go away? Wouldn't
sel_sig_t be locally static type?

Do other people using Modelsim see this warning when using case
statements where the selector signal is a std_logic_vector? Does the
simulation behave as you expect? Do you code the design differently?

The original code that I was compiling has seen silicon, which does
work. So could is this just slight differences in the LRM
interpretation?

Thank you in advance.

Calvin


Jezwold 02-05-2005 06:30 AM

Re: warning message for case statements where the selector signal is of type std_logic_vector
 
The sample code you gave just compiled correctly under modelsim 5.3 and
the only error i got was that Array case expressions must not be in
parentheses.


Jezwold 02-05-2005 07:07 AM

Re: warning message for case statements where the selector signal is of type std_logic_vector
 
Having read some of the comments it apears that you should in fact get
an error because its not a locally static variable,so I susspect
version 5.3 is incorrect and later versions have been modified to more
acuratly follow the lrm


profpenguin@shaw.ca 02-05-2005 07:11 PM

Re: warning message for case statements where the selector signal is of type std_logic_vector
 
Thanks for your answer.

What makes 'sel_sig' type not locally static. Is it because the type
of sel_sig is std_logic_vector, which is defined as an unbounded array,
even though the entity port description bounds the array?

If I use the internally declared 'sel_sig_i' signal for the selector
expression. I get the same warning. In this case, the signal's type
is defined in the file, it is bounded, I am not making a subtype of an
unbounded array. Why isn't this not locally static?

I have tried to understand the LRM's definition, but I find the wording
confusing.



Thanks again
Calvin


Tristan Gingold 02-06-2005 04:41 PM

Re: warning message for case statements where the selector signal is of type std_logic_vector
 
profpenguin@shaw.ca wrote:

> Thanks for your answer.
>
> What makes 'sel_sig' type not locally static. Is it because the type
> of sel_sig is std_logic_vector, which is defined as an unbounded array,
> even though the entity port description bounds the array?

No, it is because you are enclosing the name within parenthesis. Then
the expression is not a name anymore, and its type is the base type.

> If I use the internally declared 'sel_sig_i' signal for the selector
> expression. I get the same warning. In this case, the signal's type
> is defined in the file, it is bounded, I am not making a subtype of an
> unbounded array. Why isn't this not locally static?
>
> I have tried to understand the LRM's definition, but I find the wording
> confusing.

A parenthesis expression is not a name, that the reason of the error.

Tristan.

Calvin 02-07-2005 06:16 PM

Re: warning message for case statements where the selector signal is of type std_logic_vector
 
Tristan Gingold <tgingold@no.spam.free.fr> wrote in message news:<cu5hbm$91b$1@aphrodite.grec.isp.9tel.net>...
> No, it is because you are enclosing the name within parenthesis. Then
> the expression is not a name anymore, and its type is the base type.
>
> A parenthesis expression is not a name, that the reason of the error.
>
> Tristan.


Thank you.

Once the parenthesis were removed, the warning message did not appear.

Calvin

Douglas Sykora 02-11-2005 05:38 AM

Re: warning message for case statements where the selector signal is of type std_logic_vector
 

"Calvin" <profpenguin@shaw.ca> wrote in message
news:c556d654.0502071016.ed5bb39@posting.google.co m...
> Tristan Gingold <tgingold@no.spam.free.fr> wrote in message

news:<cu5hbm$91b$1@aphrodite.grec.isp.9tel.net>...
> > No, it is because you are enclosing the name within parenthesis. Then
> > the expression is not a name anymore, and its type is the base type.
> >
> > A parenthesis expression is not a name, that the reason of the error.
> >
> > Tristan.

>
> Thank you.
>
> Once the parenthesis were removed, the warning message did not appear.


Why do parenthesis turn a variable into a non-(locally static subtype)?
I sure would like to understand this a little better.
Thanks in Advance,
Doug
>
> Calvin





All times are GMT. The time now is 01:10 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.