I believe it's legal (and should be legal) to use $typeof() in a cast. For example, the BNF allows one to say $typeof(v)'(a+b) instead of localparam type P = $typeof(v); P'(a+b) Why wouldn't it be semantically legal, too? Also, is a structure member, s.mem, considered a hierarchical reference here, and disallowed in $typeof()? I don't think it should be. Can't we find a term that means exactly XMR, and doesn't mean also struct accesss, generated names, etc.? Finally, the BNF currently seems to disallow referring to the member of a struct type. It should be legal to say $typeof(T::mem)'(a+b) for a struct type just as one would with a classes, instead of forcing circumlocutions like var T dummy; localparam type P = $typeof(dummy.mem); P'(a+b) -- Brad -----Original Message----- From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org]On Behalf Of Brad Pierce Sent: Wednesday, April 13, 2005 2:51 PM To: sv-bc@eda.org Subject: [sv-bc] Where can $typeof() be used? Issues 224 and 277) An important remaining ballot issue (224 and 277) is to clarify where $typeof() can be used. The Mantis issue is 619 http://www.eda.org/svdb/bug_view_page.php?bug_id=619 Here's its text description, and attached are the two partial proposals from the spreadsheet -- As reported in P1800 ballot item 277, section 24.2 is unclear on where $typeof() can be used. I think you should be able to use it anywhere. And, according to the LRM "In all contexts, $typeof together with its argument can be used in any place an elaboration constant is required." (It's not clear from this that it can be used at run-time.) Yet I've heard it said that the LRM "calls out" the specific places where $typeof can be used, namely, "The $typeof system function returns a type derived from its argument. The data type returned by the $typeof system function may be used to assign or override a type parameter, or in a comparison with another $typeof, evaluated during elaboration." (Again, not clear if it can be used at run-time.) I think that sentence should be read as "For example, the data type returned ...", not as an exhaustive list. Otherwise, the two quoted sentences are inconsistent. And interpreting that sentence as exhaustive leads to unnatural restrictions, too. As reported in P1800 ballot item 224, a $typeof should be useable anywhere a datatype is useable. $typeof is currently limited to the following places: to assign or override a type parameter, or in a comparison with another $typeof, evaluated during elaboration. As a result, today you can only use $typeof by copying its value into a parameter type such as: parameter type out_type = $typeof(out); and then you can do things like out = out_type'( out_packed ); Examples of requested capability: out = $typeof(foo)’(out_packed) and typedef $typeof(foo) my_type Additional example, today we are forced to do: parameter type foo = $typeof(bar); foo barbar; assign barbar = bar; This is inconvenient. Why not simply allow: $typeof(bar) barbar;Received on Wed Apr 13 15:16:28 2005
This archive was generated by hypermail 2.1.8 : Wed Apr 13 2005 - 15:17:33 PDT