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

verilog HDLBits刷题[Finding bugs in code]“Bugs mux2”---Mux

1、题目2、分析sel为1bit位宽数据a和b作为输入都是8bit位宽故out作为输出根据sel选择输出a或者输出b应该也为8bit位宽1 位sel和8位的a进行位运算sel高位补 0 扩展成 8 位相当于sel8‘b0000_00013、改正代码module top_module ( input sel, input [7:0] a, input [7:0] b, output [7:0]out ); assign out sel?a:b; endmodule 或者 module top_module ( input sel, input [7:0] a, input [7:0] b, output [7:0]out ); assign out ({8{sel}} a) | (~{8{sel}} b); endmodule4、结果
分享:

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

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