表达式宽度 32 与逻辑门阵列端口 1 的宽度 1 不匹配

Expression width 32 does not match width 1 of logic gate array port 1

我有两个问题。

  1. 无输出
  2. 表达式宽度 32 与逻辑门阵列端口 1 的宽度 1 不匹配。

当我写and( OutAnd, a, b);时,它显示错误。

Expression width 32 does not match width 1 of logic gate array port 1.

我该如何解决?

顺便说一句。我禁止使用 & 运算符,过程分配,并且始终阻塞。

这是我的代码:

ALU.v

module ALU( 
  input [5:0] Signal, 
  input [31:0] a, b,
  output reg[31:0] Output
  );
  
  wire[31:0] OutAnd;
  
  and( OutAnd, a, b); // AND  <-- error
  AluMux alumax0( .Signal(Signal), .in_And( OutAnd ) ); // AND
endmodule

AluMax.v

module AluMux(
  input [5:0] Signal,
  input [31:0] in_And, in_Or,
  output reg[31:0] Output
  );
  
  parameter AND = 6'd36;
  
  always @ ( * )
  begin
    case ( Signal )
        AND : Output = in_And;
         default : Output = 32'd11;
    endcase
  end
endmodule

and 门的输出定义为 1 位,而您想在其中放入 32 位,这可能会导致错误或警告来解决此问题,您有 2 种方法可以实例化 32 和门以下语法

and u1 (OutAnd[0], a[0], b[0]);
and u1 (OutAnd[1], a[1], b[1]);
and u1 (OutAnd[2], a[2], b[2]);
.
.
.
and u1 (OutAnd[31], a[31], b[31]);

或使用生成语句这里是示例代码

genvar i;

generate 

for(i = 0;i < 32;i = i + 1) begin 

and u1(OutAnd[i], a[i], b[i]);


end

endgenerate