Prev Problem
Next Problem

12. Vector Bitwise Operators

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

The module computes bitwise AND, OR, XOR, and XNOR between two 4-bit inputs by applying Verilog’s native bitwise operators directly to the input vectors, producing clean and efficient combinational logic.

Code

/*Write your code here*/
module bitwise_ops_demo(
    input [3:0] A,
    input [3:0] B,
    output [3:0] AND_OUT,
    output [3:0] OR_OUT,
    output [3:0] XOR_OUT,
    output [3:0] XNOR_OUT
);
    assign AND_OUT = A & B;
    assign OR_OUT = A | B;
    assign XOR_OUT = A ^ B;
    assign XNOR_OUT = ~(A ^ B);
endmodule

 

Was this helpful?
Upvote
Downvote