ashwini.naik Posted March 30, 2016 Report Posted March 30, 2016 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?. Quote
kartikkg Posted March 31, 2016 Report Posted March 31, 2016 Hi Ziga, How are you connecting the ports b/w those two modules, have you used sc_signal_resolved for connection? Can you provide an mcve code ? Quote
ashwini.naik Posted March 31, 2016 Author Report Posted March 31, 2016 Yes, I have used sc_signal_resolved for the connection. Quote
kartikkg Posted March 31, 2016 Report Posted March 31, 2016 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. Quote
kartikkg Posted March 31, 2016 Report Posted March 31, 2016 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. Quote
apfitch Posted March 31, 2016 Report Posted March 31, 2016 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 Quote
Recommended Posts
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.