I have an issue of using I2C MasterCore from OpenCores when I need to map to FPGA. The issue related to handle bi-directional SCL and SDA ports.
I download the code from https://opencores.org/project,i2c. I create a top I2C (I just care about SCL and SDA inout port, for other port, I temporarily ignore it)
I do not understand the following.
- If we use simulation, we need to pullup SCL and SDA by pullup(SCL) and pullup(SDA) in testbench to make sure that when scl_padoen_o = H, SCL is 1'bz, and the pullup(SCL) will make SCL = H in this case. For SDA, I also think it is same as SCL. But pullup() is not synthesizable! In this case, if I need to map to FPGA, how can I "pullup" SCL or SDA?
I do not understand the following.
- If we use simulation, we need to pullup SCL and SDA by pullup(SCL) and pullup(SDA) in testbench to make sure that when scl_padoen_o = H, SCL is 1'bz, and the pullup(SCL) will make SCL = H in this case. For SDA, I also think it is same as SCL. But pullup() is not synthesizable! In this case, if I need to map to FPGA, how can I "pullup" SCL or SDA?
As I read from https://opencores.org/project,i2c, this core has a Wishbone bus that will communicate with the other higher level logic. This is the master side. Your I2C is also a part of the FPGA.
The SCL and SDA are the other ports and is the slave side. With these ports you communicate off-FPGA, with the slaves.
When you simulate the entire design, SCL and SDA ports are communicating with the non-FPGA world. So in the testbench you have do a pullup(). Your pullup() shouldn't reside inside your DUT, they are non-synthesizable.