1X2的选通器,choose决定输入信号Sign_in从A或B端口输出,得不到想要的结果!
代码如下:
module Select(En,Choose,Sign_in,Out_A,Out_B);
input En,Choose,Sign_in;
output Out_A,Out_B;
reg Out_A,Out_B;
always @ (posedge En)
if (En==1)
begin
if (Choose==0)
begin
Out_A=Sign_in;
Out_B=0;
end
else
begin
Out_B=0;
Out_B=Sign_in;
end
end
endmodule
module example( Out_A , Out_B , Sign_In , Sel , En );<br>
<br>
output Out_A;<br>
output Out_B;<br>
input Sign_In;<br>
input Sel;<br>
input En;<br>
<br>
assign Out_A = En & Sel & Sign_In;<br>
assign Out_B = En & ~Sel & Sign_In;<br>
<br>
endmodule