RE: [sv-ec] forward typedefs

From: Mark Hartoog <Mark.Hartoog_at_.....>
Date: Thu Nov 20 2008 - 21:52:51 PST
I agree with Gord that your original case should be legal. I also think
you can use parameter pass by value and default parameter values. 

For the case raised by Gord:

    typedef class c;
    typedef c d;
    c c_0; // should be legal
    d c_1; // Should be legal
    c #(9) c_2; // should be legal
    d #(7) c_3; // should be illegal
    class c #(parameter p = 0); endclass

You can use a forward typedef to define a new type, but the type 'd' is
the class 'c' with default parameter values. You cannot override those
parameter values when you use 'd'.


-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Francoise Martinolle
Sent: Thursday, November 20, 2008 6:48 PM
To: Gordon Vreugdenhil
Cc: sv-ec@eda.org
Subject: RE: [sv-ec] forward typedefs


 

If we assume it is legal to do this, can we only use positional
association for the parameter values?

typedef class c;
 
 typedef c#(1,1) c_1_1;                
 typedef c#(.q (1), .p(2)) c_2_1;      // is this legal
 typedef c#(,1) c_0_1;                 // can you use default values
  
 class c #(parameter p = 0, q = 0);
 endclass
-----Original Message-----
From: Gordon Vreugdenhil [mailto:gordonv@model.com] 
Sent: Thursday, November 20, 2008 7:39 PM
To: Francoise Martinolle
Cc: sv-ec@eda.org
Subject: Re: [sv-ec] forward typedefs


This was discussed at some point though I don't recall if it was through
the reflector buried in the wider discussion or just in a meeting.  It
certainly wasn't specified in the LRM.

My recollection was that Mark and I agreed that it would be legal to
have a forward specialization as in your example.
I think that there was some disagreement as to whether the implicit
default specialization using just the name should be allowed.  Example:

    typedef class c;
    typedef c d;
    class c #(parameter p = 0); endclass

I was somewhat opposed to considering this as legal although it is more
symmetric to allow it.  My argument against is mostly one of readability
in terms of intent for a forward type "c#()" used as a forward is more
obvious as to intent.

Gord.


Francoise Martinolle wrote:
> Can you create a class specialization of a class for which we only 
> have a forward typedefs?
>  
> Is this allowed?
>  
>  
> typedef class c;
>  
> typedef c#(1) c_1;
>  
> class c #(parameter p = 0);
> endclass
>  
> In mantis 2211, we discussed the usage of :: for incomplete typedefs 
> and we speicifed the
>  
> following text:
>  
> 
> A forward typedef shall be considered incomplete prior to the final 
> type definition. While incomplete forward
> 
> types, type parameters, and types defined by an interface based 
> typedef may resolve to class types, use
> 
> of the class scope resolution operator (see 8.22) to select a type 
> with such a prefix shall be restricted to a
> 
> typedef declaration. It shall be an error if the prefix does not 
> resolve to a class.
> 
> Example:
> 
> * *
> 
> *typedef *C;
> 
> C::T x; // illegal; C is an incomplete forward type
> 
> typedef C::T c_t; // legal; reference to C::T is made by a typedef
> 
> c_t y;
> 
> * *
> 
> *class *C;
> 
> * *
> 
> *typedef *int T;
> 
> * *
> 
> *endclass*
> 
> 
> --
> This message has been scanned for viruses and dangerous content by 
> *MailScanner* <http://www.mailscanner.info/>, and is believed to be 
> clean.

--
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
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 20 21:53:30 2008

This archive was generated by hypermail 2.1.8 : Thu Nov 20 2008 - 21:54:08 PST