I2C inout port signal VHDL simulation

Guest #6117262
Rate this post
useful
not useful
Hello there;

I have simulated a module with an external temperature sensor(LM75). In 
the top Level module the port were defined as "inout" type something 
like this
1
      i2c_scl    : inout std_logic;
2
      i2c_sda    : inout std_logic;
3
      .;
4

5
    achitecture behav of top_level is
6

7
    Signal i2c_scl_int    : std_logic;
8
    Signal i2c_sda_int    : std_logic;
9
    . ;
10
begin
11

12
    i2c_scl <= '0' when i2c_scl_int ='0' else 'Z';
13
    i2c_sda <= '0' when i2c_sda_int ='0' else 'Z';
14
     ;
15
end;

With the above Code my Output was "ZZ" every time and I have to modify 
the LM75 source Code as well as the i2c Controller Code to get a proper 
Output Signal.

I would like to know if there is any other Approach by not modifying the 
source Code and only add some Code in the testbench?

Thank you.
Moderator (Company: Titel) #6117288
Rate this post
useful
not useful
Vahr wrote:
> I would like to know if there is any other Approach by not modifying the
> source Code and only add some Code in the testbench?
Assign a weak "H" to the signals as you do it in real life with the I2C 
pullup resistors also.
Attached files:
Guest #6123279
Rate this post
useful
not useful
Hello Lothar;

Thanks for your help. I do have a proper Output Signal now.

The Problem I am facing now is my i2c_sda Signal. It will start showing 
a proper waveform and later on just Change to "X" and some "H" and "0" 
and the waveform will get back to normal after some time.

Is there any way I can filter it to have a clean Signal?

many thanks

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now