Altera_Forum
Honored Contributor
13 years agowhen use 'else' and when use ; ?
Hi.. I am starter in VHDl.
I have some questions... What is difference between else and ;? first code use else but when i use ';' instead of 'else' it doesn't work. Do you know why? and second question is first code is about 'priority encoder' (priority means that when input comes, the highest input come out to the output. for example .. when inputs are 6 and 5.. the output is only "110" ,not "111"(<= 110 or 101) I learned that the VHDL process the code in parallel unless we don't use 'process statement ' But I don't use 'process statement' in first code, but I think the first code look like being processed in sequential. The reason why I think is when i test the code in Model_sim, I gave input i(6) and i(5) the same clock. and the output is only110, not 111. I think this means the code was processed in sequential even though i don't use 'process statement' what's happening? (1) LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY encoder is PORT( i :IN std_logic_vector(7 downto 0); a : OUT std_logic_vector(2 downto 0)); END encoder; ARCHITECTURE arc of encoder is BEGIN a<= "111" when i(7) ='1' else "110" when i(6) = '1' else "101" when i(5) = '1' else "100" when i(4) = '1' else "011" when i(3)= '1' else "010" when i(2)= '1'else "001" when i(1)= '1' else "000" when i(0)= '1' else "000"; END ARC;