SystemVerilog学习笔记(一)
// static 在变量前
static int a;//所有人调用的全局变量,调用完后不会自动清空
//static 在类内的方法前
不用new()对象c,通过cl::a就可以调用该方法a
class cl
static function void a();
static int b;//该方法中的变量必须是静态的static
endfunction
endclass
cl c;
// static 在类内的方法后
类内的方法默认是automatic的即用完方法后方法内变量b将清空,加入static后则表示方法内的变量是静态的,这种方式可实现递归阶乘;
class cl
function static a();
int b;
endfunction
endclass
cl c;
c=new();