module test();
int mem[byte];
initial
begin
for (int i=0; i < 258; i++)
begin
mem[i] = i;
$display("index -> %d content -> %d",i,mem[i]);
end
if(mem.exists(0))
$display(" val of 0th location -> %d",mem[0]);
if(mem.exists(256))
$display("val of 256th location -> %d",mem[256]);
else
$display("no entry");
$display("total memory address -> %d",mem.size());
end
endmodule
question is if declaration of mem is :-
int mem [byte] ;
which means width of mem is 32 bit and indexing is byte type so maximum location is 256 . so if indexing start from 0 than last index is 255 than why this snippet executing both “IF CONDITION” ?