RE: [sv-ec] class related questions

From: Mark Hartoog <Mark.Hartoog_at_.....>
Date: Wed Jul 09 2008 - 16:45:22 PDT
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

 

.

 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 
-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , 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 Wed Jul 9 16:47:45 2008

This archive was generated by hypermail 2.1.8 : Wed Jul 09 2008 - 16:48:34 PDT