Check the data sheet for your part. Some parts will allow for true
*internal* tri-states, while others do not. For example, a Xilinx 4000 series FPGA will do true internal tristates, while neither the Virtex nor Spartan series FPGA will not.
For parts that do support it, you will need to add a line like this (for VHDL):
TSTATE_BUS 'Z');
Note, you can still do this even in later families, but the compiler will turn it into a mux - so be careful. If you aren't aware of that behavior, you can be surprised on large designs with low LUT margins.
Note, I have seen some IP cores that use an 'OR'ed bus structure to solve this problem. With an OR type bus, you just drive zeros when not enabled:
arcitecture rtl of sample is
-- To simplify the OR logic, make these the same width. Your compiler/synthesizer should optimize away bits you don't need - while still making the correct connections. Just load the registers you DON'T need with a constant value. signal My_Bus_1_d, My_Bus_1_q : std_logic_vector( BUS_WIDTH_MINUS_1 downto 0 ); signal My_Bus_2_d, My_Bus_2_q : std_logic_vector( BUS_WIDTH_MINUS_1 downto 0 );
-- Don't worry too much about the My_Data_n busses - you can pad the bus when you feed it to My_Bus_n_d; signal My_Data_1 : std_logic_vector( 3 downto 0); signal My_Data_2 : std_logic_vector( 15 downto 0);
begin
-- You need one of these per *readable* register/entity My_Bus_1_d '0'); My_Bus_2_d '0');
-- To keep your combinational logic path to a minimum, register each "My_Bus". This isn't necessary, and does add an additional clock of latency, but if your timing is marginal, this will help.
S_Regs : process( Reset_n, Clock ) begin if( Reset_n = '0' )then My_Bus_1_q '0'); My_Bus_2_q '0'); elsif( rising_edge(Clock) )then My_Bus_1_q