Ran the following code on vcs :
module tb;
reg [7:0] stack [2][4] ;
initial begin
foreach (stack[i])
foreach (stack[i][j]) begin
stack[i][j] = $random;
$display("stack[%0d][%0d] = 0x%0h" , i, j, stack[i][j]);
stack[1] = 0 ;
end
$display("stack = %p" , stack) ;
$display("stack[1] = 0x%0h" , stack[1]);
end
endmodule
The console gives the following errors:
Error-[ICTA] Incompatible complex type
design.sv, 15
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 'reg$[0:3]', while the type of the
source is 'int'.
Source Expression: 0
2 errors
Is the assignment stack[1] = 0 ; valid?
while the type of the source is 'int'. I don't really understand this error.