Bidirectional assignment – tranif

If you are trying to model out a bidirectional mux, the tranif primitives might be more appropriate to use. With usage of tranif primitives, you can have more control over the connection between two wires.

Where x and y are wires that need to be connected, c0 and c1 are control signals. 

In SV testbench it can be useful to connect a VIP interface signal to a GPIOx DUT pin, only when a certain interface is selected;otherwise you want that GPIOx pin to be on a pull-down or pull-up.

If we have an interface instance:

And a DUT instance:

We want to assign to a gpiox pin a signal mosi. We do not want that signal to be assigned during  the entire simulation, but only during some trigger event (for desired vip_en and specific protocol)

The trigger event for example could look like this:

So, instead of the classic assignment we can use tranif1 primitive in this example:

This will always “look over” protocol_en signal and it will only connect dut.gpiox_pad and example_if.mosi  when protocol_en is set to 1.

If we use tranif0 instead of tranif1, the interface signal and dut pin will be connected when protocol_en is set to 0.

Contact Us

Please, enter your details below. We will get back to you as fast as we can.

This website uses cookies to ensure you get the best experience on our website.

Get Cogita

Please, enter your details below. We will get back to you as fast as we can.

Thank you!

We will get in touch soon.

Get a Quote

Please, enter your details below. We will get back to you as fast as we can.