Hi Doron, If you mean my suggested r1_lv1 naming for clarification instead of unique you also need unique1, unique2 ... If you mean the using r1.lv1 access idea yes it needs some explaining but not so much the name though, for that you always get the latest r1 instance's lv1 (all instances of r1 have same name, and overwrite each other ...) -- note I did not say you don't need local r2 lvars at all to keep things around, just that example ... -- but rather atomicity/lifetime may not be clear what it means. The arg ("call") form of r1(lv1), is easy, you get value at return (if arg is inout), for the r1.lv1 access form we'd have to explain lifetime of the data of r1 instance's lv1 ... i.e. it sticks around till next call i.e. first instance of r1 (and its data) disappears when another appears (ok alternatively you can think of it same as "passing" really just not showing that local var in context (called r1.lv1 and if you wish passed invisibly :)!) that keeps data (and accessed by next r1.lv1) :)) so we can "break up" the instance ("call") and the access. Again, it's intended to be same semantics, just different notation... But yeah may be you're right ... may be harder to explain (the invisible behind the scenes stuff of r1.lv1). Hopefully this explains the train of thought, I was really thinking of instances (of classes if you will), and the class var is r1 ... Thru which you access the (public) data member lv1. Alternatively you can think of passing a (not visible) lvar called r1.lv1 each time ... Thx. -Bassam. -----Original Message----- From: Doron Bustan [mailto:dbustan@freescale.com] Sent: Wednesday, November 15, 2006 12:08 PM To: Bassam Tabbara Cc: sv-ac@eda.org Subject: Re: [sv-ac] 1678 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:53:36 2006
This archive was generated by hypermail 2.1.8 : Wed Nov 15 2006 - 12:53:48 PST