Re: [sv-bc] error in example in section 2.7


Subject: Re: [sv-bc] error in example in section 2.7
From: Paul Graham (pgraham@cadence.com)
Date: Mon Jan 12 2004 - 09:51:59 PST


> I thought we had fixed this example, but it is still in draft 3.
>
> Packed arrays of 'int' are not allowed. This example is illegal. See section
> 4.2:
>
> "Integer types with predefined widths cannot have packed array dimensions
> declared. These types are: byte, shortint, int, longint, and integer."

This restriction exists to allow backward compatibility with designs
which have, e.g.,

     integer [31:0] x;

This explains why integer cannot have a packed range, but why restrict all
the other integer types?

Also, my original question remains. Rewriting the example, we get:

> If the type is not given by the context, it must be specified with a
> cast.
>
> typedef signed bit [31:0] myint;
> typedef myint [1:3] triple; // 3 myints packed together
> b = triple'{0, 1, 2};

Again, type triple is a singular type. A concat seen in the context of a
singular type is just a concat, not an array literal. It is illegal to have
unsized integer literals in a regular concat. So this example should be
changed:

> typedef signed bit [31:0] myint;
> typedef myint [1:3] triple; // 3 myints packed together
> b = triple'{32'd0, 32'd1, 32'd2};

or:

> typedef integer triple [1:3]; // 3 integers *not* packed together
> b = triple'{0, 1, 2};

Paul



This archive was generated by hypermail 2b28 : Mon Jan 12 2004 - 09:52:46 PST