Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status of the project + a few questions #3

Open
GiuseppeDiGuglielmo opened this issue Nov 18, 2023 · 4 comments
Open

Status of the project + a few questions #3

GiuseppeDiGuglielmo opened this issue Nov 18, 2023 · 4 comments

Comments

@GiuseppeDiGuglielmo
Copy link

hi Alex,
what is the status of the project? are there known issues/limitations, for example

  • can this extension be used to test any i2c slave?
  • nack doesn't seem to be handle
  • is there support for clock stretching?

Thanks,
G.

@GiuseppeDiGuglielmo GiuseppeDiGuglielmo changed the title Status of the project Status of the project + a few questions Nov 18, 2023
@GiuseppeDiGuglielmo
Copy link
Author

For a classical interface where sda is inout:

module i2c_slave (scl, sda);
  
  input scl;
  inout sda;

endmodule

should the cocotb Master be

i2c_master = I2cMaster(sda=dut.sda, sda_o=dut.sda, scl=dut.scl)

or just

i2c_master = I2cMaster(sda=dut.sda, scl=dut.scl)

?

@alexforencich
Copy link
Owner

The intention was to support that as

i2c_master = I2cMaster(sda=dut.sda, scl=dut.scl)

But, unfortunately there are bugs in some combination of cocotb, the verilog PLI, and various simulators that seem to prevent that from working. Or, at least I have not yet found a solution that works, nor have I had the time to expolore this in great detail. So, I think at least for the time being, an HDL "shim" implementing tristate buffers will be required to interface with HDL code that uses inout pins.

As an aside, generally I2C components should not use inout pins in the first place, as this makes it impossible to interconnect them internally, and potentially makes testing more complicated. Instead, input and output pins should be used, with tristate buffers instantiated at the edge of the chip.

@alexforencich
Copy link
Owner

Also, it should work for any I2C components, although I'm not sure if multi-master works properly. Clock stretching should also work. Not sure about nacks; I don't think that will generate an exception, but I think it should be recorded somewhere.

@GiuseppeDiGuglielmo
Copy link
Author

GiuseppeDiGuglielmo commented Dec 4, 2023

@alexforencich as far as I understand a Verilog wrapper of an I2C slave should have some extra logic besides the tristate buffers.

I think I should (or may have to) keep 2 SDA ports (sda and sda_o on your cocotb I2C master) and have a single SDA port that is inout on the slave. Let's ignore for the time being SCL. Do you have any suggestion?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants