Forum Discussion

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

Tristate Buffer and Open Drain

Hi

I would like to implement open drain function with the verilog code below:

assign q = sel ? 1'bz : 1'b0; //open drain

assign q = sel ? 1'b1 : 1'bz; // use tristate buffer to model open drain function with weak pull up resistor

Both using Pin Assignment with weak pull up resistor on q.

So, are they equivalent? Will the tristate buffer cause the contention?

Thanks.

2 Replies

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

    They are not equivalent. The first one is the right code, if I understood what you mean.

    The second one doesn't make sense: you'd always get a high level on that pin, unless you have an external pull DOWN instead of the internal pull up.