why input cannot be used in case??

Status
Not open for further replies.

fahim1

Member level 4
Joined
Jun 4, 2015
Messages
75
Helped
2
Reputation
4
Reaction score
2
Trophy points
8
Visit site
Activity points
517
i want to use input in case but i have warning "Array type case expression must be of a locally static subtype."
how can i fix it?whats the soloution?
heres the code :
Code:
case mplr(1 downto 0)&'0' is
  when "000" =>  p1 := "00000000" ;
tnx
 

Why are you bothering adding that '0'???? That's simply redundant.

Code:
case mplr(1 downto 0) is
      when "00"=>...
 


Because you're not allowed - its an annoying quirt of vhdl. You need to make an intermediate signal:

my_intermediate <= mplr(1 downto 0) & '0';
case my_intermediate is...
 

Because you're not allowed - its an annoying quirt of vhdl. You need to make an intermediate signal:

my_intermediate <= mplr(1 downto 0) & '0';
case my_intermediate is...

That's still a waste of resources. (Which will probably be trimmed by the tool anyway).
 

Why are you bothering adding that '0'???? That's simply redundant.

Code:
case mplr(1 downto 0) is
      when "00"=>...

its just part of code i have other parts
like
when "001"
 

its just part of code i have other parts
like
when "001"

if you did the code you describe:

case a(1 downto 0) & '0' is

when "001" =>

would be an impossible case - so it would be removed during compilation.
 

Because you're not allowed - its an annoying quirt of vhdl. You need to make an intermediate signal:

my_intermediate <= mplr(1 downto 0) & '0';
case my_intermediate is...

Is is better to use a variable as the intermediate value. It probably doesn't matter in a combinatorial process, but a signal will create a register and a delay in a clocked process.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…