hdl.ast: add Value.xor, mapping to $reduce_xor.

Fixes #147.
This commit is contained in:
whitequark 2019-09-13 14:28:43 +00:00
parent b23a9794a4
commit 32310aecad
4 changed files with 23 additions and 0 deletions

View file

@ -157,6 +157,16 @@ class Value(metaclass=ABCMeta):
"""
return Operator("r&", [self])
def xor(self):
"""Compute pairwise exclusive-or of every bit.
Returns
-------
Value, out
``1`` if an odd number of bits are set, ``0`` if an even number of bits are set.
"""
return Operator("r^", [self])
def implies(premise, conclusion):
"""Implication.