Mark Hartoog wrote: > When I get time in the next few days I will send what I think > are the best answers for this quiz, but I think these question > do not really address the corner cases. They weren't intended to. If we don't have agreement on the basic foundation of the rules, why bother getting into the really obscure cases? And your examples aren't really all that obscure yet. > Consider the case below. How do these 8 resolve or not resolve > in both the instances u0 and u1: Most of this is covered in the rules that I suggested and I think virtually all of this is covered in (or implied by) my quiz. My answers are below and are driven by application of the rules that I have been talking about. We can keep slinging examples around but it would be much more useful if you could state your answers and the rules that you want to apply rather than everyone having to try to guess at what you are after. > > typedef struct { > int x; > int y; > } ST; > > class A; > function void f1(); > endfunction > function void f2(); > endfunction > endclass > > ST a1; > A a2; > > module child; > parameter P = 1; > > initial > begin > a1.x = 0; // (1) > a2.f1(); // (2) For both (1) and (2), the parse time visible names "a1" and "a2" admit "." so both of these bind to the $unit versions. > a3.x = 0; // (3) a3 does not have a visible binding and contains a "." so it is a hierarchical name. In instance u0, the a3 block exists and a3.x resolves to top.u0.a3.x. In instance u1 the a3 block does not exist. Since a3.x is a *hierarchical* reference, "a3" is required to resolve to a scope. Since $unit.a3 is not a scope, this does not resolve. > a4.f1(); // (4) This one is no different than the a3 case. > end > > generate > if (P == 0) begin : a1 > int x; > int y; > end : a1 > if (P == 0) begin : a2 > function void f1(); > endfunction > function void f2(); > endfunction > end : a2 > if (P == 0) begin : a3 > int x; > int y; > end : a3 > if (P == 0) begin : a4 > function void f1(); > endfunction > function void f2(); > endfunction > end : a4 > endgenerate > > initial > begin > a1.y = 0; // (5) In this case a1 binds to a scope name. So a1.y is a hierarchical name. In instance u0 it resolves to top.u0.a1.y; in instance u1 it does not resolve since $unit::a1 is not a scope. > a2.f2(); // (6) > a3.y = 0; // (7) > a4.f2(); // (8) These 3 all follow the same behavior as (5). Gord > end > endmodule > > ST a3; > A a4; > > module top(); > child #(.P(0)) u0(); > child #(.P(1)) u1(); > endmodule > -- -------------------------------------------------------------------- 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 Jun 4 07:05:21 2007
This archive was generated by hypermail 2.1.8 : Mon Jun 04 2007 - 07:05:26 PDT