Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

tri-state

Altera_Forum
Geehrter Beitragender II
1.420Aufrufe

I am looking for a Verilog equivalent of a tr-state device (chip-select) on the output pin of my FPGA. I only want to drive a multi-drop bus when selected and go high-impedance when not. What is the easiest way to accomplish this?

0 Kudos
4 Antworten
Altera_Forum
Geehrter Beitragender II
689Aufrufe

An output is tri-stated by assigning the logic state 'Z'.

Altera_Forum
Geehrter Beitragender II
689Aufrufe

out_pin : out std_logic; -- is the pin of the fgpa (shall be put in the entity) 

 

 

signal out_signal, ena : std_logic; -- are internal signal 

 

 

with ena select 

out_pin <= out_signal when 1, 

'Z' when others; 

 

 

In this case ena is active low and is the equivalent of your output enable, when active outpin takes the signal that you want to put out on the pin, whereas when 0 it put it in tri-state.
Altera_Forum
Geehrter Beitragender II
689Aufrufe

 

--- Quote Start ---  

I am looking for a Verilog equivalent of a tr-state device (chip-select) on the output pin of my FPGA. I only want to drive a multi-drop bus when selected and go high-impedance when not. What is the easiest way to accomplish this? 

--- Quote End ---  

 

 

 

Hi, 

 

you can do it in this way: 

 

module tri_state_test ( in, ena, out); 

 

input in; 

input ena; 

 

output out; 

 

assign out = (ena) ? in : 1'bz; 

 

endmodule 

 

Kind regards 

 

GPK
Altera_Forum
Geehrter Beitragender II
689Aufrufe

thanks for the response!  

 

I also found the primitive buffif0. Looks like there are few possibilities.
Antworten