Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - strange compiler message

 
Thread Tools Search this Thread
Old 02-24-2008, 05:30 PM   #1
Default strange compiler message


Hi

I have just written a simple mux module, which selects one of 4 signals.
So I have a 2 bit select signal. But strangely the compiler gives me the
following message:

# ** Error: mux.vhd(1: Case statement covers only 4 out of 81 cases.
# ** Error: mux.vhd(25): VHDL Compiler exiting
# C:/Modeltech_pe_edu_6.3c/win32pe_edu/vcom failed.

Why 81 cases? I just have 4 different ones for the sel?

Thanks!

library ieee;
use ieee.std_logic_1164.all;

entity MUX is
port( I0 : in std_logic_vector(3 downto 0);
I1 : in std_logic_vector(3 downto 0);
I2 : in std_logic_vector(3 downto 0);
I3 : in std_logic_vector(3 downto 0);
sel : in std_logic_vector(1 downto 0);
dout: out std_logic_vector(3 downto 0)
);
end MUX;

architecture behave of MUX is
begin
process(I0, I1, I2, I3, sel)
begin
case sel is
when "00" => dout <= I0;
when "01" => dout <= I1;
when "10" => dout <= I2;
when "11" => dout <= I3;
end case;
end process;
end behave;


Rob Granger
  Reply With Quote
Old 02-24-2008, 06:38 PM   #2
Rob Granger
 
Posts: n/a
Default Re: strange compiler message
Mike Treseler schrieb:
> Rob Granger wrote:
>> Hi
>>
>> I have just written a simple mux module, which selects one of 4 signals.
>> So I have a 2 bit select signal. But strangely the compiler gives me the
>> following message:
>>
>> # ** Error: mux.vhd(1: Case statement covers only 4 out of 81 cases.
>> # ** Error: mux.vhd(25): VHDL Compiler exiting
>> # C:/Modeltech_pe_edu_6.3c/win32pe_edu/vcom failed.

>
> add a when others case:
>
>
>
> when "01" => dout <= I1;
> when "10" => dout <= I2;
> when "11" => dout <= I3;
> when others => dout <= I0;


Thanks Mike, I completley forgot all the possible combinatios with XZ
and so on that the input signal could have


Rob Granger
  Reply With Quote
Old 02-24-2008, 07:01 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: strange compiler message
Rob Granger wrote:
> Hi
>
> I have just written a simple mux module, which selects one of 4 signals.
> So I have a 2 bit select signal. But strangely the compiler gives me the
> following message:
>
> # ** Error: mux.vhd(1: Case statement covers only 4 out of 81 cases.
> # ** Error: mux.vhd(25): VHDL Compiler exiting
> # C:/Modeltech_pe_edu_6.3c/win32pe_edu/vcom failed.


add a when others case:



when "01" => dout <= I1;
when "10" => dout <= I2;
when "11" => dout <= I3;
when others => dout <= I0;


Mike Treseler
  Reply With Quote
Old 02-25-2008, 02:25 AM   #4
kennheinrich@sympatico.ca
 
Posts: n/a
Default Re: strange compiler message
On Feb 24, 1:38 pm, Rob Granger <R...@hotmaiil.com> wrote:
> Mike Treseler schrieb:
>
>
>
> > Rob Granger wrote:
> >> Hi

>
> >> I have just written a simple mux module, which selects one of 4 signals.
> >> So I have a 2 bit select signal. But strangely the compiler gives me the
> >> following message:

>
> >> # ** Error: mux.vhd(1: Case statement covers only 4 out of 81 cases.
> >> # ** Error: mux.vhd(25): VHDL Compiler exiting
> >> # C:/Modeltech_pe_edu_6.3c/win32pe_edu/vcom failed.

>
> > add a when others case:

>
> > when "01" => dout <= I1;
> > when "10" => dout <= I2;
> > when "11" => dout <= I3;
> > when others => dout <= I0;

>
> Thanks Mike, I completley forgot all the possible combinatios with XZ
> and so on that the input signal could have


If your intent is purely to shut the compiler up so you can get
synthesised hardware, this is a good solution. If you want a more
robust simulation model which lets you back-trace errors better,
though, consider making your case statement a little more involved.
You might want behaviour so that any "X"'s in the sel force "X"'s in
the output. You might want to wrap the "sel" case in the function
'to_01x' so that using "H" or "L" as an input still does the right
thing, or even (depending on how you're using the multiplexer) allow a
sel value of "0X" to produce a non-X output when I0 and I1 are the
same, and "X" otherwise. You can wrap yourself in knots of you chose
to, but as a bare minimum, having "X in the input to leads to X in the
output" semantics are often useful.

- Kenn


kennheinrich@sympatico.ca
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modfying a specified message in the Queue VijayGoparaju Software 0 09-15-2008 06:56 AM
popup message in asp.net snoo Software 0 05-23-2008 10:06 AM
Turn $6 into $60000 GARANTEED!!! Zachary Keller DVD Video 2 10-08-2003 09:58 PM
Postal Lottery: Turn $6 into $60,000 in 90 days, GUARANTEED Louis DVD Video 0 09-30-2003 07:26 PM
Turn $6 into $60,000 in 90 days, GUARANTEED T.L.F. DVD Video 0 09-18-2003 07:14 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46