Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

I2C and Modelsim

I have a NIOS II system created with a bidirectional I2C SDA pin on SOPC.

How can I add a pullup to this pin, as a pin in an SOPC component, so I can simulate my design?

Thank you.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You need to do it in your testbench. And you should do it for SCL as well.

    In Verilog, declare the signal as tri1.

    In VHDL, declare it as std_logic as usual but add an assignment of 'H'.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    What testbench? The testbench is generated by SOPC by clicking the simulation checkbox.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Ah I think I got you. Ignore what I just said. I will get back if what I try now does not work.

    Thank you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    In Assignment Editor choose "Passive Resistor" for a pin and set it to Pull-Up. This is for functional simulation only.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I am running the modelsim simulation from eclipse so only the sopcinfo/bsp stuff is being simulated. That is my problem.