[sv-ac] local vars as actual arguments

From: Doron Bustan <dbustan_at_.....>
Date: Tue Oct 17 2006 - 05:21:25 PDT
Hi,


last meeting I took an action item to review passing local variables
as actual arguments to sequences, who in their turn are passed as
actual arguments to other sequences.

It looks that as long as all local variables in the different
sequences have different names, an approach based on substitution
will work.

However, it is not clear that substitution is consistent with
the way local variables are being considered as actual arguments. The
LRM does not make it clear whether local variable are passed by value
or by substitution. To understand the differences, look at the
following example:

sequence r1(lv1, lv2);
  (1, lv1 = lv1 + 1) ##1
  (1, lv1 = (lv1 > 3) ? lv2+1 : lv2-1);
endsequence

property p1;
logic [7:0] lv;

(1, lv = 1) ##1 r1(lv, lv) ##1 (lv == 0) ;
endproperty

When we take the substitution approach, we have
that p1 is equivalent to:

property p1;
logic [7:0] lv;

(1, lv = 1) ##1                        // lv = 1
  (1, lv = lv + 1) ##1                 // lv = 2
  (1, lv = (lv > 3) ? lv+1 : lv-1);    // lv = 1
 ##1 (lv == 0) ;                       // p fails
endproperty


When we take the pass by value approach, we have
that p1 is equivalent to:

property p1;
logic [7:0] lv;

(1, lv = 1) ##1                        // lv = 1
  (1, lv = 1 + 1) ##1                  // lv = 2
  (1, lv = (lv > 3) ? 1+1 : 1-1);      // lv = 0
 ##1 (lv == 0) ;                       // p pass
endproperty


At least in sv-ac discussion, we did refer to passing
local variables as actual argument as "pass by value.

I think that we need to discuss the  differences,
and see if it is ok to continue with the substitution.

Doron
Received on Tue Oct 17 05:21:30 2006

This archive was generated by hypermail 2.1.8 : Tue Oct 17 2006 - 05:21:50 PDT