[sv-ec] static members of modules

From: danielm <danielm_at_.....>
Date: Fri Dec 14 2007 - 08:18:57 PST
SV allows to declare module member as static but doesn't define behaviour of
such static member. Maybe this static keyword is just redundand(in this case
this possibility should be removed from LRM) or maybe it may have sense -
example:

module sub;
    static int i ;
    initial $monitor("%m:: %t> %d", $time, i);
endmodule
 
module top;
    sub i1();

    sub i2();
    initial begin
          #1;i1.i=1;

          #1;i2.i=2;

          #1;
        $finish;
    end
endmodule

Proposition : Variable i should be really static - the same in all instances
- otherwise this use of static is misleading. 
Below 2 possible results which should be ok 1st for 'i' as real static var
and 2nd for 'i' as usual module member:
 
1st
top.i1::                    0>           0
top.i2::                    0>           0
top.i1::                    1>           1
top.i2::                    1>           1
top.i1::                    2>           2
top.i2::                    2>           2
 
2nd
top.i1::                    0>           0
top.i2::                    0>           0
top.i1::                    1>           1
top.i2::                    2>           2
 
 
Daniel Mlynek

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sat Dec 15 02:36:23 2007

This archive was generated by hypermail 2.1.8 : Sat Dec 15 2007 - 02:36:47 PST