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,認為是個空約束。