The format of the CASE statement is as follows:
CASE(expression) IS
WHEN value1 =>
{sequence of statements}
WHEN value2 =>
{sequence of statements}
WHEN OTHERS =>
{sequence of statements}
END CASE;
Note that all possible values of the expression must be accounted for as was the case with the selected signal assignment. The following is an example of the use of a CASE statement:
PROCESS(sel, a, b, c, d)
BEGIN
CASE sel IS
WHEN “00” =>
q <= a;
WHEN “01” =>
q <= b;
WHEN “10” =>
q <= c;
WHEN “11” =>
q <= d;
WHEN OTHERS =>
NULL;
END CASE;
END PROCESS;
0 comments