RE: [sv-ec] class related questions

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Thu Jul 10 2008 - 01:04:27 PDT
I think the BNF allows it for type parameters, but not for value
parameters.
 
A value parameter assignment reduces to
constant_primary ::=

primary_literal

| ps_parameter_identifier constant_select

| specparam_identifier [ [ constant_range_expression ] ]

| genvar_identifier31

| [ package_scope | class_scope ] enum_identifier

| constant_concatenation [ [ constant_range_expression ] ]

| constant_multiple_concatenation [ [ constant_range_expression ] ]

| constant_function_call

| ( constant_mintypmax_expression )

| constant_cast

| constant_assignment_pattern_expression

| type_reference28

whereas a parameter type assignment reduces to simply

type_assignment ::=

type_identifier [ = data_type ]41

Shalom
 
 
 


________________________________

	From: owner-sv-ec@server.eda.org
[mailto:owner-sv-ec@server.eda.org] On Behalf Of Mark Hartoog
	Sent: Thursday, July 10, 2008 2:45 AM
	To: Rich, Dave; Francoise Martinolle; sv-ec@server.eda.org
	Subject: RE: [sv-ec] class related questions
	
	

	module top;

	class C #(parameter q = 0, parameter type T = byte);

	endclass

	 

	parameter p = C::q;

	parameter type R = C::T;

	 

	According to 8.24.1 this is illegal. You cannot use the
unadorned name of a parameterized with the scope resolution operator
outside of the class or its out of block method declarations. This would
be legal if you used C#()::q and C#()::T.

	 

	From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf
Of Rich, Dave
	Sent: Wednesday, July 09, 2008 2:21 PM
	To: Francoise Martinolle; sv-ec@eda.org
	Subject: RE: [sv-ec] class related questions

	 

________________________________

	From: owner-sv-ec@server.eda.org
[mailto:owner-sv-ec@server.eda.org] On Behalf Of Francoise Martinolle
	Sent: Wednesday, July 09, 2008 1:29 PM
	To: sv-ec@server.eda.org
	Subject: [sv-ec] class related questions

	 

	Question 1:

	Can you use the "dot" to refer to a type declared inside a
class?

	module top;

	class C;

	  typedef bit T[4];

	endclass

	C c = new;

	   bit b;

	   initial

	      b = c.T'{0, 1, 0, 1};

	endmodule

	 

	The bnf for assignment pattern type does not allow the above,
neither

	does it allow C::T'{0, 1, 0, 1}

	 

	I also remember that we decided that hierarchical identifiers to
types are not legal, but does c.T qualifies

	as a hierarchical identifier? or is it just what we called a
dotted name?

	[DR] You can not use a dotted name as a type. The only exception
is with an interface port. And had introduced the scope operator '::' at
the time, we should have used that instead of allowing '.'.

	 

	I think C::T should be allowed as we have used it resolve Mantis
1857. It might be an oversight in the BNF.

	 

	 

	Question 2:

	 

	Can a parameter initial expression be a class scoped identifier?

	The LRM currently only allows package references. I assume this
is not legal:

	 

	module top;

	class C #(parameter q = 0, parameter type T = byte);

	endclass

	 

	parameter p = C::q;

	parameter type R = C::T;

	 

	endmodule

	[DR] Again, I think there is LRM text to support this usage in
terms of parameters that are nested in classes, but no BNF. For example
T::p refers to the parameter up in the class hierarchy.

	 

	class C #(parameter p = 0) extends T;

	parameter q = T::p;

	endclass

	 

	Another example, T::p refers to a parameter within the class

	class C #(parameter type T = int);

	parameter q = T::p;

	endclass

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jul 10 01:06:21 2008

This archive was generated by hypermail 2.1.8 : Thu Jul 10 2008 - 01:07:02 PDT