RE: Issue with Generate

From: Kausik Datta (kausikd@cal.interrasystems.com)
Date: Sat Feb 26 2005 - 01:47:23 PST

  • Next message: Kausik Datta: "Array of instances and configuration"

    Hi Steven,
    I agree with your point, at least V2K LRM doesn't support the hier-ref in
    constant expression,
    I am not sure of SV.
    But the following example is passed by MTI simulator.

    module top;
      generate
        if (I1.p == 1 )
          M2 I1();
        else
          M3 I1();
      endgenerate
      M3 I1();
    endmodule

    module M2;
      parameter p = 10;
    endmodule

    module M3;
      parameter p = 1;
    endmodule

    Thanks
    Kausik
     

    -----Original Message-----
    From: owner-btf@boyd.com [mailto:owner-btf@boyd.com] On Behalf Of Steven
    Sharp
    Sent: Saturday, February 26, 2005 2:01 AM
    To: pgraham@cadence.com; kausikd@cal.interrasystems.com
    Cc: btf@boyd.com
    Subject: RE: Issue with Generate

    >No. In 1364-2001 LRM generate doesn't define any scope.
    >I think in latest draft 3 or 4 some scope is defined like that.

    That change is intended to be regarded as an erratum, so generate constructs
    should define a scope in 1364-2001. But as you say, the issue is not with
    the defparam. The example could be modified to get around that issue, by
    naming the scope and adding it to the hierarchical name in the defparam.

    >Issue is with the line
    >
    > if ( I1.p == 1 )
    >
    >Even if you remove the defparam line none of the simulator will be able
    >to elaborate this design.

    And they are correct. The condition of a conditional generate must be a
    constant expression. Hierarchical references are not legal in constant
    expressions. Therefore, this is illegal by the existing LRM.
    I was unable to find a place in the LRM text that made clear that
    hierarchical references are not legal in constant expressions, but you can
    track it down through the BNF.

    The kind of circular dependency that appears in this example is part if why
    hierarchical references are not legal in constant expressions.

    Steven Sharp
    sharp@cadence.com



    This archive was generated by hypermail 2.1.4 : Sat Feb 26 2005 - 01:28:16 PST and
    sponsored by Boyd Technology, Inc.