免费获取学习方案
ARTICLE DETAIL

资讯详情

深耕编程基础知识与建站技术分享的一线实战洞察。

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

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、结果
返回列表