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

  • $\begingroup$ Can you tell us what "gray code" means? $\endgroup$ – Thomas Andrews Feb 7 '16 at 14:10
  • $\begingroup$ Well i can link you this if that helps en.wikipedia.org/wiki/Gray_code $\endgroup$ – user310998 Feb 7 '16 at 14:15
  • $\begingroup$ That doesn't excuse you from including it in your question. Help people help you. Otherwise, the more you make people google stuff to understand your question, the more you require them to click on links, the fewer people who will help. $\endgroup$ – Thomas Andrews Feb 7 '16 at 14:21
  • $\begingroup$ Well I would have thought that people who are anwering the question already know what the Gray code is. I can't explain it myself so I have to give links. I just want the question answered not this pointless bickering. $\endgroup$ – user310998 Feb 7 '16 at 15:00
  • $\begingroup$ Gray code is a resequencing of a set of binary numbers, so that in the new sequence, progressing from one member of the sequence to the next, the difference between any two consecutive members is only in one bit position. See the following: $$\matrix{0000&0000\cr0001&0001\cr0010&0011\cr0011&0010\cr0100&0110\cr0101&0111 \cr0110&0101\cr0111&0100\cr1000&1100\cr1001&1101\cr1010&1111\cr1011&1110\cr1100&1010\cr1101&1011\cr1110&1001\cr1111&1000}$$ $\endgroup$ – Senex Ægypti Parvi Feb 7 '16 at 15:50

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$
$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$
$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.

  • $\begingroup$ what does the three lines with the line through mean? $\endgroup$ – user310998 Feb 11 '16 at 23:02
  • $\begingroup$ @GR412 \ It's one of the several ways of expressing the exclusive-or operation. It is generated as follows: \not\equiv $\endgroup$ – Senex Ægypti Parvi Feb 15 '16 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy