ASSOCIATIVE ARRAY

is there any system task to get the key of an associative array ?
why dont we consider using wildcard indexes?
is there any way to copy the contents from an wildcard indexed associative array to a string based array?
why cant we use first(),next,and other methods for an wildcard indexed associative array?

In reply to sreelaxmi:
Let me answer your questions from bottom to top.

The problem with the wildcard index is there is no type associated with the index, so you can’t define a return type for any method that would return an index value, nor can you define an iterator variable that would be used in a foreach loop.

So you can’t write code that would iterate over a wildcard indexed array and copy each element to another associative array (You can only copy whole associative arrays without iterating if the source and destination index types match).

The wildcard index type came from the Vera language where that was the only choice for an index type. It treated the index as if it were a string of bytes. This works fine for accessing individual array elements for reading and writing. But if you ever needed to iterate of the elements of an associative array, it just assumed the index was value was 64-bits and would truncate the value if the index was larger than that.

There is no need for this concept in SystemVerilog as you can choose any type for an index.

If you want to get all the keys of an associative array, you can use the find_index() method to return a queue of keys. (and a queue requires that all elements be the same type)