0

我想为 2*1 多路复用器构建一个小代码,其中输入来自不同的模块(使其更实用),但我总是得到高阻抗('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
4

1 回答 1

0

问题是dut1每个模块中的实例都是与其他模块不同的实例。换句话说,每个ip1ip2test都有自己的dut1复用器。您需要使用输入/输出线并将它们全部链接到单个mux_using_assign声明。

于 2015-05-09T13:43:40.323 回答