Re: [sv-bc] packed array question

From: Steven Sharp <sharp_at_.....>
Date: Fri Dec 16 2005 - 16:49:28 PST
>From: Greg Jaxon <Greg.Jaxon@synopsys.com>

>   Steve is /not/ proposing that typedef should be able to use
>a declarative syntax which is illegal when used anonymously.
>
>typedef integer [7:0] i;  // Still illegal
>
>   He is just recounting the "workaround" we discussed long ago:
>
>typedef integer my_int;
>my_int [7:0] ANONYMOUSLY;  // 8 integers packed in a vector.

Yes.  Thanks, I hadn't quite understood what Francoise was saying.


>   Of course there's no technical impediment to packing integers
>into vectors.  I think you'll agree with this without exception.
>As a veteran of other standards, I'll note that inviting different
>users to dream up synonyms for "integer" is divergent, not convergent.

Of course, making it illegal to use integer directly for this will
just mean that they come up with a synonym defined another way:

  typedef logic signed [31:0] my_int;
  my_int [7:0] ANONYMOUSLY;
  
If they then assume that this is the same size as an integer,
then another subtle problem has crept in (though if they were
trying to get 32 bits, then making them do this has protected
them from a subtle problem instead).  Or they can really jump
through hoops to declare a better synonym:

  typedef logic signed [$bits(integer)-1:0] my_int;
  my_int [7:0] ANONYMOUSLY; 

I will admit that specifying the rules to disallow the built-in type
but not the synonym is a bit awkward.  But that is exactly what the
LRM did with reg on a net declaration.

Steven Sharp
sharp@cadence.com
Received on Fri Dec 16 16:49:40 2005

This archive was generated by hypermail 2.1.8 : Fri Dec 16 2005 - 16:49:49 PST