拓冰建站拓冰建站
首页 / 资讯中心 / 正文

verilog HDLBits刷题[Finding bugs in code]“Bugs nand3”---NAND

1、题目This three-input NAND gate doesnt 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 );2、分析1、题目中提供了一个5输入的与门模块2、而题目要求我们修复一个3输入的与非门所以我们先设计3输入的与门再取非便可3、在与门中子模块有5个输入而顶层模块有3个输入多出来的两个可以设置为1’b11与任何数相与都等于任何数4、有两种例化方式其一是按位置例化所以需要看子模块各端口排放顺序来其二是按名称例化3、代码//按位置例化 module top_module (input a, input b, input c, output out);// wire out1; assign out~out1; andgate inst1 ( out1,a, b, c, 1b1, 1b1 ); endmodule 或者 //按名称例化 module top_module (input a, input b, input c, output out);// wire out1; assign out~out1; andgate inst1 ( .a(a), .b(b), .c(c), .d(1b1), .e(1b1) ,.out(out1)); endmodule4、结果
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门