SV: Forward typedef for parameterized class

A

Amal

Guest
How can you declare (typedef) a parameterized class before it is
defined?

The following example is hypothetical and just shows the concept. I
need to declare a parameterized class before it is defined.

typedef class #(type T=int) B;

class #(type T=int) A;
B #(T) parent;
endclass : A

class #(type T=int) B;
A #(T) child
endclass : B

Cheers,
-- Amal
 
Hi

You need not specify parameters in typedef declaration. The following
code works as yhou expected.
-------
typedef class B;

class A #(type T=int);
B #(T) parent;
endclass:A

class B #(type T=int);
A #(T) child;
endclass:B
--------

Thanks & Regards,
Karthik



On Mar 24, 7:21 pm, Amal <akhailt...@gmail.com> wrote:
How can you declare (typedef) a parameterized class before it is
defined?

The following example is hypothetical and just shows the concept.  I
need to declare a parameterized class before it is defined.

typedef class #(type T=int) B;

class #(type T=int) A;
  B #(T) parent;
endclass : A

class #(type T=int) B;
  A #(T) child
endclass : B

Cheers,
-- Amal
 
On Mar 25, 12:26 pm, karthik <karthikeyan.i...@gmail.com> wrote:
Hi

You need not specify parameters in typedef declaration. The following
code works as yhou expected.
-------
typedef class B;

class A #(type T=int);
  B #(T) parent;
endclass:A

class B #(type T=int);
  A #(T) child;
endclass:B
--------

Thanks & Regards,
Karthik

On Mar 24, 7:21 pm, Amal <akhailt...@gmail.com> wrote:

How can you declare (typedef) a parameterized class before it is
defined?

The following example is hypothetical and just shows the concept.  I
need to declare a parameterized class before it is defined.

typedef class #(type T=int) B;

class #(type T=int) A;
  B #(T) parent;
endclass : A

class #(type T=int) B;
  A #(T) child
endclass : B

Cheers,
-- Amal
Not really. I get the following error in Questa when I do that:

# ** Error: src/???.sv(1): Forward typedef for parameterized class 'B'
not allowed

-- Amal
 
It worked fine in VCS (2008.12).

Please try it on latest VCS.

--Karthik
 

Welcome to EDABoard.com

Sponsor

Back
Top