RegisterLogin  
Update Profile
   
You are here: Forum  
Minimize 
SVUG Community Forum
Subject: Multidimensional associative arrays
Prev Next
You are not authorized to post a reply.

Author Messages
MANUELUser is Offline

Posts:1

05/06/2008 2:38 AM  
Hi everyone!

As I have tested you can make multidimensional associative arrays.
For example:
logic Ε:0] mem [integer][integer]

But how do I call the exists() function for such an array?
The syntax is:
function int exists (input index);

Does anyone have an idea?
SHALOMUser is Offline

Posts:43

05/06/2008 2:46 AM  
The LRM has this example:

The syntax for the exists() method is as follows:

function int exists( input index );

where index is an index of the appropriate type for the array in question.

The exists() function checks whether an element exists at the specified index within the given array. It returns 1 if the element exists; otherwise, it returns 0.

if ( map.exists( "hello" ))
map[ "hello" ] += 1;
else
map[ "hello" ] = 0;
DAVEUser is Offline

Posts:56

05/06/2008 6:29 PM  
There is really no such thing as a multi-dimensional array; there are single-dimensional arrays whose elements can also be arrays. You will have to call the exists method once for each array dimension.
You are not authorized to post a reply.
Forums > General Discussion > Main Discussion Area > Multidimensional associative arrays



ActiveForums 3.7
  

 Copyright 2008 by SystemVerilog User Group Contact Us    Privacy Statement