Re: new AMS LRM 2.2 draft c - parameter descriptions

From: Kevin Cameron <kcameron@cputech.com>
Date: Wed May 26 2004 - 16:32:03 PDT

I really don't think the syntax for units and descriptions will fly with
the SV & IEEE. SV has classes which makes it unnecessary to do it that
way: all you need is a base class which has the two strings or string
functions and you can create the types you need as subclasses e.g.:-

    class unit_desc; // this could be a built-in
       real value;
       virtual function string unit(); endfunction;
       virtual function string desc(); endfunction;
    endclass

    // these would be in a header file
    class Ohms extends unit_desc;
      function string unit(); return "Ohms"; endfunction;
    endclass

    class Resistance extends Ohms;
      function string desc(); return "Resistance"; endfunction;
    endclass

    ....
    // Your code -

    parameter Resistance from [0:inf);

- lots less typing if you have a lot of thing you want to be of type
Resistance.

You can also do paramaterized classes which would let you do something like:

    parameter unit_desc#("Ohms","Resistance") from [0:inf);

- but an approach that requires you to enter the strings for every
individual parameter is tedious and eror-prone, so you would probably do:-

    typedef unit_desc#("Ohms","Resistance") Resistance;
    ....

    parameter Resistance from [0:inf);

I would just scrub section 3.2.3.

Kev.

Geoffrey.Coram wrote:

>Hi -
>I've uploaded a new draft of the LRM to the eda.org web site.
>
>

-- 
Kevin Cameron, CPU Technology, CA 94588, Tel.: (925) 225 4862
Received on Wed May 26 16:32:12 2004

This archive was generated by hypermail 2.1.8 : Wed May 26 2004 - 16:32:18 PDT