Hi,
In my verif env I am trying something as follows(I can’t share code so wrote this dummy code)
module test3;
int q[$]={32'h1,32'h2,32'h4,32'h8,32'h10000000,32'h20000000,32'h40000000,32'h80000000};
initial begin
q.sort();
foreach(q[i])
$display("data=%h",q[i]);
end
endmodule
As per my understanding sort function should arrange variables of queue in ascending order. But this is what the output is:
data=80000000
data=00000001
data=00000002
data=00000004
data=00000008
data=10000000
data=20000000
data=40000000
So I see that q[0] is always 80000000 while I expect it to be at q[7] here. Please let me know why?