FPGA/HDLBits

Bugs nand3

장영현 2023. 6. 18. 18:50
728x90

Problem Statement

This three-input NAND gate doesn't work. Fix the bug(s).

You must use the provided 5-input AND gate:

module andgate ( output out, input a, input b, input c, input d, input e );
module top_module (output out, input a, input b, input c, input d, input e);//

    wire out_nand;
    
    andgate inst1 ( out_nand, a, b, c, d, e);
    
    assign out = ~out_nand;
    
endmodule

 

 


module top_module (output out, input a, input b, input c, input d, input e);//

    andgate inst1 ( out, a, b, c, d, e);

endmodule

 

out에 출력결과 nand되지않고 and로 연산된 것을 확인할 수 있다.

wire를 통해 비트를 반전시켜주고, 추가되는 d, e는 1'b1로 만들어준다.