[Math] Binary to Gray code using XOR boolean expressions

binaryboolean-algebra

I have a question which asks to design a circuit to convert from binary to gray code, using a boolean expression.

Now I understand you have to use XOR to achieve this. And I understand that XOR means that only one or the other can be true, if both are true thats just nomral OR.

I also understanding how to convert between gray code and binary and vise versa through addition, with this video: Binary to Gray code video

I'm just having trouble understand how to do this using XOR. Below is the task I've been set and they've gave me some examples to start with, but I don't understand them.

If anyone could explain to me how these examples work I would be greatful.

Image of my task and some examples of boolean expressions using XOR

Best Answer

Refer to the 4-bit example in the above comment.
Standard binary to Gray code:
$a\mid b\mid c\mid d\qquad\to\qquad p\mid q\mid r\mid s$
where
$p=(a)$
$q=(a\not\equiv b)$
$r=(b\not\equiv c)$
$s=(c\not\equiv d)$
$====================$
Gray code to Standard binary:
$p\mid q\mid r\mid s\qquad\to\qquad a\mid b\mid c\mid d$
where
$a=(p)$
$b=(p\not\equiv q)$
$c=(p\not\equiv q\not\equiv r)$
$d=(p\not\equiv q\not\equiv r\not\equiv s)$
The XOR $\not\equiv$ operation is associative, so the order in which these multiple XORs are performed is immaterial.

Related Question