Wreal/User defined types on wires

From: Kevin Cameron <edaorg@v-ms.com>
Date: Thu Mar 11 2010 - 12:23:56 PST

Just a note on how I would suggest doing user-defined wire types (in
AMS/SV).

Syntax wise I'd suggest just doing -

    wire <type> <wires>;

Where <type> can be either a built-in type (e.g. real) or a struct or
class. Built-in/struct types can be used for non-resolved copy-through.

Since SV has typedef you can put a declaration like -

    typedef wire real wreal;

- in a standard header, and the semantics would be as current AMS for
wreal declarations in user code.

If you need resolved type then you can use a class definition, and add
the resolution function to the class. For AMS compatibility and
plug&play/polymorphism I would also suggest recognizing flow/potential
functions in the class for use with discipline access functions e.g.:

  class my_res_real;
    real r;
    function real resolver (real []); // takes array of driver values
      ....
      return x;
    endfunction
    function real potential;
      return r;
    endfunction
    ...
    // copy constructors etc. here
    ...
  endclass

  typedef wire my_res_real wreal; // use instead of standard definition

In the code you could then say -

  module ...
    wreal wr;
    electrical wr; // sets access functions

    always @...
      if (V(wr) > 2.0) begin // V() -> potential method of class
        ...

With this kind of scheme you have backward compatibility (if you want it) and as much flexibility for real value usage as anyone is currently asking for, and the methodology extends to other uses (like RF signal modeling).

Kev.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Mar 11 12:24:06 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 11 2010 - 12:24:18 PST