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

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Thu Jan 26 2006 - 01:10:05 PST
Dave,

 

I am not succeeding in reading the file you attached to Mantis 1315. Does anyone else have the same problem? I've been having other problems with Mantis also, which David Smith has not succeeded in understanding.

 

Since I can't read it, I'll just add the following comments:

 

-         The text in 5.9.6 should be revised to account for the case of a user-defined default. It is not good that the specification is split between 5.9.6 and 5.13. 

-         The text at the end of 5.9.6 should be moved or split into a separate sub-clause. It is not relevant specifically only to the subject of 5.9.6, "Usinged packed array or packed struct".

 

Shalom

 

________________________________

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

 

Françoise,

 

Think of an associative array as having an extra default-keyed element that is written by the default value in an assignment pattern and is returned whenever there is a read of a non-existent indexed element. This allows you to initialize an associative array without having to populate the entire array. Very useful for modeling sparse memories. 

 

This is exactly what the last sentence in 5.13 defines. I was just adding the fact that a warning message should not be generated. It doesn't make sense to specify something you never intend to obtain.

 

Dave

 

 

________________________________

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

 

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 Thu Jan 26 01:10:47 2006

This archive was generated by hypermail 2.1.8 : Thu Jan 26 2006 - 01:12:06 PST