Eu preciso de ajuda.
Estou tentando contar o número de unidades na matriz descompactada.
Abaixo estão os códigos.
module test_rand;
bit [7:0] mask_unpacked [0:7];
int numOnes[0:7];
initial begin
mask_unpacked[0] = 8'b00001111;
mask_unpacked[1] = 8'b00001111;
mask_unpacked[2] = 8'b00000000;
mask_unpacked[3] = 8'b00000000;
mask_unpacked[4] = 8'b00000000;
mask_unpacked[5] = 8'b00000000;
mask_unpacked[6] = 8'b00000000;
mask_unpacked[7] = 8'b00000000;
$display("*********************************");
foreach (mask_unpacked[i]) begin
$display("mask_unpacked = %p",mask_unpacked[i]);
numOnes= $countones(mask_unpacked[i]);
$display("countones = %p", numOnes[i]);
end
$display("*********************************");
end
endmodule
Mas recebi uma mensagem de erro
Error-[ICTA] Incompatible complex type
testbench.sv, 16
Incompatible complex type assignment
Type of source expression is incompatible with type of target expression.
Mismatching types cannot be used in assignments, initializations and
instantiations. The type of the target is 'int$[0:7]', while the type of the
source is 'int'.
Source Expression: $countones(mask_unpacked[i])
Como resolver isso?