RE: [sv-ac] question about classes as local variables in properties and sequences

From: Eduard Cerny <Eduard.Cerny_at_.....>
Date: Tue Jul 11 2006 - 12:02:26 PDT
Hi Manisha,
 
my understanding woudl be that local variables can be only of the same
type as those that can be sampled in the boolean expressions. That is,
no class types. I suppose that we could extend it, so that a call to new
is implicit anytime an instance is to be created, like for the integral
types of local variables. That to me seems quite feasible. Is it needed?
The question is, what if a task in the property copies the handle to
some other global variable. Normally, the instance of a variable created
in a property thread disappears when the thread dies. Should the
instance be preserved in this case? Or would it allow only a deep copy
to a global variable of that class type?  Etc...
 
Best regards,
ed


________________________________

	From: owner-sv-ac@eda-stds.org [mailto:owner-sv-ac@eda-stds.org]
On Behalf Of Kulshrestha, Manisha
	Sent: Tuesday, July 11, 2006 2:41 PM
	To: sv-ac@eda-stds.org
	Subject: [sv-ac] question about classes as local variables in
properties and sequences
	
	
	Hi All,
	 
	I have few questions regarding usage of classes in assertions:
	 
	1. Currently LRM does not allow the boolean expressions in
assertions to have class as per section 17.4.1. But there is no
restriction on having a local variable as a class. So, is it allowed to
have a local variable of type class in the assertion expression ? 
	 
	2. Currently section 17.4.1 lists all the types which are not
allowed to be in the boolean expressions. What are the main reasons for
this restriction ? Is it mainly driven by sampling issues or there are
other issues ?
	 
	3. Consider the following example with a local variable of type
class (called myClass. myClass has a data member called myData):
	 
	sequence S;
	  myClass lv;
	 
	(a, lv = new()) ##1 ((seq1, lv.myData = 0) or (seq2, lv.myData =
1)) ##1 (d, $display("value of myData is %b", lv.myData));
	 
	endsequence
	 
	As per LRM section 17.8, each branch of 'or' should have its own
copy of lv and assign to it. But here, there is only one 'new' on lv so
both the branches of 'or' will refer to the same local variable (because
lv behaves like a pointer).
	 
	Currently LRM does not clarify how copies of the variables
should be created in case of branching for classes and other objects
which behave like pointers. 
	 
	Any inputs ?
	 
	Thanks.
	Manisha
	 
Received on Tue Jul 11 12:02:35 2006

This archive was generated by hypermail 2.1.8 : Tue Jul 11 2006 - 12:02:39 PDT