Situations in which 'else' or 'elsif' are unnecessary.

Joined
Oct 20, 2009
Messages
1
Reaction score
0
Hello.

Code:
signal slv : std_logic_vector(1 downto 0);
signal s1,s2 : std_logic;
process()
begin
  s1 <= '0';
  s2 <= '0';
-----------------
--
-- Version with 'elsif'
--
  if(slv = "00") then
    s1 = '1';
  elsif (slv = "10") then
    s2 = '1';
  end if;
-----------------
--
-- Version without 'elsif'
--
  if (slv = "00") then
    s1 <= '1';
  end if;
  if (slv = "10") then
    s2 <= '1';
  end if;
-----------------
end process;

Any difference?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top