I am designing a simple bus with 3-state buffers. My buffers work fine, but in my design I only get 8'bZZZZZZZZ output whether the select is 1 or 0. Here is the design that I am working on:
Here is my code:
module part_1(
input wire select,
input wire[7:0]data_1,
input wire[7:0]data_2,
output reg [7:0]out
);
wire [7:0]out1;
wire [7:0]out2;
three_state_buffer TSB1(.enable(~select), .in(data_1), .out(out1));
three_state_buffer TSB2(.enable(select), .in(data_2), .out(out2));
always@(*) begin
if(select)
begin
out <= out2;
end
else
begin
out <= out1;
end
end
endmodule
My three_state_buffer
modules returns input if the select is 1 and returns 8-bit high-z if the select is 0.