Jump to content

Recommended Posts

I am writing I2C model (as per my requirement) which include master.cpp and slave.cpp. There are 2 signals: SDA and SCL, both are type of sc_inout_resolved in both the files. Connection and Port binding is done perfectly in test bench as well.  I am controlling SDA & SCL in file called master.cpp. While transferring ack from slave to master,  SDA will be controlled by slave.cpp (writes SDA 0). After this again master.cpp should control the SDA line for further transactions. But once controlling on SDA switches to slave.cpp, unable to control SDA again from master.cpp. Writing values(0,1) on SDA is not making any difference. I confirmed this issue using gtkwave. Am I missing anything here? Can anyone tell how to handle sc_inout_resolved between 2 models?.

Share this post


Link to post
Share on other sites

Hi Ziga,

Since you are using sc_inout_resolved in both files & since ACK in I2C is a '0'  I am assuming you are parking the SDA line to '1' from master.cpp which is getting resolved as '1' , hence you are not getting ACK.

Share this post


Link to post
Share on other sites

Hi Ziga,

Since you are using sc_inout_resolved in both files & since ACK in I2C is a '0'  I am assuming you are parking the SDA line to '1' from master.cpp which is getting resolved as '1' , hence you are not getting ACK.

Share this post


Link to post
Share on other sites

One other thing to note is that I2C uses an open drain connection, which in VHDL you can model with 'H' (weak high). But in sc_logic you've haven't got 'H', so you'll probably have to use 'Z' to model the undriven (no pull down) state of the I2C connections.

 

regards

Alan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×