Hey guys, we were being shown how to use if statements in vhdl and i cannot get it to work! Also my lecturer hasnt bothered to reply to my question regarding this so i would like to know what i am doing wrong before the exam.
This code compiles ok when the if statement is removed.
Thanks for the help!
When i try to analyse the code below with quartus II it says the folowing:
Error (10500): VHDL syntax error at demux4-to-16.vhd(16) near text "if"; expecting "end", or "(", or an identifier ("if" is a reserved keyword), or a concurrent statement
Error (10500): VHDL syntax error at demux4-to-16.vhd(36) near text "if"; expecting ";", or an identifier ("if" is a reserved keyword), or "architecture"
Error: Quartus II Analyze Current File was unsuccessful. 2 errors, 0 warnings
Info: Allocated 190 megabytes of memory during processing
Error: Processing ended: Fri Dec 14 12:27:01 2007
Error: Elapsed time: 00:00:01
The code i wrote was for a demultiplexer model:
library IEEE;
use IEEE_std_logic_1164.all;
-- the above two lines instructs the program to use the two standard librabries
entity demux is
port( sel: in_std_logic_vector ( 3 downto 0 );
din: in_std_logic;
enable , ebar : in_std_logic;
dout: in_std_logic_vector ( 15 downto 0));
end demux;
architecture behaviour of demux is
begin
if enable = '1' and ebar = '0' then
dout <= "1111111111111110" when sel = "0000" else
"1111111111111101" when sel = "0001" else
"1111111111111011" when sel = "0010" else
"1111111111110111" when sel = "0011" else
"1111111111101111" when sel = "0100" else
"1111111111011110" when sel = "0101" else
"1111111110111110" when sel = "0110" else
"1111111101111110" when sel = "0111" else
"1111111011111110" when sel = "1000" else
"1111110111111110" when sel = "1001" else
"1111101111111110" when sel = "1010" else
"1111011111111110" when sel = "1011" else
"1110111111111110" when sel = "1100" else
"1101111111111110" when sel = "1101" else
"1011111111111110" when sel = "1110" else
"0111111111111110" when sel = "1111";
end if dout <= "1111111111111111";
end behaviour;
This code compiles ok when the if statement is removed.
Thanks for the help!
When i try to analyse the code below with quartus II it says the folowing:
Error (10500): VHDL syntax error at demux4-to-16.vhd(16) near text "if"; expecting "end", or "(", or an identifier ("if" is a reserved keyword), or a concurrent statement
Error (10500): VHDL syntax error at demux4-to-16.vhd(36) near text "if"; expecting ";", or an identifier ("if" is a reserved keyword), or "architecture"
Error: Quartus II Analyze Current File was unsuccessful. 2 errors, 0 warnings
Info: Allocated 190 megabytes of memory during processing
Error: Processing ended: Fri Dec 14 12:27:01 2007
Error: Elapsed time: 00:00:01
The code i wrote was for a demultiplexer model:
library IEEE;
use IEEE_std_logic_1164.all;
-- the above two lines instructs the program to use the two standard librabries
entity demux is
port( sel: in_std_logic_vector ( 3 downto 0 );
din: in_std_logic;
enable , ebar : in_std_logic;
dout: in_std_logic_vector ( 15 downto 0));
end demux;
architecture behaviour of demux is
begin
if enable = '1' and ebar = '0' then
dout <= "1111111111111110" when sel = "0000" else
"1111111111111101" when sel = "0001" else
"1111111111111011" when sel = "0010" else
"1111111111110111" when sel = "0011" else
"1111111111101111" when sel = "0100" else
"1111111111011110" when sel = "0101" else
"1111111110111110" when sel = "0110" else
"1111111101111110" when sel = "0111" else
"1111111011111110" when sel = "1000" else
"1111110111111110" when sel = "1001" else
"1111101111111110" when sel = "1010" else
"1111011111111110" when sel = "1011" else
"1110111111111110" when sel = "1100" else
"1101111111111110" when sel = "1101" else
"1011111111111110" when sel = "1110" else
"0111111111111110" when sel = "1111";
end if dout <= "1111111111111111";
end behaviour;