Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > synthesizable Generic Mux

Thread Tools

synthesizable Generic Mux

slvador slvador is offline
Junior Member
Join Date: Apr 2009
Posts: 1

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


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
Reply With Quote
jeppe jeppe is offline
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 348

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

   process( Sel, Inputs)
	   variable Hi_index,Lo_index: integer range 0 to 255;
		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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic, synthesizable synchronous 16x32 FIFO Calvin VHDL 1 05-03-2005 08:39 AM
Designing MUX with tri sate buffers in xilinx virtex II FPGA Oleg VHDL 4 04-06-2004 02:55 PM
Propagation delay trought a control signal "SEL" of a MUX Oleg VHDL 1 02-18-2004 07:45 PM
Best way to mux addresses salman sheikh VHDL 0 01-30-2004 09:02 PM
Which method is better ? (about mux) Fano VHDL 0 07-30-2003 12:22 PM