In reply to dave_59:
Hi Dave,
Basically I just put everything there into a module
module array_2d_sum;
logic [7:0] m [2][2] = '{ '{5, 10}, '{15, 20} };
int y;
y = m.sum with (item.sum with (item)); // y becomes 50 => 5+10+15+20
initial begin
$display("m is %p", m);
end
endmodule
The compilation error in QuestaSim is Error: vlog-13069, pointing to this line y = m.sum with (item.sum with (item)); near “=”: syntax error, unexpected ‘=’.
The same line has another error message: vlog-13205, Syntax error found in the scope following ‘y’. Is there a missing ‘::’?