[sv-bc] Ballot Issue 129 / Mantis 2610

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Mon Apr 27 2009 - 09:38:54 PDT
This ballot issue raises questions related to name binding
in the presence of type parameters and inline constraints.

See in particular the threads at:
    http://www.eda.org/sv-ec/hm/4603.html
    http://www.eda.org/sv-ec/hm/5127.html
and
    Mantis 1858


I think that although the LRM does not explicitly address the
questions in the ballot issue, I think that the implications
are reasonably clear -- that the name resolution must produce
results that are the same as would have been seen with an
explicit type.

The main difficult case raised is:

    package p;
      class base;
      endclass

      int y;
    endpackage

    import p::*;
    module top;
       m u1 #(base) ();
    endmodule

    module m #(parameter type T = int);
      T c = new;
      int x;
      initial
         c.randomize with { y > x; };
    endmodule


With the question of what "y" binds to in the inline
constraint.

I think that the answer must be that "y" binds to
p::y.  Unfortunately that does mean that one can also
have deferred errors:

    module m #(parameter type T = int);
      T c = new;
      int x;
      initial
         c.randomize with { y > x; };

      int y;
    endmodule

In the above modification, you cannot determine whether the
declaration of "int y;" in m is an error until you determine
the binding of "T".  So you can actually get identifier
declaration errors very late.

I really, really dislike the above but I believe that the
above description is what is required by the LRM.

Gord.
-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Apr 27 10:35:32 2009

This archive was generated by hypermail 2.1.8 : Mon Apr 27 2009 - 10:36:27 PDT