Subject: [sv-bc] Suggestions for additional typedef syntax
From: Paul Graham (pgraham@cadence.com)
Date: Fri Nov 07 2003 - 08:30:07 PST
Is it possible to declare a typedef which is based on another type but
differs only in its signedness or "packed"ness?  For instance:
    typedef bit [7:0] t1;	// unsigned packed 8-bit array of bit
*    typedef t1 signed t2;	// t2 is a signed 8-bit array of bit
*    typedef t1 unpacked t3;	// t3 is an unpacked 8-bit array of bit
The typedefs for t2 and t3 are not now syntactically possible.  Does anyone
think they should be allowed?
Similarly, you could have:
    typedef struct { ... } t1;
    t1 x;
*    t1 packed y;
*    t1 signed z;
This would allow variables to use the same type definition but have
different sign or packedness.  The only way to do this now is to write:
    struct { ... } x;
    struct packed { ... copy of above ... } y;
    struct signed { ... other copy ... } z;
This is somewhat like a vhdl subtype declaration:
    subtype t2 is resolved t1;
or
    signal s : resolved t1;
which declares a subtype or variable of type t1 which differs only in the
resolution function.
Paul
This archive was generated by hypermail 2b28 : Fri Nov 07 2003 - 08:31:51 PST