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

From: francoise martinolle <fm_at_.....>
Date: Wed Jan 25 2006 - 20:09:30 PST
I do not agree with what we specify for default values (section 5.13). It is
not logical or intuitive.
I would have expected the following:
 
int A[*] = {default:4};
This variable declaration does not do anything since no array element exists
at the time of the declaration. So since
it does not do anything, how can we remember that the value of non existing
element be 4?
 
I would not expect that the default value of A[2] in the initial block would
be 4.
However if there had been a default pattern assignment in the initial block,
I would expect that array element values which
exist would then have the value of 4.
 
initial begin
   A[4] = 1;
   A[2] = A[0];
   A = {default:4};
end
 
After the initial block had been executed, I only expect A[4] = 4;
A[0] does not exist. A[2] has been written to with a non existent array
element, so I do not expect it to have a value.
Trying to access a non existing element of an array should return x.
 
Francoise
       '


  _____  

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Rich,
Dave
Sent: Wednesday, January 25, 2006 4: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 20:10:07 2006

This archive was generated by hypermail 2.1.8 : Wed Jan 25 2006 - 20:11:56 PST