Forum: FPGA, VHDL & Verilog Test bench I2C (vhdl)

Author: Javier P. (lascameador)
Posted on:

Rate this post
0 useful
not useful
hi guys!
I've developed two i2c components.
u1: SlaveI2CA generic map (SLAVE_ADDR) port map(scl,sda1,clk,rst,starting1,sda2);
u2: SlaveI2CB generic map (SLAVE_ADDR) port map(scl,sda3,clk,rst,starting2,sda4);

I want to connect sda2 and sda3 with a pullup resistor (in simulation) 
but i don't know how to do this.
When I write 'Z' or '0' the slave works,while it has already been 
programmed ,but i don't know how to develope this function in 

any advices??
thanks ;)

Author: Lothar M. (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Javier PA wrote:
> but i don't know how to develope this function in simulation.
Try it with Google translator:

I would take the switch model and connect it with a pullup (='H') this 
 SDA_A --- Switch --- 'H' --- Switch --- SDA_B

 SCL_A --- Switch --- 'H' --- Switch --- SCL_B

Of course the switch model could be simplified to a Zero-Ohm this way:
library IEEE;

entity zeroohm is
    Port ( A : inout  STD_LOGIC;
           B : inout  STD_LOGIC);
end swbidi;

architecture Behavioral of zeroohm is
    variable thentime : time;
    wait on A, B until thentime /= now;
    -- Break
    thentime := now;
    A <= 'Z';
    B <= 'Z';
    wait for 0 ns;
    -- Make
    A <= B;
    B <= A;
  end process;

end Behavioral;

: Edited by Moderator


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.