IRVS VLSI IDEA INNOVATORS

IRVS VLSI IDEA INNOVATORS
VLSI Project, Embedded Project, Matlab Projects and courses with 100% Placements

Monday, November 29, 2010

Case statement

• CASE is another statement intended exclusively for sequential code.

• The CASE statement (sequential) is very similar to WHEN (combinational).

• All permutations must be tested, so the keyword OTHERS is often helpful.

• Another important keyword is NULL (the counterpart of UNAFFECTED), which should be used when no action is to take place.

• CASE allows multiple assignments for each test condition while WHEN allows only one.

Syntax

[Label:] case Expression is
when Choices =>
SequentialStatements...
when Choices =>
SequentialStatements...
... {any number of when parts}
end case [Label];

Choices = Choice | Choice | ...
Choice = {either}
Constant Expression
Range
others {the last branch}


Where


process – begin - - end
function – begin - - end
procedure – begin - - end
if – then - - elsif – then - - else - - end
case - => - - when - => - - end
loop--end


Rules

• The Expression must not be enclosed in parenthesis.

• The type of the Expression must be enumeration, integer, physical, or a one
dimensional array.

• Every case of the Expression must be covered once and only once by the
Choices.


Synthesis

• Assignments within case statements generally synthesize to multiplexers.

• Incomplete assignments (i.e. where outputs remain unassigned for certain input conditions) in unclocked processes synthesize to transparent latches.

• Incomplete assignments in clocked processes synthesize to recirculation around registers.

Example

case ADDRESS is
when 0 =>
-- Select a single value
A <= '1';
when 1 =>
A <= '1'; -- More than one statement in a -- branch
B <= '1';
when 2 to 15 => -- Select a range of ADDRESS -- values
C <= '1';
when 16 | 20 | 24 => -- Pick out several -- ADDRESS values
B <= '1';
C <= '1';
D <= '1';
when others =>
-- Mop up the rest
null;
end case;


information shared by www.irvs.info