Hi Bassam, before we get into that discussion, note that with the current semantics you can instantiate two instances of the same sequence in the same scope. For example sequence r2; logic [7:0] lv1; (b, lv1 = c) ##1 r1(lv1) ##1 r1(lv1) ##1 (lv1 == d); endsequence Thus you cannot use the sequence declared name as an identifier. r1.lv1 is ambiguous in this example. Doron Bassam Tabbara wrote: >Hi Doron, > >May be use r1_lv1 instead of unique below ... (r1.lv1 might be >misleading scope/namespace creation issues) to be r1's lv1: > >sequence r2; > >logic [7:0] lv1; >logic [7:0] unique_lv1; > >(b, lv1 = c) ##1 >(a, r1_lv1 = 0) ##1 (!a, r1_lv1 = r1_lv1 +lv1)[*0:$] ##1 a ##0 (1, lv1 = >r1_lv1) >##1 (lv1 == d); >endsequence > >The adjacent idea (I mentioned on call yesterday) is to *add* (we still >need to explain above for backward compatibility) visibility notions, >instead of just explaining how substitution/passing should work, similar >to classes with a "local"/"public" (default) access to r1's lv1, or >simply just add scoping (drop the local bit :)) so you can say to begin >with: > >sequence r2; >//logic [7:0] lv1; // no need ... > >(b) ##1 >r1 (c) // "c" just an input not inout >##1 (r1.lv1 == d); >endsequence > >This would have same "substitution" semantics but clearer, avoids >shadowing issues, cleaner, easier to write ... BTW, I am not too keen on >adding things, we have to clarify/interpret current LRM anyway, so food >for thought in case we encounter more severe issues in this area. > >Thx. >-Bassam. > >-----Original Message----- >From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of >Doron Bustan >Sent: Wednesday, November 15, 2006 8:55 AM >To: sv-ac@eda.org >Subject: [sv-ac] 1678 > >I open a new bug - 1678 for local variables name clashes: > >------------------------------------------------------------- > >A naive interpretation of substitution may lead to local variables name >clashing. > >Here is an example of name clashing. > >sequence r1(lv); >logic [7:0] lv1; > >(a, lv1 = 0) ##1 (!a, lv1 = lv1 +lv)[*0:$] ##1 a ##0 (1, lv = lv1); >endsequence > > > >sequence r2; > >logic [7:0] lv1; > >(b, lv1 = c) ##1 >r1(lv1) >##1 (lv1 == d); >endsequence > > > >A naive substitution will result in the following: > >sequence r2; > >logic [7:0] lv1; >logic [7:0] lv1; > >(b, lv1 = c) ##1 >(a, lv1 = 0) ##1 (!a, lv1 = lv1 +lv1)[*0:$] ##1 a ##0 (1, lv1 = lv1) >##1 (lv1 == d); >endsequence > > >what we really want is to rename lv1 in r1 to a unique name before the >substitution occurs. Then we get > >sequence r2; > >logic [7:0] lv1; >logic [7:0] unique_lv1; > >(b, lv1 = c) ##1 >(a, unique_lv1 = 0) ##1 (!a, unique_lv1 = unique_lv1 +lv1)[*0:$] ##1 a >##0 (1, lv1 = unique_lv1) >##1 (lv1 == d); >endsequence > > > >Received on Wed Nov 15 12:08:26 2006
This archive was generated by hypermail 2.1.8 : Wed Nov 15 2006 - 12:08:41 PST