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

From: Bassam Tabbara <Bassam.Tabbara_at_.....>
Date: Tue Jul 11 2006 - 12:33:22 PDT
Hi Manisha,
 
I agree with what Ed says below, I think the key issue, as discussed in
the section you cite, is really about operations in expressions, so for
class instances (note: I bypassed the "new" here and assumed that
instance is created (best if implicitly) not just a handle ...)  in
general (not built-in) those are not known apriori. Still there is
nothing fundamental here this can be extended even for non-builtin
classes  with the restriction that class operands return a Boolean (and
no side-effect) -- they are indeed function calls.
 
Note though that in your example you really use the class property
myData (of a pre-defined type) not the class instance itself in the
operation ... begging the question whether carrying the type around with
all its fields is worthwhile. Since we already today can sample class
fields, and can declare a local var (of non-class type since it will
operated on, at the very least assigned which is an operation ... ) can
be static too with Ed's 1531 ...., you can always copy this back to the
class instance property.
 
So again classes would be nothing more than an elaborate type where all
the operations -- including local var
creation/duplication/update/destroy will need to be defined, the
policy/use model/restrictions in LRM, and the actual routines themselves
by user for this type.
  
 
Thx.
-Bassam.
 

________________________________

From: owner-sv-ac@eda-stds.org [mailto:owner-sv-ac@eda-stds.org] On
Behalf Of Eduard Cerny
Sent: Tuesday, July 11, 2006 12:02 PM
To: Kulshrestha, Manisha; sv-ac@eda-stds.org
Subject: RE: [sv-ac] question about classes as local variables in
properties and sequences


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:33:34 2006

This archive was generated by hypermail 2.1.8 : Tue Jul 11 2006 - 12:33:40 PDT