Microsoft Word - Digital Logic Design v_4_6a

(lily) #1
when choices => sequential-statements
...
when choices => sequential_statements
when others sequential_statements -- do if none of choices match
end case;

Use case statement instead of if-then-else if possible since it is easier to synthesize.

 Example – Prime number detector using case statement

architecture prime6_arch of prime is
begin
process(N)
begin
case CONV_INTEGER(N) is
when 1 => F <= ‘1’;
when 3 | 5 | 7| 11 | 13 => F <= ‘1’;
when others => F <= ‘0’;
end case;
end process;
end prime6_arch;

 Sequential “Loop” Statements
There are three types of loops that are useful in synthesizing repeated structures.


 Sequential “Basic Loop” Statement syntax
This creates an infinite loop which is useful when doing modeling.

loop
sequential-statement

...
sequential-statement
end loop;


 Sequential “For Loop” Statement syntax
the identifier is implicitly declared and will have the same type as the range. The identifier may be
used inside the loop only.

for identifier in range loop
sequential-statement

...
sequential-statement
end loop;


The two sequential statements “exit” and “next” may be used in the loop body:
 “exit” terminates the loop and continues with the next statement after the loop.
 “next” starts the next iteration through the loop, bypassing the remaining statement in the
current iteration.

 Sequential “While Loop” statement syntax
The identifier is implicitly declared and will have the same type as the range. The identifier may
be used inside the loop only.

while Boolean_expression loop
sequential_statement

...

Free download pdf