I'm trying to connect multiple modules in verilog sharing a common "BUS" of size 16bits. I'm having trouble connecting multiple inputs(drivers) to the BUS. When I attach more then one driver, I get an error within Xilinx.
Signal BUS in unit {Top_Module_Name} is connected to following multiple drivers:
The code I have for the modules are
input en;
output [15:0] BUS;
reg [15:0] data;
if (en) begin BUS = data;
else BUS = 16'dZ;
In the top module I have something similar to
module1(en1,wBUS);
module2(en2,wBUS);
module3(en3,wBUS);
I have a controller controlling enables with 1 hot encoding.
Your
BUS
output is not areg
, but awire
. To useBUS
in aIF
statement (inside a combinationalalways
of course)BUS
has to be defined asreg
.Something like this:
If
bus
is going to be a wire...