(^bus === 1'bX)
Bitwise on the bus, and then check if the result is X. If there is any bit X or Z, then the result will be X.
To find out which bit on the bus has an error:
always @* begin for(integer i=0; i<$size(bus); i++) begin if(bus[i]===1'bX) $display("bus[%0d] is X",bus[i]); if(bus[i]===1'bZ) $display("bus[%0d] is Z",bus[i]); end end
source share