|
持续赋值方式定义的2 选1 多路选择器 module MUX21_1(out,a,b,sel); input a,b,sel; output out; assign out=(sel==0)?a:b; //持续赋值,如果sel 为0,则out=a ;否则out=b endmodule 阻塞赋值方式定义的2 选1 多路选择器 module MUX21_2(out,a,b,sel); input a,b,sel; output out; reg out; always@(a or b or sel) begin if(sel==0) out=a; //阻塞赋值 else out=b; end endmodule
|
|