A problem with conv_integer

Discussion in 'VHDL' started by ThWolf, Dec 13, 2008.

  1. ThWolf

    ThWolf

    Joined:
    Dec 13, 2008
    Messages:
    2
    Hi

    I want to write a simple demux, yet I wanted to make it as short as possible. Therefore I used conv_integer, but it showed me a strange error (I'm using quartus 6.0, and have tried the same program in ISE). The error makes somewhat sense, but I want to find a solution so that I don't have to use case (and be able to use a generic).
    Here is the code:

    Library IEEE;
    use IEEE.std_logic_1164.all;
    use IEEE.std_logic_arith.all;
    use IEEE.std_logic_unsigned.all;

    Entity Demux is
    port (I : in std_logic;
    S: in std_logic_vector(2 downto 0);
    Q: out std_logic_vector(7 downto 0));
    End entity;

    Architecture behave of Demux is
    Begin
    Process(S,I)
    Begin
    Q <= (conv_integer(unsigned(s)) => I, others => 'Z');
    end process;
    end architecture;

    The error that shows up is:
    Error (10318 ): VHDL aggregate error at demux.vhd(16): choice must be constant

    Thank you for your help.
     
    ThWolf, Dec 13, 2008
    #1
    1. Advertising

  2. ThWolf

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Location:
    Denmark
    A wild quess - this code will work better

    Library IEEE;
    use IEEE.std_logic_1164.all;
    use IEEE.std_logic_arith.all;
    use IEEE.std_logic_unsigned.all;

    Entity Demux is
    port (I : in std_logic;
    S: in std_logic_vector(2 downto 0);
    Q: out std_logic_vector(7 downto 0));
    End entity;

    Architecture behave of Demux is
    Begin
    Process(S,I)
    Begin
    Q <= (others => 'Z');
    Q(conv_integer(unsigned(s))) <=I;
    end process;
    end architecture;

    Jeppe
     
    jeppe, Dec 14, 2008
    #2
    1. Advertising

  3. ThWolf

    ThWolf

    Joined:
    Dec 13, 2008
    Messages:
    2
    Yeah, it works, thats actually the first code I wrote, and it worked well in ISE (I didn't have quartus back then). Thing is, I wrote this code as homework, and when I tried to simulate it in class (we use MAX-plus2), it didn't worked. Furthermore, it showed a warning (not an error) - That there has been more then one assignment to Q, and only the last one will be taken into account.
     
    ThWolf, Dec 15, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Giox

    CONV_INTEGER problems

    Giox, Feb 12, 2006, in forum: VHDL
    Replies:
    3
    Views:
    21,160
  2. ted.franklin3@gmail.com

    CONV_INTEGER ERROR

    ted.franklin3@gmail.com, Oct 18, 2006, in forum: VHDL
    Replies:
    4
    Views:
    5,240
    Jim Lewis
    Oct 18, 2006
  3. nfirtaps
    Replies:
    8
    Views:
    1,917
    Ray Andraka
    Nov 17, 2006
  4. Clemens

    conv_integer for unsigned value

    Clemens, Jul 8, 2008, in forum: VHDL
    Replies:
    9
    Views:
    4,280
    rickman
    Jul 14, 2008
  5. geeta k

    conv_integer

    geeta k, Apr 25, 2013, in forum: VHDL
    Replies:
    1
    Views:
    488
    rpaley000@gmail.com
    Apr 25, 2013
Loading...

Share This Page