[sv-ec] Declaration order - vs - initialization order

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Fri Jul 18 2008 - 01:00:14 PDT
I cannot find any stmt in LRM saying that the initialization order should be
the same as declaration order - should it be implementation dependend, or
this just similar to race condition and the order is undefined by purpose?
SV allows static varialbe to be initialized with nonconstants - so this
became an issue.
Consider the example:
 
class C;   
 int p;
    function integer random4val;
        return p;
    endfunction
endclass
 
module top;
    C c = new;
    
    integer nc8 = c.random4val();//if initialization order should be the sam
as delcaration order - then ok, but if it is undefined then null pointer
exeption may occur. What about case when change the order of c and nc8
declaration?
        
    initial begin       
        $display("%0b", nc8);
    end
    
endmodule
 
 
DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Jul 18 01:00:54 2008

This archive was generated by hypermail 2.1.8 : Fri Jul 18 2008 - 01:01:32 PDT