Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Mux INOUT port in VHDL

Hi all!

Currently I'm trying to connect my I2C master module to one of four I2C slaves using a mux without success: I can't get the bidirectional SDA signal to correctly mux. The code is as follows:

mux_sda: process (sel, i_sda_o, sda)
begin
    sda <= (others => 'Z');
    if i_sda_o = '0' then
        sda(sel) <= '0';
    end if;
end process;
i_sda_i <= to_x01(sda(sel));
where

  • sda is a vector of SDA pins on the FPGA declared as INOUT,

  • i_sda_o the internal SDA output from the I2C Master to driver SDA,

  • i_sda_i the internal SDA input to the I2C Master to read SDA and

  • sel an integer used to select the pin to connect the master to.

If I try to simulate the module everything works as expected. Trying to synthesise it, Quartus complains "Illegal directional connection" for every pin in sda at "i_sda_i <= ..."

Can anyone please give me a hint why I'm not allowed to read a particular element of sda and how to solve that? Thank You!

Best Regards

Pauliman

PS: I'm on Quartus 11.0 and ModelSim 6.6d.

20 Replies