Re: [sv-bc] type parameters questions

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Tue Oct 17 2006 - 21:36:35 PDT
Francoise Martinolle wrote:

> Is it legal to assign a interface datatype redefined locally to a type 
> parameter?


Yes.

There is a bit of an issue in terms of how interfaces work
in terms of types and structural cross-module circularities.

I think that we need to do some work to tighten this up
a bit.


> interface intf_i;
> typedef int data_t;
> endinterface
> 
> module sub(intf_i p)
> typedef p.data_t my_data_t;
> parameter type T = my_data_t;
> my_data_t data;
> 
> // type of 'data' will be int when connected to interface above
> 
> endmodule

Yes.

The problem becomes if you have something like:

    typedef T;
    some_interface #(T) intf();
    typedef intf.T intf_type;
    typedef struct { intf_type x; } T;

So T and intf_type can be circular and/or have some
very odd relationships.

Allowing a module to pull out a type from an
interface is reasonable.  Parameterizing an interface
with a module type is reasonable.  Having the two
interact is not as far as I am concerned.

In the same manner as package/compilation unit types,
I think that there needs to be some "complete type"
requirement when providing a type parameter to an
interface.  That would avoid the structural aspects
of the problem and would be more sensible in any case.


> I assume that we can also do:
> 
> parameter type T = type (data);

Yes.

> 
> But can you also have an XMR (out of module reference as the expression 
> of the type operator?

No.  6.10 is clear that hierarchical references are not
permitted in the type operator.

This limits the problems of hierarchical type references
to those caused by pulling types from interfaces.  Minor
restrictions in this space would likely serve us well.

Gord.
-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Tue Oct 17 21:36:43 2006

This archive was generated by hypermail 2.1.8 : Tue Oct 17 2006 - 21:36:50 PDT