I'm trying to use the sum method of an array. I stored the return value of the method into an integer inside a function. Why am I getting the output as 48 instead of 560?
program test;
class check2;
logic [7:0] a [3:0] = '{10,20,30,500};
function void dis();
int unsigned ch;
ch = a.sum()+16'd0;
$display(ch);
endfunction
endclass
check2 c;
initial begin
c = new;
c.dis;
end
endprogram