Hi Doron, You are considering passing by value as lv/* new definition */ = 1/*usage, passed by value*/ + 1 Following your approach the following should be legal: sequence s(int lv); (1, lv = 1); endsequence property p; s(1); endproperty which doesn't look natural. Dmitry -----Original Message----- From: owner-sv-ac@server.eda.org [mailto:owner-sv-ac@server.eda.org] On Behalf Of Doron Bustan Sent: Tuesday, October 17, 2006 4:25 PM Cc: sv-ac@server.eda.org Subject: Re: [sv-ac] local vars as actual arguments Dmitry, I think that my example 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 works like functions in c and other programing languages and has a meaning. Doron Korchemny, Dmitry wrote: >Hi Doron, > >I think that passing local variable by value is problematic. I would >interpret it in your example as: > >property p1; >logic [7:0] lv; > >(1, lv = 1) ##1 > (1, 1 = 1 + 1) ##1 > (1, 1 = (1 > 3) ? 1+1 : 1-1); > ##1 (lv == 0) ; >endproperty > >which is meaningless. > >Thanks, >Dmitry > >-----Original Message----- >From: owner-sv-ac@server.eda.org [mailto:owner-sv-ac@server.eda.org] On >Behalf Of Doron Bustan >Sent: Tuesday, October 17, 2006 2:21 PM >To: sv-ac@server.eda.org >Subject: [sv-ac] local vars as actual arguments > >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 07:36:39 2006
This archive was generated by hypermail 2.1.8 : Tue Oct 17 2006 - 07:36:52 PDT