synthesizable Generic Mux

Discussion in 'VHDL' started by slvador, Apr 7, 2009.

  1. slvador

    slvador

    Joined:
    Apr 7, 2009
    Messages:
    1
    Likes Received:
    0
    Hello

    i am trying to make a generic mux that takes any number of inputs, input width and number of selectors. i have the following code. it works in sumulation, but when i try to synthesize it, VHDL issue a warning about a width mismatch. and for some reason, it takes all the memory to synthesize it, so i run out of memory error. which is 2 gigs. i am trying to use a big mux with 138 input width and 8 select pins. i try to reduce number of inputs, but that didn't work. here is the code for my generic mux

    entity gen_mux is generic (noInputs : integer :=8; input_width : integer := 32; select_Pins : integer :=3);
    Port ( inputs : in STD_LOGIC_VECTOR(noInputs * input_width -1 downto 0);
    sel : in STD_LOGIC_VECTOR(select_Pins -1 downto 0);
    output : out STD_LOGIC_VECTOR(input_width -1 downto 0));
    end gen_mux;

    architecture Behavioral of gen_mux is

    begin


    output <= inputs((CONV_INTEGER(sel)+1)*input_width-1 downto CONV_INTEGER(sel)*input_width );

    end Behavioral;

    the bold sentence is the important one. it is a very simple way to do it. i think the problem is the CONV_INTEGER, but i don't know how to substitute it with something else

    If any got any input, please
     
    slvador, Apr 7, 2009
    #1
    1. Advertisements

  2. slvador

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Likes Received:
    0
    Location:
    Denmark
    Hi

    I tried this myself, but your right .. the code surely gives the synthesize tools problems.
    However seems the code below to work ok.

    Code (Text):
    begin
       process( Sel, Inputs)
           variable Hi_index,Lo_index: integer range 0 to 255;
        begin
            Lo_index :=   CONV_INTEGER(sel)*input_width;   
            Hi_index :=   Lo_index+input_width-1;
            output <= inputs( Hi_index downto Lo_index);
       end process;
    end Behavioral;
    Your welcome
    Jeppe
     
    jeppe, Apr 8, 2009
    #2
    1. Advertisements

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. Fano
    Replies:
    0
    Views:
    1,182
  2. salman sheikh

    Best way to mux addresses

    salman sheikh, Jan 30, 2004, in forum: VHDL
    Replies:
    0
    Views:
    662
    salman sheikh
    Jan 30, 2004
  3. Oleg
    Replies:
    1
    Views:
    987
    Francisco Rodriguez
    Feb 18, 2004
  4. Oleg
    Replies:
    4
    Views:
    7,438
    Ray Andraka
    Apr 6, 2004
  5. Calvin
    Replies:
    1
    Views:
    1,006
  6. Murat Tasan
    Replies:
    1
    Views:
    8,401
    Chaitanya
    Feb 3, 2009
  7. nramnath@gmail.com

    Generic class in a non generic class

    nramnath@gmail.com, Jun 17, 2006, in forum: Java
    Replies:
    2
    Views:
    631
    nramnath@gmail.com
    Jul 4, 2006
  8. minlearn
    Replies:
    2
    Views:
    641
    red floyd
    Mar 13, 2009
Loading...