Search code examples
yosys

iCE40 IceStorm FPGA: Switchable Pullup on Bi-directional IO pins


How can I add a switchable pullup to a Tri-State pin?

There are the "Tri-State" and the "Pull-Up" blocks in icestudio. I want to combine them into a "Tri-State with Pull-Up" block that has another input that allows to enable or disable the pull-up (if the tri-state is in input mode of course).

Just using a signal ('pu') instead of a constant like shown here:

  SB_IO #(
      .PIN_TYPE(6'b1010_01),
      .PULLUP(pu)
  ) io_pin (
      .PACKAGE_PIN(pin),
      .OUTPUT_ENABLE(oe),
      .D_OUT_0(din),
      .D_IN_0(dout)
  );

results in a non-constant value error and does not synthezise.

It should synthezise and by that provide another input 'pu' that allows to set the state of the pull-up (1=enabled/on or 0=disabled/off).

If this behaviour is not possible, is there another way (work-a-round) to get switchable pullups?


Solution

  • Found the answer here: https://discourse.tinyfpga.com/t/internal-pullup-in-bx/800/12

    The general answer is; NO, it can't be added. There are a few dedicated pins on some FPGAs (e.g. 2 pins on the UltraPlus) that have dynamic pullup control. The SB_IO_I3C primitive supports it, confer e.g. https://github.com/cliffordwolf/icestorm/blob/master/icefuzz/tests/sb_io_i3c.v Besides these pins the general IO block on all other pins has no input for pullup control.