Tri State Buffer Primitive
Shared data buses require drivers that can yield control when not actively transmitting. Tri-state buffers achieve this by driving a high or low voltage when enabled, and entering a high-impedance state when disabled to avoid bus contention.
The module receives a 1-bit input signal in and a 1-bit active-high enable signal en. When en is asserted, the out signal reflects the logic level of in. When en is de-asserted, the out signal is driven to a high-impedance state (1'bz). The circuit is purely combinational.
While this behavior can be modeled with a ternary continuous assignment, Verilog provides built-in gate primitives for standard logic functions. This module must instantiate the standard bufif1 primitive to drive the output.
| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | in | input | 1 | Data input signal | | en | input | 1 | Active-high enable signal | | out | output | 1 | Data output; driven to in when en is 1, otherwise high-impedance (z) |
Constraints
- The circuit must be purely combinational with no clocks or latches.
- The output must be exactly
1'bzwhen the enable signal is low. - You must instantiate the
bufif1primitive rather than using anassignstatement with a ternary operator.
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against a real testbench — you get the waveform back, not a stored answer.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.