我想为2*1 mux构建一个小代码,其中输入来自不同的模块(使其更实用),但我总是以高阻抗('Z')的形式输出。有什么建议吗?
module mux_using_assign(
din_0 , // Mux first input
din_1 , // Mux Second input
sel , // Select input
mux_out // Mux output
);
input din_0, din_1, sel ;
output mux_out;
wire mux_out;
assign mux_out = (sel) ? din_1 : din_0;
endmodule //End Of Module mux
module ip1();
wire a;
mux_using_assign dut1(.din_0(a));
assign a = 1;
endmodule
module ip2();
wire b;
mux_using_assign dut1(.din_1(b));
assign b = 0;
endmodule
module test();
wire sel ; // Select input
wire mux_out;
ip1 aa(); // tried commenting this and following line also
ip2 bb();
mux_using_assign dut1(.sel(sel),.mux_out(mux_out));
assign sel=1;
endmodule发布于 2015-05-09 13:43:40
问题是,每个模块中的dut1实例都是独立于其他模块的实例。换句话说,每个ip1、ip2和test都有自己的dut1 muxer。您将需要使用输入/输出连接,并将它们全部链接到一个mux_using_assign声明中。
https://stackoverflow.com/questions/30140415
复制相似问题