In reply to sfenil1804:
Yes, but I’m sure you forgot that uniq_yes,uniq_no are static variables that don’t get reset to 0 each time the function gets called. But you don’t need these variables. You could have written
function bit uniq (ref addr);
foreach (addr[i,j])
foreach (addr[a,b])
if !(i!=a && j!=b)
if (addr[i,j] == addr[a,b])
return 0;
// can only get here if addr is unique
return 1;
endfunction