migen icon indicating copy to clipboard operation
migen copied to clipboard

TSTriple() usage

Open jimmymagemtek opened this issue 4 years ago • 1 comments

Hi Sir, As the line of code below,

    ts_sda = TSTriple(1)

ts_sda then has three attributes: ts_sda.i ts_sda.o ts_sda.oe Why do I see in some example code that ts_sda.oe is used as the output port, instead of ts_sda.o ?

What do they really represent respectively? I can't tell even after see the definition in specials.py

Thanks. Jimmy

jimmymagemtek avatar Aug 20 '21 10:08 jimmymagemtek

I don't know which code you are referring to @jimmymagemtek but oe is the "output enabled" and o is the "output value".

But if in some specific case, for instance an I2C bus where lines are Open Drain with an on-board pull-up, you can just hard wire .o to 0 and only drive .oe to 1 when you want to output a 0 and drive .oe at 0 when you don't want to drive the output (which therefore will rise to a 1 because of the pull-up).

That's maybe why you sometimes see that only .oe is driven to different values.

But:

  • oe is output enable
  • o is output value
  • i is input value

fallen avatar Jul 11 '25 15:07 fallen