Jump to content

Recommended Posts

Posted

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?.

Posted

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.

Posted

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.

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...