class C;
rand int x;
constraint proto1;
extern constraint proto2;
endclass
class A;
rand C c;
rand int y;
constraint proto3 {
y == 0;
}
function new();
c = new;
endfunction
endclass
// if the constraint body "C::proto1" is not defined, VCS issues a warning
// and treats it as an empty constraint
constraint C::proto1 { x < 10; }
// if the constraint body "C::proto2" is not defined, VCS issues an error
constraint C::proto2 { x > 4; }
如果声明了 external,但是外面没有定义该constraint,会报error。
如果不是external的,没有定义,报warning,认为是个空约束。