HDLBits Solution : Truthtable1

This quiz required me to create the circuit from a truth table. I used logical operators here, as each input is only one bit. My equation for the output was not minimized.

 

Here is my code for this quiz.

module top_module( 
    input x3,
    input x2,
    input x1,  // three inputs
    output f   // one output
);
    
    assign f = ((!x1)&&x2&&(!x3)) || ((!x3)&&x2&&x1) || (x3&&(!x2)&&x1) || (x3&&x2&&x1);
 
endmodule

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

Leave a Reply

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