[sv-bc] FW: [sv-ec] Type parameterisation of derived classes


Subject: [sv-bc] FW: [sv-ec] Type parameterisation of derived classes
From: David W. Smith (david.smith@synopsys.com)
Date: Wed Sep 03 2003 - 11:23:54 PDT


-----Original Message-----
From: David W. Smith [mailto:david.smith@synopsys.com]
Sent: Wednesday, September 03, 2003 11:07 AM
To: 'Jonathan Bromley'; 'sv-ec@eda.org'; 'sv_bc@eda.org'
Subject: RE: [sv-ec] Type parameterisation of derived classes

ERR-7 (www.eda.org/sv-ec/Errata.html) has been open to consider the issue.

Regards
David

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Jonathan
Bromley
Sent: Wednesday, September 03, 2003 3:51 AM
To: sv-ec@eda.org; sv_bc@eda.org
Subject: [sv-ec] Type parameterisation of derived classes

hi,

I sent this to sv-ec a couple of weeks ago and received no reply. This
could be for a bunch of reasons, of course.

However, I still think it's a significant issue so I'm
going to bull on ahead and be a damn nuisance by posting
it again. I've also copied it to sv-bc in case it's more appropriate there.
Thanks for your forbearance.

~~~~~~~~~~~~~~~~ repeated message begins ~~~~~~~~~~~~~~~

I have a query; I'd be grateful for clarification.

SV3.1 classes can be parameterized for type:

  class C #(parameter type T = bit);
    protected T v; // or whatever
    ...
  endclass

OK, now let's derive something from C...

  class D #(parameter type P = bit) extends C;
    ...

But I would like to be able to choose the value of C's
type parameter T, when I instantiate an object of class D.
I think I would like to be able to say

  class D #(parameter type P = bit) extends C #(.T(P));

so that the derived class's type parameter is passed
on to the base class. But the syntax doesn't seem to
allow for this, and it is not mentioned in the LRM.

I believe that this facility is important to allow the
creation of various kinds of container class. It is
available in C++ using templates. Is this a deliberate
omission from SV3.1, an oversight in the BNF, or have I
missed something?

~~~~~~~~~~~~~~~~~ repeated message ends ~~~~~~~~~~~~~~~~

-- 
Jonathan Bromley
Consultant

DOULOS - Developing Design Know-how VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK Tel: +44 (0)1425 471223 Email: jonathan.bromley@doulos.com Fax: +44 (0)1425 471573 Web: http://www.doulos.com

This e-mail and any attachments are confidential and Doulos Ltd. reserves all rights of privilege in respect thereof. It is intended for the use of the addressee only. If you are not the intended recipient please delete it from your system, any use, disclosure, or copying of this document is unauthorised. The contents of this message may contain personal views which are not the views of Doulos Ltd., unless specifically stated.



This archive was generated by hypermail 2b28 : Wed Sep 03 2003 - 11:22:22 PDT