HDLBits Solution : Two Bits Equality

In this quiz, I was required to create a circuit which compare two inputs. If the two inputs are equal, the outputs would be 1, else the output would be 0. I used if-else statement here.

Here is my code.

module top_module ( input [1:0] A, input [1:0] B, output z ); 
    
    always@(*) 
        begin
            if (A==B) 
                z = 1’b1;
            else
                z = 1’b0;
        end
            
 
endmodule

 

Reference: https://hdlbits.01xz.net/wiki/Mt2015_eq2

Leave a Reply

Your email address will not be published. Required fields are marked *