VHDML assignment

Discussion in 'Programmer's Corner' started by torobb, Mar 16, 2014.

  1. torobb

    Thread Starter New Member

    Mar 16, 2014
    2
    0
    Im trying to write code for multiplexer/decoder that is hooked up to a 7 segment display using quartus. when I compile i get a 10500 error

    "VHDL syntax error at ...(14) near text "IF" expecting "end" or "(", or an Identifier....."

    here is my code. Thanks for any help you can offer.

    Code ( (Unknown Language)):
    1.  
    2. LIBRARY ieee;
    3. USE    ieee.std_logic_1164.ALL;
    4.  
    5. ENTITY multiplexorDecoder IS
    6. PORT(
    7.     s : IN BIT;
    8.     a : IN STD_LOGIC_VECTOR (3 downto 0);
    9.     b : IN STD_LOGIC_VECTOR (3 downto 0);
    10.     y : OUT STD_LOGIC_VECTOR (7 downto 0));
    11. END multiplexorDecoder;
    12.  
    13. ARCHITECTURE  mDecode OF multiplexorDecoder IS
    14. BEGIN
    15.     IF (s = 1) then
    16.     (With a SELECT
    17.     y <=    "1111110" when "0000" --0
    18.             "0110000" when "0001" --1
    19.             "1101101" when "0010" --2
    20.             "1111001" when "0011" --3
    21.             "0110011" when "0100" --4
    22.             "1010011" when "0101" --5
    23.             "0011111" when "0110" --6
    24.             "1110000" when "0111" --7
    25.             "1111111" when "1000" --8
    26.             "1110011" when "1001" --9
    27.             "0000000" when others);
    28.     else
    29.     (With b SELECT
    30.     y <=    "1111110" when "0000" --0
    31.             "0110000" when "0001" --1
    32.             "1101101" when "0010" --2
    33.             "1111001" when "0011" --3
    34.             "0110011" when "0100" --4
    35.             "1010011" when "0101" --5
    36.             "0011111" when "0110" --6
    37.             "1110000" when "0111" --7
    38.             "1111111" when "1000" --8
    39.             "1110011" when "1001" --9
    40.             "0000000" when others);
    41.     END IF;
    42.     END mDecode;
    43.  
     
    Last edited by a moderator: Mar 16, 2014
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,669
    804
    you need to have if(s==1)
     
  3. torobb

    Thread Starter New Member

    Mar 16, 2014
    2
    0
    My solution was to change the with select statements to case statements.
     
Loading...