two-bit equality

题目如下:

Create a circuit that has two 2-bit inputs A[1:0] and B[1:0], and produces an output z. The value of z should be 1 if A = B, otherwise z should be 0.

代码如下:

module top_module ( input [1:0] A, input [1:0] B, output z ); 
    assign z=(A==B)?1'b1:1'b0;
endmodule
posted @ 2024-03-07 16:09  江左子固  阅读(9)  评论(0)    收藏  举报