I know that static functions are an issue. There is already a manitis 1527 for that. > -----Original Message----- > From: Rich, Dave [mailto:Dave_Rich@mentor.com] > Sent: Wednesday, November 07, 2007 3:45 PM > To: Mark Hartoog; sv-ec@eda.org > Subject: RE: [sv-ec] Access to class parameters in constant > expressions and self class specialization > > BTW, I would add static functions to this query for what is > legal in a constant expression. > > I would certainly disallow the "." operator as introduces > binding issues as well as using a syntax which indicates a > dynamic handle de-reference. > I think you could deduce the LRM implies that this is > illegal, even though it may not explicitly state that it is illegal. > > Dave > > > > > -----Original Message----- > > From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] > On > > Behalf Of Mark Hartoog > > Sent: Wednesday, November 07, 2007 3:03 PM > > To: sv-ec@server.eda.org > > Subject: [sv-ec] Access to class parameters in constant expressions > and > > self class specialization > > > > Two somewhat related issues with parameterized classes: > > > > 1) Can class parameter values be accessed from outside the class > > through the "::" or "." operators in constant expressions? > > > > I looked in the LRM for info on this, but could not really find > > anything. > > > > module foo; > > parameter p0 = 1; > > > > class B #(PB = 1); > > localparam QB = PB + 2; > > endclass > > > > class C #(P = 1); > > localparam Q = P + 1; > > static bit [P:0] sx; > > bit [P:0] x; > > static B #(Q) sy; > > B #(Q) y; > > endclass > > > > C #(p0) v; > > > > // Which, if any, of these parameter expression do people think are > > legal // constant expressions? > > parameter p1 = C#(p0)::Q; > > parameter p2 = v.Q; > > parameter p3 = $bits(C#(p0)::sx); > > parameter p4 = $bits(v.sx); > > parameter p5 = $bits(v.x); > > parameter p6 = v.y.QB; > > parameter p7 = v.sy.QB; > > endmodule > > > > > > 2) What are the rules for a class containing specializations of > itself? > > > > Clearly some types of self reference will cause the generation of > > infinite specializations, but what about: > > > > class D #(P = 10); > > D #(P >1 ? P-1 : 1) x; > > endclass > > > > This causes a recursion, but it is a finite recursion that > will always > > terminate. > > Is this legal? > > > > Combining these two, one could write: > > > > class E #(P = 10); > > E #(P >1 ? P-1 : 1) x; > > localparam QE = x.QE; > > endclass > > > > E#(E#(20)::QE) x; > > > > > > > > -- > > This message has been scanned for viruses and dangerous content by > > MailScanner, and is believed to be clean. > > > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Nov 8 12:02:05 2007
This archive was generated by hypermail 2.1.8 : Thu Nov 08 2007 - 12:02:12 PST