The LRM does not address whether "lval" determination is done in an eager or lazy manner. Consider the following: module top; class C; int id; endclass C cid = new(); C cid_prev; task automatic next_val(output int val); #10 val = 5; // line 1 endtask initial begin #10 next_val(cid.id); // line 2 end initial begin #15 cid_prev = cid; // line 3 cid = new(); #10 $display(cid_prev.id,, cid.id); // line 4 end endmodule At time 10, line 2 calls next_val; with "cid" having some handle value (call it object1). At time 15, "cid" changes to associate to a new object (call it object2). At time 20 the next_val routine terminates and the copy out occurs. The question is whether the lval of "cid.id" was determined at the time of the call or at the time of the copy-out. In this case, the difference determines whether the assignment targets object1 or object2. Either approach has semantic peculiarities. If "cid" would become "null" before the copy-out, the "determination at exit" approach would cause a simulation error. If the "determination at entry" is adopted, the call might be required to keep an object alive if the routine becomes the last reference. There are similar issues with respect to array indexing using an index expression that changes during the task evaluation. In addition, if the formal in "next_val" was "inout", then adopting "determination at exit" would mean that the copy-in and copy-out could actually relate to different locations (object1's id would be copied-in; object2's id would be the copy out target). The LRM doesn't clearly discuss this issue, but I suspect that "determination at exit" is the expected answer (meaning that "object2" is the target in my original example). Does everyone concur with that expectation? 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 Thu Dec 11 14:41:55 2008
This archive was generated by hypermail 2.1.8 : Thu Dec 11 2008 - 14:44:13 PST