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?

 

 

Code

/*Write your code here*/
module and_op(
    input[3:0] A,
    input[3:0] B,
    output[3:0] AND_OUT
);
    assign AND_OUT = A & B;
endmodule
module or_op(
    input[3:0] A,
    input[3:0] B,
    output[3:0] OR_OUT
);
    assign OR_OUT = A | B;
endmodule
module xor_op(
    input[3:0] A,
    input[3:0] B,
    output[3:0] XOR_OUT
);
    assign XOR_OUT = A ^ B;
endmodule
module xnor_op(
    input[3:0] A,
    input[3:0] B,
    output[3:0] XNOR_OUT
);
    assign XNOR_OUT = ~(A ^ B);
endmodule
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
);
    and_op andOp(A, B, AND_OUT);
    or_op orOp(A, B, OR_OUT);
    xor_op xorOp(A, B, XOR_OUT);
    xnor_op xnorOP(A, B, XNOR_OUT);
endmodule

 

Was this helpful?
Upvote
Downvote