RE: [sv-ec] Reading a non-existent associative array element when a user specifies a default value

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Wed Jan 25 2006 - 14:19:07 PST
Dave,

 

I understand now.

I agree with your observation: associative arrays are indeed different
from other arrays in that the entire array is not populated with the
default value; A default value merely changes the default return value.
I think we have some wordsmithing to do :-).

 

            Arturo

 

________________________________

From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: Wednesday, January 25, 2006 1:54 PM
To: Arturo Salz; sv-ec@eda.org
Subject: RE: [sv-ec] Reading a non-existent associative array element
when a user specifies a default value

 

Arturo,

 

I think you meant 8.13.1 

 

What I am trying to say is that declaring a default value does not mean
that all non-existent elements come into existence. It just means that
the default value returned for a non-existent element will be changed.
So the result of AA.size(), AA.first() ... will not change by setting a
default value.

 

For example,

 

If I have

 

int A[*] ={default:4};

 

 

initial begin

            A[4] =1;

            A[2] = A[0]; //A[2] = 4 and now warning issued

            $display(A.exists(0)); // is still false because it has
never been written to,

            end

 

 

 

-Dave

 

 

 

________________________________

From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] 
Sent: Wednesday, January 25, 2006 1:25 PM
To: Rich, Dave; sv-ec@eda.org
Subject: RE: [sv-ec] Reading a non-existent associative array element
when a user specifies a default value

 

Dave,

 

Your statement "...default should not change the operation on the
associative array", implies

that the compiler does not check for such conditions. Since this is not
an error, it is simply a 

user guideline, and I believe that is already appropriately covered
insection 18.13.1:

 

If the type key, default key, or replication operator is used on an
expression with side effects, the 

number of times that expression evaluates is undefined.

 

Plus, why should this restriction apply only to associative arrays? 

 

Conversely, I think it would be useful to restrict these default
expressions to constant expressions,

such that the expression is evaluated once only, at the time of the
assignment, and the resulting

value is returned thereafter. That would simplify the implementation and
minimize the uncertainty.

 

            Arturo

 

________________________________

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Rich, Dave
Sent: Wednesday, January 25, 2006 11:16 AM
To: sv-ec@eda.org
Subject: [sv-ec] Reading a non-existent associative array element when a
user specifies a default value

 

should not generate a warning message. Also, a user specified default
should not change the operation on the associative array methods. They
are still non-existent elements.

 

Mantis issue generated

http://www.eda.org/svdb/bug_view_page.php?bug_id=0001315

 

David Rich
Verification Technologist
Design Verification & Test Division
Mentor Graphics Corporation
dave_rich@mentor.com
Office:   408 487-7206
Cell:     510 589-2625

 
Received on Wed Jan 25 14:19:20 2006

This archive was generated by hypermail 2.1.8 : Wed Jan 25 2006 - 14:19:55 PST