VHDL 1 Aniruddha
VHDL 1 Aniruddha
Concurrent Statements
• All concurrent statements in an architecture are executed
simultaneously.
• Concurrent statements are used to express parallel activity as is the case with
any digital circuit.
• They can be used for behavioral and structural and data flow descriptions.
Concurrent statements contd.
• Process is a concurrent statement in which sequential
statements are allowed.
• All processes in an architecture are executed simultaneously.
entity tri_state is
port (a, en : in std_logic;
b : out std_logic);
end tri_state;
architecture beh of tri_state is
begin
b <= a when en = „1‟ else
„Z‟;
end beh;
example
• Syntax(Instantiation)
label:component_name
[generic map]
port map;
entity my_and is
U1: my_and
port( a : in std_logic;
generic map (tpd => 5 ns)
b : in std_logic;
port map (x => a,
c : out std_logic);
y => b,
end my_and;
z => temp);
architecture my_and_A of my_and is
component and2
generic (tpd: time := 2 ns);
port (x : in std_logic;
y : in std_logic;
z : out std_logic); U2: my_and
end component; generic map (tpd => 2 ns)
signal temp : std_logic; port map (x => a,
begin y => b,
c <= temp; z => temp);
-- component instantiation here
end my_and_A;
architecture exor_A of exor is
component my_or u1 : my_or
port (a : in std_logic; port map (y2,
b : in std_logic; y3,
y : out std_logic y1);
); u2 : my_and
end component; port map (a_n,
component my_and b,
port (a : in std_logic; y2);
b : in std_logic; u3 : my_and
y : out std_logic port map (a,
); b_n,
end component; y3);
signal a_n, b_n : std_logic;
signal y1, y2, y3 : std_logic; a_n <= not a ;
begin b_n <= not b ;
. . . . .
end exor_A;
Component Instantiation contd.
Positional association
U1: my_and
generic map(5 ns)
port map(a, b, temp);
Named Association
U1:my_and
generic map (tpd => 5 ns)
port map (x => a,
y => b,
z => temp);
The formal and the actual can have the same name
Component Instantiation contd.
• The simulator runs a process when any one of the signals in the sensitivity
list changes. For a wait statement, the simulator executes the process after
the wait is over.
• The simulator takes 0 simulation time to execute all the statements in the
process. (provided there is no wait)
process
begin
if (reset = „1‟) then
A <= „0‟ ;
elsif (clk‟event and clk = „1‟) then
A <= „B‟;
end if;
wait on reset, clk;
end process;
process (clk,reset)
begin
if (reset = „1‟) then
A <= „0‟;
elsif (clk‟event and clk = „1‟) then
A <= „B‟;
end if;
end process;
Sequential Statements
• Sequential statements are statements which are analyzed
serially one after the other. The final output depends on the
order of the statements, unlike concurrent statements where
the order is inconsequential.
• Syntax
if condition1 then
statements
[elsif condition2 then Priority
statements]
[else
statements]
end if;
• An if statement selects one or none of a sequence of events to
execute . The choice depends on one or more conditions.
The if statement contd.
case expression is
when choice 1 =>
statements
when choice 3 to 5 =>
statements
when choice 8 downto 6 =>
statements
when choice 9 | 13 | 17 =>
statements
when others =>
statements
end case;
The case statement
• The case statement selects, for execution one of a number of alternative
sequences of statements .
• Case statement does not result in prioritized logic structure unlike the if
statement.
The case statement contd.
process(sel, a, b, c, d)
process (count) begin
begin case sel is
case count is when “00” =>
when 0 => dout <= a;
dout <= “00”; when “01” =>
when 1 to 15 => dout <= b;
dout <= “01”; when “10” =>
when 16 to 255 => dout <= c;
dout <= “10”; when “11” =>
when others => dout <= d;
null; when others =>
end case; null;
end process; end case;
end process;
Think Hardware! (Mutually exclusive
conditions)
myif_pro: process (s, c, d, e, f)
begin
if s = "00" then
pout <= c;
elsif s = "01" then
pout <= d;
elsif s = "10" then
pout <= e;
else
pout <= f;
end if;
end process myif_pro;