Electrical – What does a syntax error mean when it says: “near text ”else“; expecting ”end“, or ”(“ ”

errorvhdl

I just don't think the word "near" is specific enough. Am I missing something before or after the word "else"? I'll put the code below and the errors after it. Thanks in advance!

library ieee;
use ieee.std_logic_1164;
use ieee.std_logic_arith;
use ieee.std_logic_unsigned;

entity decoBCDto7 is
    port(
            binary:     in std_logic_vector(3 downto 0);
            EN:         in std_logic;
            display:    out std_logic_vector(6 downto 0));
end decoBCDto7;

architecture internal of decoBCDto7 is
begin
    process(binary,EN,display)
    begin
        if(EN = '1') then
        with binary select
        display <=      "0111111" when "0000",
                        "0000110" when "0001",
                        "1011011" when "0010",
                        "1001111" when "0011",
                        "1100110" when "0100",
                        "1101101" when "0101",
                        "1111101" when "0110",
                        "0000111" when "0111",
                        "1111111" when "1000",
                        "1100111" when "1001",
                        "0000000" when OTHERS;      
        else
            display <= "0000000";

        end if;
    end process;
end internal;

Error (10500): VHDL syntax error at decoBCDto7.vhd(19) near text "if"; expecting "end", or "(", or an identifier ("if" is a reserved keyword), or a concurrent statement

Error (10500): VHDL syntax error at decoBCDto7.vhd(19) near text "then"; expecting "<="

Error (10500): VHDL syntax error at decoBCDto7.vhd(32) near text "else"; expecting "end", or "(", or an identifier ("else" is a reserved keyword), or a concurrent statement

Error (10500): VHDL syntax error at decoBCDto7.vhd(35) near text "if"; expecting ";", or an identifier ("if" is a reserved keyword), or "architecture"

Best Answer

Prior to VHDL-2008, a WITH-SELECT was a concurrent construct, not a sequential one. So you could't put a WITH-SELECT clause inside a sequential process.

Use a CASE statement instead. That will clear all the error messages and is supported across all releases of the VHDL standard.