[sv-ec] Classes, var, etc.


Subject: [sv-ec] Classes, var, etc.
From: Kevin Cameron x3251 (Kevin.Cameron@nsc.com)
Date: Tue Feb 04 2003 - 14:43:27 PST


[Here are my major objections to the Class stuff as specified]

SV Classes are defined as an orthoganal construct to "struct",
and are only dynamic objects. This is entirely unlike C++ which
lets you base classes on structs.

SV Classes are also defined orthoganally to modules, however
the only major differences between a class and a module are that
the module can only be created by static elaboration and has
ports. If you said a module without ports (and instances of
other modules) could be instantiated/destroyed dynamically you
would probably have a lot of the same functionality that classes
give you.

I propose that we normalize these three objects (and interfaces
too) in a more coherent description: i.e. a class can be considered
as a struct with methods, and a module can be considered as a
class with ports (and an interface is a module with some additional
functionality).

That would allow you to describe a bus as a struct, inherit it into
class to add methods, and inherit the class into a module (or
interface) to instantiate it in a design with connectivity. E.g.:

  packed struct {
    int instr;
    int oprnd_rslt;
  } bus;

  class bus_cls : bus;
    function chk_valid();
      ...
    endfunction
  endclass

  interface bus_mod : bus_cls (inout bus);
    ...
  endinterface

You should also be able instantiate classes statically as with
structs and modules, which doesn't fit with the current syntax
which assumes all class declarations are just handles. You need
"var" or "&" syntax to differentiate.

Regards,
Kev.

-- 
National Semiconductor, Tel: (408) 721 3251
2900 Semiconductor Drive, Mail Stop D3-500, Santa Clara, CA 95052-8090



This archive was generated by hypermail 2b28 : Tue Feb 04 2003 - 14:44:33 PST