In Sequential Assignment ordering of statements in vhdl code may affect its meaning.
All Sequential Assignments should be inside a process . Functions and procedure also execute statements sequential.
1.) if-then
Example 1. MUX2is1 :-
Types of Sequential Assignments :
All Sequential Assignments should be inside a process . Functions and procedure also execute statements sequential.
1.) if-then
Example 1. MUX2is1 :-
PROCESS (w0,w1,s)
BEGIN
y <= w0;
if ( s = '1' ) then
y <= w1;
end if;
END PROCESS;
2.) if-elsif
Example 1. MUX4is1 :-
PROCESS (w0,w1,s)
BEGIN
if ( s = "00" ) then
y <= w0;
elsif ( s = "01" ) then
y <= w1;
elsif ( s = "10" ) then
y <= w2;
elsif ( s = "11" ) then
y <= w3;
else
y <= 'X'; -- undefined
end if;
END PROCESS;
3.) case statement
Example 1. MUX2is1 :-
PROCESS (w0,w1,s)
BEGIN
CASE s is
WHEN '0' =>
y <= w0;
WHEN others =>
y <= w1;
END CASE;
END PROCESS;
Example 2. Decoder2is4 :-
PROCESS (I,enb_n)
BEGIN
if ( enb_n = '0') then
CASE I is
WHEN "00" =>
y <= "0001";
WHEN "01" =>
y <= "0010";
WHEN "10" =>
y <= "0100";
WHEN "11" =>
y <= "1000";
WHEN others =>
y <= "XXXX";
END CASE;
else
y <= (others=>'0');
end if;
END PROCESS;
4.) LOOP Statements
No comments:
Post a Comment