General Description: I am checking the syntax of a VHDL code block for inference of a multiplexer; when the port is defined as:
MUX_CTRL: in STD_LOGIC;
and the code within the process statement is:
case MUX_CTRL is when '0' => <<do_something>>; when '1' => <<do_something_else>>; end case;
FPGA Express gives the following error:
Error: Range 'U' to 'X' not covered by choices. (VSS-838) (FE-dm-hdlc-unknown) Error: "Range 'Z' to '-' not covered by choices. (VSS-838) (FE-dm-hdlc-unknown)
解决方案
This occurs because not all possible values of STD_LOGIC were covered by the case statement. There are values possible for STD_LOGIC other than simply "0" and "1" (e.g., "U", "X", and "Z") that need to be covered. To do this, simply add the following to the end of the case statement:
when others => null;
Preferably, this will take the place of the last comparison in the case statement.
The following is the case statement code given in the HDL Editor Language Assistant:
case <expression> is when <choices> => <statements> when <choices> => <statements> when others => <statements> end case; -- example: --case SEL is -- when 0 | 1 | 2 => -- Z <= B; -- when 3 to 10 => -- Z <= C; -- when others => -- null; --end case;