Prev Problem
Next Problem

44. Bus Error Checker

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code

module error_checker_xz(
input [7:0] bus,
output all_known,
output has_unknown,
output [7:0] bus_if_known
);

    // Reduction XOR becomes 'x' if any bit is x or z
    assign has_unknown = (^bus === 1'bx);

    assign all_known   = ~has_unknown;

    assign bus_if_known = all_known ? bus : 8'h00;  

endmodule

 

Was this helpful?
Upvote
Downvote