Test bench I2C (vhdl)

OP #4053003
Rate this post
• ▲ useful
▼ not useful
hi guys!
I've developed two i2c components.
1
u1: SlaveI2CA generic map (SLAVE_ADDR) port map(scl,sda1,clk,rst,starting1,sda2);
2
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 
simulation.

any advices??
thanks ;)
Moderator (Company: Titel) #4053592
Rate this post
• ▲ useful
▼ not useful
Javier PA wrote:
> but i don't know how to develope this function in simulation.
Try it with Google translator:
http://www.lothar-miller.de/s9y/archives/91-Schalter-und-Bruecke.html

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

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

Of course the switch model could be simplified to a Zero-Ohm this way:
1
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3

4
entity zeroohm is
5
    Port ( A : inout  STD_LOGIC;
6
           B : inout  STD_LOGIC);
7
end swbidi;
8

9
architecture Behavioral of zeroohm is
10
begin
11
  process
12
    variable thentime : time;
13
  begin
14
    wait on A, B until thentime /= now;
15
    
16
    -- Break
17
    thentime := now;
18
    A <= 'Z';
19
    B <= 'Z';
20
    wait for 0 ns;
21
    
22
    -- Make
23
    A <= B;
24
    B <= A;
25
  end process;
26

27
end Behavioral;

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.