Welcome to My Website

About Me

My photo
I am doing my final year EEE in Dr.SACOE. If someone feels that they have never made a mistake in their life, then it means that they had never tried a new thing in their life.............. i make lot of mistakes, hope am trying something new or ?

Followers

CASE Statement:

Posted by PRABHAKARAN Saturday, March 6, 2010

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

Post a Comment