How to write a constraint for xor gate?

how to write a constraint for xor gate?

In reply to lalithjithan:

You don’t.

In reply to dave_59:

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

In reply to dave_59:

In reply to lalithjithan:
You don’t.

why not, can you explain.

In reply to rraa:

Because there are no constraints on the input to an XOR gate.

In reply to dave_59:

Hi Dave,

I understand that the question should have been , “How to realize a XOR kind of effect using a constraint?”

If so, then will != work as a logical XOR ?

Meaning

constraint C1{ (a==1) != (b==2)}

i.e if “a” is 1 then “b” can be anything but 2 and if “b” is 2 then “a” can be anything but 1.

Regards