Chapter 6 - Generate Process If Case
Chapter 6 - Generate Process If Case
– Examples.
Generate Statement:
• Previously, we implemented a 16:1 multiplexer using
five instances of the 4:1 multiplexer.
• The structure of the code suggests that a loop
would make the code more compact.
• In programming, there are two types of loops:
conditional and unconditional.
• The syntax of an unconditional generate statement
in VHDL is:
<label>:
for <parameter> in <range> generate
<concurrent statements>;
end generate;
• The label is compulsory.
• Instance names do not require an index.
• Nested generate statements are allowed in VHDL.
Digital Design II (EE411) | Dr. Samir Bendoukha
Home
Conditional Generate:
• The syntax of a conditional generate statement in
VHDL is:
<label>:
if <condition> generate
<concurrent statements>;
end generate;
• The condition can be any relational operation of
which the output is a logical (true or false).
Process Statement:
• Up to this point in VHDL, we have only dealt with
concurrent assignments and statements.
• VHDL also allows for sequential statements, which
must be placed within a process:
process (<sig1>,< sig1 >,…) is
begin
<sequential statement>;
end process;
• The list of signals named between the parenthesis is
called the sensitivity list.
• When one of these signals changes, the process
becomes active and the code within it is executed
in sequential order.
• Assignments made inside the process are not seen
outside it until all the statements are executed.
If-Then-Else Statement:
• The if-then-else statement has the syntax:
if <condition> then
<statement 1>;
else
<statement 2>;
end if;
• The if-then-else statement may also include the
elseif command:
if <condition 1> then <statement 1>;
elseif <condition 2> then <statement 2>;
else <statement 3>;
end if;
• When multiple conditions exist, the elseif command
may be repeated as required.
library IEEE;
use IEEE.std_logic_1164.all;
entity Seg7 is
port(bcd: in STD_LOGIC_VECTOR(3 downto 0);
leds: out STD_LOGIC_VECTOR(1 to 7));
end Seg7;
End of Chapter VI