Sou bastante novo no Verilog e estou tentando me familiarizar com ele. Estou construindo uma ALU em Verilog e quando tento atribuir o valor de uma operação ao ALU_result
reg
, recebo o erro listado acima no título.
parameter N = 8;
input [N-1:0] inA, inB;
input [3:0] op;
reg ALU_result[N-1:0] ;
always @(*)
case(op)
4'b0000:
begin
ALU_result = inA & inB ;
end
4'b0001:
begin
ALU_result = inA | inB ;
end
4'b0010:
begin
ALU_result = inA + inB ;
end
endcase
O erro que recebo mais especificamente. Compilei o código Verilog com icarus verilog.
library.v:39: error: Cannot assign to array ALU_result. Did you forget a word index?
library.v:43: error: Cannot assign to array ALU_result. Did you forget a word index?
library.v:47: error: Cannot assign to array ALU_result. Did you forget a word index?
Você declarou
ALU_result
como um array descompactado, mas não há necessidade de fazer isso.Mudar:
para: