Re: Fwd: Genvars only positive?

From: Paul Graham (pgraham@cadence.com)
Date: Mon Jul 09 2001 - 13:18:02 PDT


Cliff,

In answer to your question from a couple of weeks ago:

> Your question raises two interesting questions:
>
> Does Cadence permit negative index ranges on arrays of instance? This might
> actually be an omission in the IEEE documentation, where we should have
> required positive index ranges on arrays of instance, too.

Yes, it is possible to have negative index ranges on an array of instances.
For instance:

    module m(q, d1, d2);
        output [-4:3] q;
        input [-4:3] d1, d2;

        mod u[-4:3] (q, d1, d2);

        defparam u[4'sb1111].p = 2; // u[-1]
    endmodule

    module mod(q, d1, d2);
        parameter p = 1;
        output q;
        input d1, d2;

        assign q = d1 & d2;
    endmodule

Here, the defparam uses an indexed name to specify the element of the array
instance u. Apparently the index must be a numeric literal, and since -1 is
really a unary operator applied to a literal, it is not acceptable to
NC-Verilog. (Though u[-1] is apparently acceptable to Verilog-XL, so maybe
NC's behavior is a bug.)

By the way, the LRM doesn't seem to support instance array references. I
could find only a few clues in section 12.4 to suggest that instance array
references are legal. Footnote 3 of table 12-7 says:

    3 A simple_identifier and arrayed_reference shall start with an alpha or
    underscore (_) character, shall have at least one character, and shall
    not have any spaces.

So that suggests that there is such a thing an an arrayed_reference, which I
guess is how you refer to an element of an instance array. And the syntax
table for hierarchical names allows '[' and ']' characters, again presumably
to refer to an instance array element. But the actual text of the LRM
doesn't mention instance array references, much less define them.

Paul



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:42 PDT and
sponsored by Boyd Technology, Inc.