Giter Site home page Giter Site logo

Comments (4)

Juninho99 avatar Juninho99 commented on August 15, 2024

Regardless of how we attempted to assign values through cocotb simulation to the variables i2c_sda_di, i2c_scl_di, i2c_sda_do, or i2c_scl_do, which are connected to the IOBUF module, the value remained as determined by the RTL.

Various approaches such as Force, immediatevalue, and others were tried, but none were successful. Ultimately, we created an empty IOBUF module, which allowed setting values only on the I (input) ports, while the O (output) ports did not allow this.

All of these attempts were made using Verilator.

In the end, we switched to Icarus, which supports not only 0 and 1 but also 'X and 'Z, and there were absolutely no issues with the original IOBUF module or the I2C simulation.

from openeye-camsi.

Juninho99 avatar Juninho99 commented on August 15, 2024

We used the cocotbext-i2c library for simulating the slave device. In the Python script I2CDevice.py, it was necessary to add the following to the constructor:

#....before
def __init__(self, sda=None, sda_o=None, scl=None, scl_o=None, *args, **kwargs):
    self.log = logging.getLogger(f"cocotb.{sda._path}")
    self.sda = sda
    #......
#....after
def __init__(self, addr=None, sda=None, sda_o=None, scl=None, scl_o=None, *args, **kwargs):
    self.log = logging.getLogger(f"cocotb.{sda._path}")
    self.sda = sda
    self.addr = addr
    #.....

These changes were necessary for it to work properly. After making these modifications and running the cocotb simulation with the Icarus simulator, everything worked as expected. A testament to this is the successful write of 65 registers in the slave device.

image

from openeye-camsi.

chili-chips-ba avatar chili-chips-ba commented on August 15, 2024

do we still need this?:

`ifdef COCOTB_SIM
   inout  tri1   i2c_sda,
   inout  tri1   i2c_scl,
`else
   inout  wire   i2c_sda,
   inout  wire   i2c_scl,
`endif //COCOTB_SIM

If cocoTB+Verilator cannot override O port of the dummy IOBUF, try doing this in the dummy IOBUF:

logic  O_from_coco;
assign O = O_from_coco;

then override O_from_coco, which is now an input.

from openeye-camsi.

chili-chips-ba avatar chili-chips-ba commented on August 15, 2024

Also, look for all instances of COCOTB_SIM macro in RTL and try to remove them. Only if absolutely not possible, replace them with SIM_ONLY. The goal is to rationalize the use of macros, as they have global scope.

from openeye-camsi.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.