How to write a constraint for xor gate?

In reply to dave_59:

constraint C1{a^b==1;}
Is it work right…?