# Usage of "pullup" and "bufif0" Switch-level modelling constructs in Verilog

**URL:** <https://verificationacademy.com/forums/t/usage-of-pullup-and-bufif0-switch-level-modelling-constructs-in-verilog/32309>\
**Category:** SystemVerilog\
**Tags:** bufif0, SystemVerilog, pullup\
**Created:** [September 26, 2016, 12:10pm UTC](https://verificationacademy.com/forums/t/usage-of-pullup-and-bufif0-switch-level-modelling-constructs-in-verilog/32309 "2016-09-26T12:10:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwathprabhakar](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/e274bd/32.png) [@ashwathprabhakar](https://verificationacademy.com/forums/u/ashwathprabhakar)\
**Post date:** [September 26, 2016, 12:10pm UTC](https://verificationacademy.com/forums/t/usage-of-pullup-and-bufif0-switch-level-modelling-constructs-in-verilog/32309/1 "2016-09-26T12:10:07Z")

</div>

I am experimenting with how the “pullup” and “bufif0” switch-level constructs work in Verilog. The concept is to be used in an UVM-based I2C top module for generating the “sda” and “scl” signals.

I have implemented a stand-alone experimental code in Verilog to observe the signal value changes through the use of “pullup” and “bufif0” constructs, as follows:

```verilog
module top();

  wire x, y;
  wire f, g;
  supply0 gnd;

  bufif0(x, gnd, f);
  bufif0(y, gnd, g);

  pullup(x);
  pullup(y);

  initial #10 $stop();

endmodule

```

My expectation is that the “x” and “y” signals should be pulled up to 1’b1 and the value propagated to “f” and “g” respectively through the tri-state buffer construct (bufif0). However, what I get is as follows:  
“x” - remains at X (value: 65X)  
“y” - remains at X (value: 65X)  
“f” - Z (high impedance)  
“g” - Z (high-impedance)

Am I missing something in the code? Can someone help me resolve the issue or point me to references for the same?

Regards

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [September 26, 2016, 2:21pm UTC](https://verificationacademy.com/forums/t/usage-of-pullup-and-bufif0-switch-level-modelling-constructs-in-verilog/32309/2 "2016-09-26T14:21:34Z")

</div>

_In reply to [kautilya87](https://verificationacademy.com/forums/t/usage-of-pullup-and-bufif0-switch-level-modelling-constructs-in-verilog/32309):_  
The **bufif0** primitive is unidirectional. You need to use the **tranif0** to get bidirectional signal flow. See section _28.8 Bidirectional pass switches_ in the LRM.
